@trackunit/i18n-library-translation 0.0.2 → 0.0.4
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.js +9 -5
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useCallback } from 'react';
|
|
3
|
+
import { useCallback, useMemo } from 'react';
|
|
4
4
|
import { Trans, initReactI18next, useTranslation } from 'react-i18next';
|
|
5
5
|
import i18next from 'i18next';
|
|
6
6
|
import browserLanguageDetector from 'i18next-browser-languagedetector';
|
|
@@ -2825,7 +2825,8 @@ const useNamespaceTranslation = (namespace, options) => {
|
|
|
2825
2825
|
})) {
|
|
2826
2826
|
Sentry.captureException(new Error(JSON.stringify({
|
|
2827
2827
|
info: "A Translation key could not be found!",
|
|
2828
|
-
key
|
|
2828
|
+
key,
|
|
2829
|
+
namespace
|
|
2829
2830
|
})));
|
|
2830
2831
|
}
|
|
2831
2832
|
|
|
@@ -2836,9 +2837,12 @@ const useNamespaceTranslation = (namespace, options) => {
|
|
|
2836
2837
|
return t(key, arg2);
|
|
2837
2838
|
}, [i18NextInstance, namespace, t]); // Replace t function with customT
|
|
2838
2839
|
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2840
|
+
const updatedUseTranslation = useMemo(() => {
|
|
2841
|
+
customUseTranslation[0] = customT;
|
|
2842
|
+
customUseTranslation.t = customT;
|
|
2843
|
+
return customUseTranslation;
|
|
2844
|
+
}, [customUseTranslation, customT]);
|
|
2845
|
+
return updatedUseTranslation;
|
|
2842
2846
|
};
|
|
2843
2847
|
|
|
2844
2848
|
export { NamespaceTrans, initializeTranslationsForApp, registerTranslations, useNamespaceTranslation };
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@trackunit/i18n-library-translation",
|
|
3
3
|
"repository": "https://github.com/Trackunit/manager",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.4",
|
|
6
6
|
"module": "./index.js",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"type": "module",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"i18next": "21.10.0",
|
|
14
14
|
"i18next-browser-languagedetector": "6.1.8",
|
|
15
15
|
"i18next-resources-to-backend": "^1.0.0",
|
|
16
|
-
"@trackunit/iris-app-api": "0.0.
|
|
16
|
+
"@trackunit/iris-app-api": "0.0.59",
|
|
17
17
|
"@sentry/browser": "^7.15.0"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {}
|