Socket
Socket
Sign inDemoInstall

storybook-react-i18next

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

storybook-react-i18next - npm Package Compare versions

Comparing version 1.0.20 to 1.1.1

12

CHANGELOG.md

@@ -0,1 +1,13 @@

# v1.0.21 (Tue Jun 14 2022)
#### ⚠️ Pushed to `main`
- feat(i18next): disable suspense, add backend, update SB 6.5 ([@stevensacks](https://github.com/stevensacks))
#### Authors: 1
- Steven Sacks ([@stevensacks](https://github.com/stevensacks))
---
# v1.0.20 (Mon Apr 11 2022)

@@ -2,0 +14,0 @@

11

dist/cjs/withI18Next.js

@@ -56,2 +56,7 @@ "use strict";

}, 100);
return function () {
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
}
};
} // eslint-disable-next-line react-hooks/exhaustive-deps

@@ -62,9 +67,7 @@

if (i18n && show) {
return /*#__PURE__*/_react["default"].createElement(_react.Suspense, {
fallback: "Loading..."
}, /*#__PURE__*/_react["default"].createElement(_react.Fragment, {
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, {
key: locale
}, /*#__PURE__*/_react["default"].createElement(_reactI18next.I18nextProvider, {
i18n: i18n
}, story(context))));
}, story(context)));
}

@@ -71,0 +74,0 @@

@@ -13,3 +13,3 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

import React, { Suspense, Fragment } from 'react';
import React, { Fragment } from 'react';
import { useEffect, useGlobals, useRef, useState } from '@storybook/client-api';

@@ -41,2 +41,7 @@ import { I18nextProvider } from 'react-i18next';

}, 100);
return function () {
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
}
};
} // eslint-disable-next-line react-hooks/exhaustive-deps

@@ -47,9 +52,7 @@

if (i18n && show) {
return /*#__PURE__*/React.createElement(Suspense, {
fallback: "Loading..."
}, /*#__PURE__*/React.createElement(Fragment, {
return /*#__PURE__*/React.createElement(Fragment, {
key: locale
}, /*#__PURE__*/React.createElement(I18nextProvider, {
i18n: i18n
}, story(context))));
}, story(context)));
}

@@ -56,0 +59,0 @@

{
"name": "storybook-react-i18next",
"version": "1.0.20",
"version": "1.1.1",
"description": "Add react-i18next support to Storybook",

@@ -47,23 +47,23 @@ "keywords": [

"dependencies": {
"storybook-i18n": "^1.0.11"
"storybook-i18n": "^1.1.1"
},
"devDependencies": {
"@babel/cli": "^7.17.6",
"@babel/core": "^7.17.9",
"@babel/preset-env": "^7.16.11",
"@babel/preset-react": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@storybook/addon-essentials": "^6.4.21",
"@storybook/addons": "^6.4.21",
"@storybook/api": "^6.4.21",
"@storybook/components": "^6.4.21",
"@storybook/core-events": "^6.4.21",
"@storybook/theming": "^6.4.21",
"@storybook/react": "^6.4.21",
"auto": "^10.36.5",
"babel-loader": "^8.2.4",
"@babel/cli": "^7.17.10",
"@babel/core": "^7.18.5",
"@babel/preset-env": "^7.18.2",
"@babel/preset-react": "^7.17.12",
"@babel/preset-typescript": "^7.17.12",
"@storybook/addon-essentials": "^6.5.9",
"@storybook/addons": "^6.5.9",
"@storybook/api": "^6.5.9",
"@storybook/components": "^6.5.9",
"@storybook/core-events": "^6.5.9",
"@storybook/theming": "^6.5.9",
"@storybook/react": "^6.5.9",
"auto": "^10.37.1",
"babel-loader": "^8.2.5",
"boxen": "^5.1.2",
"concurrently": "^6.5.1",
"dedent": "^0.7.0",
"i18next": "^21.6.15",
"i18next": "^21.8.9",
"prettier": "^2.6.2",

@@ -75,12 +75,12 @@ "prop-types": "^15.8.1",

"rimraf": "^3.0.2",
"typescript": "^4.6.3",
"typescript": "^4.7.3",
"zx": "1.14.1"
},
"peerDependencies": {
"@storybook/addons": "^6.4.17 || >6.5.0-alpha",
"@storybook/api": "^6.4.17 || >6.5.0-alpha",
"@storybook/components": "^6.4.17 || >6.5.0-alpha",
"@storybook/core-events": "^6.4.17 || >6.5.0-alpha",
"@storybook/theming": "^6.4.17 || >6.5.0-alpha",
"i18next": "^20.0.0 || ^21.0.0",
"@storybook/addons": ">=6.5.0",
"@storybook/api": ">=6.5.0",
"@storybook/components": ">=6.5.0",
"@storybook/core-events": ">=6.5.0",
"@storybook/theming": ">=6.5.0",
"i18next": ">=21.0.0",
"i18next-browser-languagedetector": "^6.1.4",

@@ -87,0 +87,0 @@ "i18next-http-backend": "^1.4.0",

@@ -6,4 +6,4 @@ # Storybook react-i18next addon

Required Peer Dependencies:
* storybook - `^6.4.17`
* i18next - `^20.0.0 || ^21.0.0`
* storybook - `>=6.5.0`
* i18next - `>=21.0.0`
* i18next-browser-languagedetector - `^6.1.4`

@@ -29,7 +29,7 @@ * i18next-http-backend: `^1.4.0`

```bash
npm i -S i18next react-i18next
npm i -S i18next react-i18next i18next-browser-languagedetector i18next-http-backend
```
```bash
yarn add i18next react-i18next
yarn add i18next react-i18next i18next-browser-languagedetector i18next-http-backend
```

@@ -56,6 +56,7 @@

In this file, copy and paste the below code and make whatever modifications you need.
In this file, copy and paste the below code and make whatever modifications you need (paths to resource files, languages, etc.).
```javascript
import {initReactI18next} from 'react-i18next';
import i18n from 'i18next';
import Backend from 'i18next-http-backend';
import LanguageDetector from 'i18next-browser-languagedetector';

@@ -65,5 +66,16 @@

const supportedLngs = ['en', 'fr', 'ja'];
const resources = ns.reduce((acc, n) => {
supportedLngs.forEach((lng) => {
if (!acc[lng]) acc[lng] = {};
acc[lng] = {
...acc[lng],
[n]: require(`../public/locales/${lng}/${n}.json`),
};
});
return acc;
}, {});
i18n.use(LanguageDetector)
.use(initReactI18next)
i18n.use(initReactI18next)
.use(LanguageDetector)
.use(Backend)
.init({

@@ -73,20 +85,10 @@ //debug: true,

fallbackLng: 'en',
interpolation: {
escapeValue: false,
},
defaultNS: 'common',
ns,
interpolation: {escapeValue: false},
react: {useSuspense: false},
supportedLngs,
resources,
});
supportedLngs.forEach((lang) => {
ns.forEach((n) => {
i18n.addResourceBundle(
lang,
n,
require(`../public/locales/${lang}/${n}.json`)
);
});
});
export default i18n;

@@ -93,0 +95,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc