@trackunit/i18n-library-translation 0.0.158 → 0.0.159
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 -3
- package/index.esm.js +3 -2
- package/package.json +2 -2
package/index.cjs.js
CHANGED
|
@@ -9,7 +9,7 @@ var irisAppApi = require('@trackunit/iris-app-api');
|
|
|
9
9
|
var i18next = require('i18next');
|
|
10
10
|
var browserLanguageDetector = require('i18next-browser-languagedetector');
|
|
11
11
|
var resourcesToBackend = require('i18next-resources-to-backend');
|
|
12
|
-
var
|
|
12
|
+
var reactCoreHooks = require('@trackunit/react-core-hooks');
|
|
13
13
|
|
|
14
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
15
|
|
|
@@ -35,7 +35,6 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
35
35
|
var i18next__default = /*#__PURE__*/_interopDefaultLegacy(i18next);
|
|
36
36
|
var browserLanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(browserLanguageDetector);
|
|
37
37
|
var resourcesToBackend__default = /*#__PURE__*/_interopDefaultLegacy(resourcesToBackend);
|
|
38
|
-
var Sentry__namespace = /*#__PURE__*/_interopNamespace(Sentry);
|
|
39
38
|
|
|
40
39
|
/**
|
|
41
40
|
* Minimal wrapper of i18ns Trans component - only exposing what is currently needed - while ensuring type safety on translation keys.
|
|
@@ -149,11 +148,12 @@ const initializeTranslationsForApp = () => {
|
|
|
149
148
|
* @returns {[TransForLibs, i18n, boolean]} useTranslation with custom t function
|
|
150
149
|
*/
|
|
151
150
|
const useNamespaceTranslation = (namespace, options) => {
|
|
151
|
+
const { captureException } = reactCoreHooks.useErrorHandler();
|
|
152
152
|
const customUseTranslation = reactI18next.useTranslation(namespace, options);
|
|
153
153
|
const [t, i18NextInstance] = reactI18next.useTranslation(namespace, options);
|
|
154
154
|
const customT = React.useCallback(function (key, arg2, arg3) {
|
|
155
155
|
if (key && !i18NextInstance.exists(key, { lng: "en", ns: namespace })) {
|
|
156
|
-
|
|
156
|
+
captureException(new Error(JSON.stringify({
|
|
157
157
|
info: "A Translation key could not be found!",
|
|
158
158
|
key,
|
|
159
159
|
namespace,
|
package/index.esm.js
CHANGED
|
@@ -6,7 +6,7 @@ import { languageKeys } from '@trackunit/iris-app-api';
|
|
|
6
6
|
import i18next from 'i18next';
|
|
7
7
|
import browserLanguageDetector from 'i18next-browser-languagedetector';
|
|
8
8
|
import resourcesToBackend from 'i18next-resources-to-backend';
|
|
9
|
-
import
|
|
9
|
+
import { useErrorHandler } from '@trackunit/react-core-hooks';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Minimal wrapper of i18ns Trans component - only exposing what is currently needed - while ensuring type safety on translation keys.
|
|
@@ -120,11 +120,12 @@ const initializeTranslationsForApp = () => {
|
|
|
120
120
|
* @returns {[TransForLibs, i18n, boolean]} useTranslation with custom t function
|
|
121
121
|
*/
|
|
122
122
|
const useNamespaceTranslation = (namespace, options) => {
|
|
123
|
+
const { captureException } = useErrorHandler();
|
|
123
124
|
const customUseTranslation = useTranslation(namespace, options);
|
|
124
125
|
const [t, i18NextInstance] = useTranslation(namespace, options);
|
|
125
126
|
const customT = useCallback(function (key, arg2, arg3) {
|
|
126
127
|
if (key && !i18NextInstance.exists(key, { lng: "en", ns: namespace })) {
|
|
127
|
-
|
|
128
|
+
captureException(new Error(JSON.stringify({
|
|
128
129
|
info: "A Translation key could not be found!",
|
|
129
130
|
key,
|
|
130
131
|
namespace,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/i18n-library-translation",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.159",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"i18next": "21.10.0",
|
|
15
15
|
"i18next-browser-languagedetector": "6.1.8",
|
|
16
16
|
"i18next-resources-to-backend": "^1.1.4",
|
|
17
|
-
"@
|
|
17
|
+
"@trackunit/react-core-hooks": "*"
|
|
18
18
|
},
|
|
19
19
|
"module": "./index.esm.js",
|
|
20
20
|
"main": "./index.cjs.js"
|