@zohodesk/i18n 1.0.0-beta.35-murphy → 1.0.0-beta.36-murphy
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/es/utils/errorReporter.js +4 -0
- package/es/utils/index.js +1 -1
- package/es/utils/jsxTranslations.js +1 -1
- package/lib/utils/errorReporter.js +5 -0
- package/lib/utils/index.js +1 -1
- package/lib/utils/jsxTranslations.js +1 -1
- package/package.json +1 -1
- package/src/utils/errorReporter.js +5 -0
- package/src/utils/index.js +1 -1
- package/src/utils/jsxTranslations.js +1 -1
|
@@ -28,4 +28,8 @@ export function reportI18NError(type, key) {
|
|
|
28
28
|
}
|
|
29
29
|
export function clearReportedKeys() {
|
|
30
30
|
reportedKeys.clear();
|
|
31
|
+
}
|
|
32
|
+
export function getFallbackText(key) {
|
|
33
|
+
const isNumeric = /^\d+$/.test(key);
|
|
34
|
+
return isNumeric ? `text.unavailable.${key}` : key;
|
|
31
35
|
}
|
package/es/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import datetime from '@zohodesk/datetimejs';
|
|
2
2
|
import { i18NProviderUtils } from "../components/I18NProvider";
|
|
3
|
-
import { reportI18NError, I18N_ERROR_TYPES } from "./errorReporter";
|
|
3
|
+
import { reportI18NError, I18N_ERROR_TYPES, getFallbackText } from "./errorReporter";
|
|
4
4
|
export const dayi18n = {
|
|
5
5
|
'Sun': 'deskreact.calendar.daynameshort.sunday',
|
|
6
6
|
'Mon': 'deskreact.calendar.daynameshort.monday',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { unescapeUnicode } from "./index";
|
|
3
3
|
import { i18NProviderUtils } from "../components/I18NProvider";
|
|
4
|
-
import { reportI18NError, I18N_ERROR_TYPES } from "./errorReporter";
|
|
4
|
+
import { reportI18NError, I18N_ERROR_TYPES, getFallbackText } from "./errorReporter";
|
|
5
5
|
export function splitMatchedExp({
|
|
6
6
|
expression,
|
|
7
7
|
charLenToOmit,
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.I18N_ERROR_TYPES = void 0;
|
|
7
7
|
exports.clearReportedKeys = clearReportedKeys;
|
|
8
|
+
exports.getFallbackText = getFallbackText;
|
|
8
9
|
exports.reportI18NError = reportI18NError;
|
|
9
10
|
var I18N_ERROR_TYPES = exports.I18N_ERROR_TYPES = {
|
|
10
11
|
UNDEFINED_OBJECT: 'I18N_UNDEFINED_OBJECT',
|
|
@@ -36,4 +37,8 @@ function reportI18NError(type, key) {
|
|
|
36
37
|
}
|
|
37
38
|
function clearReportedKeys() {
|
|
38
39
|
reportedKeys.clear();
|
|
40
|
+
}
|
|
41
|
+
function getFallbackText(key) {
|
|
42
|
+
var isNumeric = /^\d+$/.test(key);
|
|
43
|
+
return isNumeric ? "text.unavailable.".concat(key) : key;
|
|
39
44
|
}
|
package/lib/utils/index.js
CHANGED
|
@@ -282,7 +282,7 @@ function getI18NValue(i18n) {
|
|
|
282
282
|
if (i18nStr === undefined) {
|
|
283
283
|
var isNumeric = /^\d+$/.test(finalKey);
|
|
284
284
|
(0, _errorReporter.reportI18NError)(isNumeric ? _errorReporter.I18N_ERROR_TYPES.NUMERIC_FALLBACK : _errorReporter.I18N_ERROR_TYPES.MISSING_KEY, finalKey);
|
|
285
|
-
return localizedValue || getFallbackText(finalKey);
|
|
285
|
+
return localizedValue || (0, _errorReporter.getFallbackText)(finalKey);
|
|
286
286
|
}
|
|
287
287
|
i18nStr = replaceI18NValuesWithRegex(i18nStr, values);
|
|
288
288
|
return localizedValue || unescapeUnicode(i18nStr);
|
|
@@ -209,7 +209,7 @@ function getI18NComponent(i18n) {
|
|
|
209
209
|
if (i18nStr === undefined) {
|
|
210
210
|
var isNumeric = /^\d+$/.test(key);
|
|
211
211
|
(0, _errorReporter.reportI18NError)(isNumeric ? _errorReporter.I18N_ERROR_TYPES.NUMERIC_FALLBACK : _errorReporter.I18N_ERROR_TYPES.MISSING_KEY, key);
|
|
212
|
-
return getFallbackText(key);
|
|
212
|
+
return (0, _errorReporter.getFallbackText)(key);
|
|
213
213
|
}
|
|
214
214
|
return i18nMechanismForComponents(i18nStr, key);
|
|
215
215
|
};
|
package/package.json
CHANGED
package/src/utils/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import datetime from '@zohodesk/datetimejs';
|
|
|
2
2
|
import {
|
|
3
3
|
i18NProviderUtils
|
|
4
4
|
} from '../components/I18NProvider';
|
|
5
|
-
import { reportI18NError, I18N_ERROR_TYPES } from './errorReporter';
|
|
5
|
+
import { reportI18NError, I18N_ERROR_TYPES, getFallbackText } from './errorReporter';
|
|
6
6
|
|
|
7
7
|
export const dayi18n = {
|
|
8
8
|
'Sun': 'deskreact.calendar.daynameshort.sunday',
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
i18NProviderUtils
|
|
7
7
|
} from "../components/I18NProvider";
|
|
8
|
-
import { reportI18NError, I18N_ERROR_TYPES } from './errorReporter';
|
|
8
|
+
import { reportI18NError, I18N_ERROR_TYPES, getFallbackText } from './errorReporter';
|
|
9
9
|
|
|
10
10
|
export function splitMatchedExp({
|
|
11
11
|
expression,
|