@designcrowd/fe-shared-lib 1.2.0-tr-1 → 1.2.0-tr-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designcrowd/fe-shared-lib",
3
- "version": "1.2.0-tr-1",
3
+ "version": "1.2.0-tr-2",
4
4
  "scripts": {
5
5
  "start": "npm run storybook",
6
6
  "build": "npm run build:css --production",
@@ -3,19 +3,20 @@ import i18next from 'i18next';
3
3
 
4
4
  const fallbackLocale = 'en-US';
5
5
 
6
- const setLocaleAsync = async () => {
7
- await i18next.init({
8
- debug: false,
9
- fallbackLng: fallbackLocale,
10
- lng: 'en-US',
11
- resources: {
12
- 'en-US': {
13
- 'fe-shared-lib': {
14
- ...{
15
- testmessage: 'This is a test message from i18',
16
- },
17
- },
18
- },
6
+ const setLocaleAsync = async (locale) => {
7
+ const localeToUse = locale;
8
+
9
+ if (!i18next.isInitialized) {
10
+ await i18next.init({
11
+ debug: false,
12
+ fallbackLng: fallbackLocale,
13
+ lng: localeToUse,
14
+ });
15
+ }
16
+
17
+ await i18next.addResourceBundle(localeToUse, 'fe-shared-lib', {
18
+ ...{
19
+ testmessage: 'This is a test message from i18',
19
20
  },
20
21
  });
21
22
  };