@trackunit/i18n-library-translation 1.21.8 → 1.22.0
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/index.cjs.js +3 -2
- package/index.esm.js +3 -2
- package/package.json +3 -3
package/index.cjs.js
CHANGED
|
@@ -125,8 +125,9 @@ const useNamespaceTranslation = (namespace, options) => {
|
|
|
125
125
|
const errorhandler = reactCoreHooks.useErrorHandlerOrNull();
|
|
126
126
|
const customUseTranslation = reactI18next.useTranslation(namespace, options);
|
|
127
127
|
const [t, i18NextInstance] = reactI18next.useTranslation(namespace, options);
|
|
128
|
+
const { ready } = customUseTranslation;
|
|
128
129
|
const customT = react.useCallback(function (key, arg2, arg3) {
|
|
129
|
-
if (key && !i18NextInstance.exists(key, { lng: "en", ns: namespace })) {
|
|
130
|
+
if (ready && key && !i18NextInstance.exists(key, { lng: "en", ns: namespace })) {
|
|
130
131
|
errorhandler?.captureException(new Error(JSON.stringify({
|
|
131
132
|
info: "A Translation key could not be found!",
|
|
132
133
|
key,
|
|
@@ -152,7 +153,7 @@ const useNamespaceTranslation = (namespace, options) => {
|
|
|
152
153
|
// Case: t(key)
|
|
153
154
|
return t(key);
|
|
154
155
|
}
|
|
155
|
-
}, [i18NextInstance, namespace, errorhandler, t]);
|
|
156
|
+
}, [i18NextInstance, namespace, errorhandler, t, ready]);
|
|
156
157
|
// Replace t function with customT
|
|
157
158
|
const updatedUseTranslation = react.useMemo(() => {
|
|
158
159
|
const result = [customT, customUseTranslation[1], customUseTranslation[2]];
|
package/index.esm.js
CHANGED
|
@@ -123,8 +123,9 @@ const useNamespaceTranslation = (namespace, options) => {
|
|
|
123
123
|
const errorhandler = useErrorHandlerOrNull();
|
|
124
124
|
const customUseTranslation = useTranslation(namespace, options);
|
|
125
125
|
const [t, i18NextInstance] = useTranslation(namespace, options);
|
|
126
|
+
const { ready } = customUseTranslation;
|
|
126
127
|
const customT = useCallback(function (key, arg2, arg3) {
|
|
127
|
-
if (key && !i18NextInstance.exists(key, { lng: "en", ns: namespace })) {
|
|
128
|
+
if (ready && key && !i18NextInstance.exists(key, { lng: "en", ns: namespace })) {
|
|
128
129
|
errorhandler?.captureException(new Error(JSON.stringify({
|
|
129
130
|
info: "A Translation key could not be found!",
|
|
130
131
|
key,
|
|
@@ -150,7 +151,7 @@ const useNamespaceTranslation = (namespace, options) => {
|
|
|
150
151
|
// Case: t(key)
|
|
151
152
|
return t(key);
|
|
152
153
|
}
|
|
153
|
-
}, [i18NextInstance, namespace, errorhandler, t]);
|
|
154
|
+
}, [i18NextInstance, namespace, errorhandler, t, ready]);
|
|
154
155
|
// Replace t function with customT
|
|
155
156
|
const updatedUseTranslation = useMemo(() => {
|
|
156
157
|
const result = [customT, customUseTranslation[1], customUseTranslation[2]];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/i18n-library-translation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"i18next": "25.1.2",
|
|
12
12
|
"i18next-browser-languagedetector": "8.1.0",
|
|
13
13
|
"i18next-resources-to-backend": "^1.2.1",
|
|
14
|
-
"@trackunit/iris-app-api": "1.20.
|
|
15
|
-
"@trackunit/react-core-hooks": "1.17.
|
|
14
|
+
"@trackunit/iris-app-api": "1.20.6",
|
|
15
|
+
"@trackunit/react-core-hooks": "1.17.9"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"react": "^19.0.0"
|