@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 +1 -1
- package/src/useSharedLibTranslate.js +14 -13
package/package.json
CHANGED
|
@@ -3,19 +3,20 @@ import i18next from 'i18next';
|
|
|
3
3
|
|
|
4
4
|
const fallbackLocale = 'en-US';
|
|
5
5
|
|
|
6
|
-
const setLocaleAsync = async () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
};
|