@hitachivantara/uikit-cli 6.0.4 → 6.0.5
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": "@hitachivantara/uikit-cli",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Hitachi Vantara UI Kit Team",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"access": "public",
|
|
45
45
|
"directory": "package"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "4b588056f4226feaedfa7fe4333225358436ccf2"
|
|
48
48
|
}
|
|
@@ -4,25 +4,20 @@ import { createInstance, type i18n } from "i18next";
|
|
|
4
4
|
import LanguageDetector from "i18next-browser-languagedetector";
|
|
5
5
|
import Backend, { type HttpBackendOptions } from "i18next-http-backend";
|
|
6
6
|
|
|
7
|
-
const initAppI18n = (baseUrl: string) => {
|
|
8
|
-
const i18nInstance
|
|
7
|
+
const initAppI18n = (baseUrl: string): i18n => {
|
|
8
|
+
const i18nInstance = createInstance();
|
|
9
9
|
|
|
10
10
|
const loadPath = `${baseUrl}locales/{{lng}}/{{ns}}.json`;
|
|
11
11
|
|
|
12
|
+
// learn more: https://react.i18next.com/latest/using-with-hooks#configure-i18next
|
|
12
13
|
i18nInstance
|
|
13
|
-
// load translation using xhr -> see /public/locales
|
|
14
|
-
// learn more: https://github.com/i18next/i18next-xhr-backend
|
|
15
14
|
.use(Backend)
|
|
16
|
-
// detect user language
|
|
17
|
-
// learn more: https://github.com/i18next/i18next-browser-languageDetector
|
|
18
15
|
.use(LanguageDetector)
|
|
19
|
-
// pass the i18n instance to react-i18next.
|
|
20
16
|
.use(initReactI18next)
|
|
21
|
-
// init i18next
|
|
22
|
-
// for all options read: https://www.i18next.com/overview/configuration-options
|
|
23
17
|
.init<HttpBackendOptions>({
|
|
24
18
|
fallbackLng: "en",
|
|
25
|
-
|
|
19
|
+
// enable explicit declaration to avoid fetching non-existing `lng`s
|
|
20
|
+
// supportedLngs: ["en"],
|
|
26
21
|
backend: {
|
|
27
22
|
loadPath,
|
|
28
23
|
},
|
|
@@ -36,9 +31,8 @@ const initAppI18n = (baseUrl: string) => {
|
|
|
36
31
|
};
|
|
37
32
|
|
|
38
33
|
export const useI18nInstance = () => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
);
|
|
34
|
+
return useMemo(() => {
|
|
35
|
+
const moduleId = "@hv-apps/uikit-app";
|
|
36
|
+
return initAppI18n(import.meta.resolve?.(`${moduleId}/`) || "");
|
|
37
|
+
}, []);
|
|
44
38
|
};
|
|
@@ -15,7 +15,9 @@ export function withProvider<
|
|
|
15
15
|
const ComponentWithProvider: React.FC<P> = (props) => {
|
|
16
16
|
return (
|
|
17
17
|
<Suspense fallback={null}>
|
|
18
|
-
<
|
|
18
|
+
<Provider>
|
|
19
|
+
<WrappedComponent {...props} />
|
|
20
|
+
</Provider>
|
|
19
21
|
</Suspense>
|
|
20
22
|
);
|
|
21
23
|
};
|