gt-react 3.0.10 → 3.0.12
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/dist/client/ClientProvider.js +6 -10
- package/dist/client/ClientProvider.js.map +1 -1
- package/dist/client/GTProvider.js +9 -15
- package/dist/client/GTProvider.js.map +1 -1
- package/dist/client/createGTProviderComponent.js +4 -10
- package/dist/client/createGTProviderComponent.js.map +1 -1
- package/dist/client/hooks/useDefaultLocale.js +4 -7
- package/dist/client/hooks/useDefaultLocale.js.map +1 -1
- package/dist/client/hooks/useGT.js +5 -8
- package/dist/client/hooks/useGT.js.map +1 -1
- package/dist/client/hooks/useLocale.js +4 -7
- package/dist/client/hooks/useLocale.js.map +1 -1
- package/dist/client/primitives/numeric/ClientNumeric.d.ts.map +1 -1
- package/dist/client/primitives/numeric/ClientNumeric.js +15 -21
- package/dist/client/primitives/numeric/ClientNumeric.js.map +1 -1
- package/dist/client/primitives/value/ClientValue.js +10 -16
- package/dist/client/primitives/value/ClientValue.js.map +1 -1
- package/dist/client/primitives/value/RenderClientVariable.d.ts.map +1 -1
- package/dist/client/primitives/value/RenderClientVariable.js +20 -50
- package/dist/client/primitives/value/RenderClientVariable.js.map +1 -1
- package/dist/client/primitives/variables/ClientCurrencyVariable.d.ts.map +1 -1
- package/dist/client/primitives/variables/ClientCurrencyVariable.js +11 -15
- package/dist/client/primitives/variables/ClientCurrencyVariable.js.map +1 -1
- package/dist/client/primitives/variables/ClientDateVariable.d.ts.map +1 -1
- package/dist/client/primitives/variables/ClientDateVariable.js +11 -16
- package/dist/client/primitives/variables/ClientDateVariable.js.map +1 -1
- package/dist/client/primitives/variables/ClientNumberVariable.d.ts.map +1 -1
- package/dist/client/primitives/variables/ClientNumberVariable.js +11 -15
- package/dist/client/primitives/variables/ClientNumberVariable.js.map +1 -1
- package/dist/client/primitives/variables/ClientVariable.js +5 -7
- package/dist/client/primitives/variables/ClientVariable.js.map +1 -1
- package/dist/client.js +10 -24
- package/dist/client.js.map +1 -1
- package/dist/config/I18NConfiguration.d.ts +1 -1
- package/dist/config/I18NConfiguration.js +12 -41
- package/dist/config/I18NConfiguration.js.map +1 -1
- package/dist/config/LocalDictionaryManager.js +3 -6
- package/dist/config/LocalDictionaryManager.js.map +1 -1
- package/dist/config/RemoteDictionaryManager.js +1 -4
- package/dist/config/RemoteDictionaryManager.js.map +1 -1
- package/dist/config/determineLocale.js +3 -6
- package/dist/config/determineLocale.js.map +1 -1
- package/dist/dictionary/createDictFunction.js +1 -4
- package/dist/dictionary/createDictFunction.js.map +1 -1
- package/dist/dictionary/createTFunction.js +3 -6
- package/dist/dictionary/createTFunction.js.map +1 -1
- package/dist/dictionary/getDictionaryEntry.js +1 -4
- package/dist/dictionary/getDictionaryEntry.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -49
- package/dist/index.js.map +1 -1
- package/dist/intl/createIntlFunction.js +1 -4
- package/dist/intl/createIntlFunction.js.map +1 -1
- package/dist/local/getDefaultFromEnv.js +1 -4
- package/dist/local/getDefaultFromEnv.js.map +1 -1
- package/dist/middleware/createNextMiddleware.js +13 -16
- package/dist/middleware/createNextMiddleware.js.map +1 -1
- package/dist/middleware.js +2 -8
- package/dist/middleware.js.map +1 -1
- package/dist/next/imports/imports.js +5 -12
- package/dist/next/imports/imports.js.map +1 -1
- package/dist/next/requestFunctions.js +8 -15
- package/dist/next/requestFunctions.js.map +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/next.js +10 -14
- package/dist/next.js.map +1 -1
- package/dist/primitives/helpers/defaultVariableNames.js +1 -3
- package/dist/primitives/helpers/defaultVariableNames.js.map +1 -1
- package/dist/primitives/helpers/getNumericBranch.d.ts +1 -1
- package/dist/primitives/helpers/getNumericBranch.d.ts.map +1 -1
- package/dist/primitives/helpers/getNumericBranch.js +4 -7
- package/dist/primitives/helpers/getNumericBranch.js.map +1 -1
- package/dist/primitives/helpers/getValueBranch.js +4 -10
- package/dist/primitives/helpers/getValueBranch.js.map +1 -1
- package/dist/primitives/helpers/isValidReactNode.js +3 -9
- package/dist/primitives/helpers/isValidReactNode.js.map +1 -1
- package/dist/primitives/numeric/Numeric.d.ts +2 -2
- package/dist/primitives/numeric/Numeric.d.ts.map +1 -1
- package/dist/primitives/numeric/Numeric.js +9 -15
- package/dist/primitives/numeric/Numeric.js.map +1 -1
- package/dist/primitives/numeric/createNumericComponent.d.ts +1 -1
- package/dist/primitives/numeric/createNumericComponent.d.ts.map +1 -1
- package/dist/primitives/numeric/createNumericComponent.js +5 -11
- package/dist/primitives/numeric/createNumericComponent.js.map +1 -1
- package/dist/primitives/private/Private.js +3 -5
- package/dist/primitives/private/Private.js.map +1 -1
- package/dist/primitives/private/createPrivateComponent.js +3 -9
- package/dist/primitives/private/createPrivateComponent.js.map +1 -1
- package/dist/primitives/value/Value.d.ts +2 -2
- package/dist/primitives/value/Value.d.ts.map +1 -1
- package/dist/primitives/value/Value.js +9 -14
- package/dist/primitives/value/Value.js.map +1 -1
- package/dist/primitives/value/createValueComponent.d.ts +1 -1
- package/dist/primitives/value/createValueComponent.d.ts.map +1 -1
- package/dist/primitives/value/createValueComponent.js +5 -11
- package/dist/primitives/value/createValueComponent.js.map +1 -1
- package/dist/primitives/value/processBranches.js +4 -10
- package/dist/primitives/value/processBranches.js.map +1 -1
- package/dist/primitives/value/renderVariable.d.ts +1 -1
- package/dist/primitives/value/renderVariable.d.ts.map +1 -1
- package/dist/primitives/value/renderVariable.js +21 -27
- package/dist/primitives/value/renderVariable.js.map +1 -1
- package/dist/primitives/variables/CurrencyVariable/CurrencyVariable.d.ts +2 -2
- package/dist/primitives/variables/CurrencyVariable/CurrencyVariable.d.ts.map +1 -1
- package/dist/primitives/variables/CurrencyVariable/CurrencyVariable.js +5 -7
- package/dist/primitives/variables/CurrencyVariable/CurrencyVariable.js.map +1 -1
- package/dist/primitives/variables/CurrencyVariable/createCurrencyVariableComponent.d.ts +1 -1
- package/dist/primitives/variables/CurrencyVariable/createCurrencyVariableComponent.d.ts.map +1 -1
- package/dist/primitives/variables/CurrencyVariable/createCurrencyVariableComponent.js +5 -11
- package/dist/primitives/variables/CurrencyVariable/createCurrencyVariableComponent.js.map +1 -1
- package/dist/primitives/variables/DateVariable/DateVariable.d.ts +2 -2
- package/dist/primitives/variables/DateVariable/DateVariable.d.ts.map +1 -1
- package/dist/primitives/variables/DateVariable/DateVariable.js +6 -8
- package/dist/primitives/variables/DateVariable/DateVariable.js.map +1 -1
- package/dist/primitives/variables/DateVariable/createDateVariableComponent.d.ts +1 -1
- package/dist/primitives/variables/DateVariable/createDateVariableComponent.d.ts.map +1 -1
- package/dist/primitives/variables/DateVariable/createDateVariableComponent.js +5 -11
- package/dist/primitives/variables/DateVariable/createDateVariableComponent.js.map +1 -1
- package/dist/primitives/variables/NumberVariable/NumberVariable.d.ts +2 -2
- package/dist/primitives/variables/NumberVariable/NumberVariable.d.ts.map +1 -1
- package/dist/primitives/variables/NumberVariable/NumberVariable.js +5 -7
- package/dist/primitives/variables/NumberVariable/NumberVariable.js.map +1 -1
- package/dist/primitives/variables/NumberVariable/createNumberVariableComponent.d.ts +1 -1
- package/dist/primitives/variables/NumberVariable/createNumberVariableComponent.d.ts.map +1 -1
- package/dist/primitives/variables/NumberVariable/createNumberVariableComponent.js +5 -11
- package/dist/primitives/variables/NumberVariable/createNumberVariableComponent.js.map +1 -1
- package/dist/primitives/variables/Variable/Variable.js +3 -5
- package/dist/primitives/variables/Variable/Variable.js.map +1 -1
- package/dist/primitives/variables/Variable/createVariableComponent.js +4 -10
- package/dist/primitives/variables/Variable/createVariableComponent.js.map +1 -1
- package/dist/server/ServerI18N.d.ts +1 -1
- package/dist/server/ServerI18N.d.ts.map +1 -1
- package/dist/server/ServerI18N.js +38 -35
- package/dist/server/ServerI18N.js.map +1 -1
- package/dist/server/createI18NComponent.js +4 -10
- package/dist/server/createI18NComponent.js.map +1 -1
- package/dist/server/helpers/addGTIdentifier.js +6 -12
- package/dist/server/helpers/addGTIdentifier.js.map +1 -1
- package/dist/server/helpers/generateHash.js +1 -4
- package/dist/server/helpers/generateHash.js.map +1 -1
- package/dist/server/helpers/writeChildrenAsObjects.js +7 -13
- package/dist/server/helpers/writeChildrenAsObjects.js.map +1 -1
- package/dist/server/renderChildren.js +32 -38
- package/dist/server/renderChildren.js.map +1 -1
- package/dist/server/resolvers/{I18NResolver.d.ts → ReplaceResolver.d.ts} +2 -2
- package/dist/server/resolvers/ReplaceResolver.d.ts.map +1 -0
- package/dist/server/resolvers/{I18NResolver.js → ReplaceResolver.js} +10 -13
- package/dist/server/resolvers/ReplaceResolver.js.map +1 -0
- package/dist/server/resolvers/SkeletonResolver.d.ts +16 -0
- package/dist/server/resolvers/SkeletonResolver.d.ts.map +1 -0
- package/dist/server/resolvers/SkeletonResolver.js +56 -0
- package/dist/server/resolvers/SkeletonResolver.js.map +1 -0
- package/dist/types/CreateGTProps.js +1 -2
- package/dist/types/GeneralTranslationInterface.js +1 -2
- package/dist/types/VariableInterface.js +1 -2
- package/package.json +2 -2
- package/tsconfig.json +1 -1
- package/dist/server/resolvers/I18NResolver.d.ts.map +0 -1
- package/dist/server/resolvers/I18NResolver.js.map +0 -1
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const useLocale_1 = __importDefault(require("../../hooks/useLocale"));
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import useLocale from '../../hooks/useLocale';
|
|
5
|
+
import useDefaultLocale from '../../hooks/useDefaultLocale';
|
|
10
6
|
/**
|
|
11
7
|
* DateVariable component formats and displays a date based on the current language settings.
|
|
12
8
|
* It converts different types of date inputs and formats them according to the locale.
|
|
@@ -19,10 +15,9 @@ const useLocale_1 = __importDefault(require("../../hooks/useLocale"));
|
|
|
19
15
|
* @returns {ReactNode} A span element containing the formatted date with specific data attributes
|
|
20
16
|
*/
|
|
21
17
|
const ClientDateVariable = ({ children, name = "date", defaultValue, options = {} } = { name: "date" }) => {
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
(0, react_1.useEffect)(() => {
|
|
18
|
+
const locales = [useLocale(), useDefaultLocale()];
|
|
19
|
+
const [formattedValue, setFormattedValue] = useState('');
|
|
20
|
+
useEffect(() => {
|
|
26
21
|
let dateValue;
|
|
27
22
|
// Determine the default value to use
|
|
28
23
|
defaultValue = (typeof children !== 'undefined' && typeof defaultValue === 'undefined') ? children : defaultValue;
|
|
@@ -43,14 +38,14 @@ const ClientDateVariable = ({ children, name = "date", defaultValue, options = {
|
|
|
43
38
|
// Return an empty string if dateValue is undefined
|
|
44
39
|
if (typeof dateValue !== 'undefined') {
|
|
45
40
|
// Format the date using Intl.DateTimeFormat or toLocaleString
|
|
46
|
-
const dateString = new Intl.DateTimeFormat(
|
|
41
|
+
const dateString = new Intl.DateTimeFormat(locales, Object.assign({ calendar: "gregory", numberingSystem: "latn" }, options)).format(dateValue) || (dateValue === null || dateValue === void 0 ? void 0 : dateValue.toLocaleString(locales, Object.assign({ calendar: "gregory", numberingSystem: "latn" }, options))) || '';
|
|
47
42
|
setFormattedValue(dateString.replace(/[\u200F\u202B\u202E]/g, ''));
|
|
48
43
|
}
|
|
49
|
-
}, [children, defaultValue, options,
|
|
44
|
+
}, [children, defaultValue, options, locales]);
|
|
50
45
|
// Render the formatted date within a span element
|
|
51
|
-
return ((
|
|
46
|
+
return (_jsx("span", { "data-gt-variable-name": name, "data-gt-variable-type": "date", "data-gt-variable-options": options, children: formattedValue }));
|
|
52
47
|
};
|
|
53
48
|
// Static property for transformation type
|
|
54
49
|
ClientDateVariable.gtTransformation = "variable-date";
|
|
55
|
-
|
|
50
|
+
export default ClientDateVariable;
|
|
56
51
|
//# sourceMappingURL=ClientDateVariable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientDateVariable.js","sourceRoot":"","sources":["../../../../src/client/primitives/variables/ClientDateVariable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClientDateVariable.js","sourceRoot":"","sources":["../../../../src/client/primitives/variables/ClientDateVariable.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAc,EAAa,SAAS,EAAW,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAC9C,OAAO,gBAAgB,MAAM,8BAA8B,CAAC;AAU5D;;;;;;;;;;GAUG;AACH,MAAM,kBAAkB,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,EAAE,KAAoB,EAAE,IAAI,EAAE,MAAM,EAAE,EAAa,EAAE;IAEhI,MAAM,OAAO,GAAG,CAAC,SAAS,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAA;IAEjD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEzD,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,SAA2B,CAAC;QAEhC,qCAAqC;QACrC,YAAY,GAAG,CAAC,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC;QAClH,IAAI,CAAC,YAAY,EAAE,CAAC;YAChB,iBAAiB,CAAC,EAAE,CAAC,CAAC;YACtB,OAAO;QACX,CAAC;QAED,0DAA0D;QAC1D,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;YACnC,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,uBAAuB;QACtE,CAAC;aAAM,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;YAC1C,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;QACvC,CAAC;aAAM,IAAI,YAAY,YAAY,IAAI,EAAE,CAAC;YACtC,SAAS,GAAG,YAAY,CAAC;QAC7B,CAAC;QAED,mDAAmD;QAEnD,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;YACnC,8DAA8D;YAC9D,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,kBAAI,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,IAAK,OAAO,EAAG,CAAC,MAAM,CAAC,SAAS,CAAC,KAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,cAAc,CAAC,OAAO,kBAAI,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,IAAK,OAAO,EAAG,CAAA,IAAI,EAAE,CAAC;YAC9O,iBAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC,CAAC;QACvE,CAAC;IAEL,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAE/C,kDAAkD;IAClD,OAAO,CACH,wCAA6B,IAAI,2BAAyB,MAAM,8BAA4B,OAAO,YAC9F,cAAc,GACZ,CACV,CAAC;AACN,CAAC,CAAC;AAEF,0CAA0C;AAC1C,kBAAkB,CAAC,gBAAgB,GAAG,eAAe,CAAC;AAEtD,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientNumberVariable.d.ts","sourceRoot":"","sources":["../../../../src/client/primitives/variables/ClientNumberVariable.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,SAAS,EAAgC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ClientNumberVariable.d.ts","sourceRoot":"","sources":["../../../../src/client/primitives/variables/ClientNumberVariable.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,SAAS,EAAgC,MAAM,OAAO,CAAC;AAKvE,KAAK,aAAa,GAAG;IACjB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAChC,CAAA;AAED;;;;;;;;;;GAUG;AACH,QAAA,MAAM,oBAAoB;iDAA0D,aAAa,GAAmB,SAAS;;CAqB5H,CAAC;AAIF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const useLocale_1 = __importDefault(require("../../hooks/useLocale"));
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import useLocale from '../../hooks/useLocale';
|
|
5
|
+
import useDefaultLocale from '../../hooks/useDefaultLocale';
|
|
10
6
|
/**
|
|
11
7
|
* NumberVariable component formats and displays a number based on the current language settings.
|
|
12
8
|
* It attempts a number conversion and defaults to returning defaultValue if provided.
|
|
@@ -19,21 +15,21 @@ const useLocale_1 = __importDefault(require("../../hooks/useLocale"));
|
|
|
19
15
|
* @returns {ReactNode} A span element containing the formatted number with specific data attributes
|
|
20
16
|
*/
|
|
21
17
|
const ClientNumberVariable = ({ children, name = "n", defaultValue, options = {} } = { name: "n" }) => {
|
|
22
|
-
const
|
|
23
|
-
const [formattedValue, setFormattedValue] =
|
|
24
|
-
|
|
18
|
+
const locales = [useLocale(), useDefaultLocale()];
|
|
19
|
+
const [formattedValue, setFormattedValue] = useState('');
|
|
20
|
+
useEffect(() => {
|
|
25
21
|
let value = (typeof children !== 'undefined' && typeof defaultValue === 'undefined') ? children : defaultValue;
|
|
26
22
|
value = (typeof value === 'string') ? parseFloat(value) : value;
|
|
27
23
|
if (typeof value === 'number') {
|
|
28
24
|
// Using Intl.NumberFormat for consistent number formatting
|
|
29
|
-
setFormattedValue(new Intl.NumberFormat(
|
|
25
|
+
setFormattedValue(new Intl.NumberFormat(locales, Object.assign({ numberingSystem: 'latn' }, options)).format(value));
|
|
30
26
|
}
|
|
31
27
|
else {
|
|
32
28
|
setFormattedValue(value);
|
|
33
29
|
}
|
|
34
|
-
}, [children, defaultValue,
|
|
35
|
-
return ((
|
|
30
|
+
}, [children, defaultValue, locales, options]);
|
|
31
|
+
return (_jsx("span", { "data-gt-variable-name": name, "data-gt-variable-type": "number", "data-gt-variable-options": JSON.stringify(options), children: formattedValue }));
|
|
36
32
|
};
|
|
37
33
|
ClientNumberVariable.gtTransformation = "variable-number";
|
|
38
|
-
|
|
34
|
+
export default ClientNumberVariable;
|
|
39
35
|
//# sourceMappingURL=ClientNumberVariable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientNumberVariable.js","sourceRoot":"","sources":["../../../../src/client/primitives/variables/ClientNumberVariable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClientNumberVariable.js","sourceRoot":"","sources":["../../../../src/client/primitives/variables/ClientNumberVariable.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAc,EAAa,SAAS,EAAW,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAC9C,OAAO,gBAAgB,MAAM,8BAA8B,CAAC;AAU5D;;;;;;;;;;GAUG;AACH,MAAM,oBAAoB,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,GAAG,EAAE,YAAY,EAAE,OAAO,GAAG,EAAE,KAAoB,EAAE,IAAI,EAAE,GAAG,EAA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{ useMemo } from 'react';
|
|
6
4
|
/**
|
|
7
5
|
* Variable component to conditionally render either children or a default value.
|
|
8
6
|
* It also attaches data attributes for variable name and type.
|
|
@@ -14,13 +12,13 @@ const react_1 = require("react");
|
|
|
14
12
|
* @returns {ReactNode} The rendered output.
|
|
15
13
|
*/
|
|
16
14
|
const ClientVariable = ({ children, name, defaultValue }) => {
|
|
17
|
-
const renderedValue =
|
|
15
|
+
const renderedValue = useMemo(() => {
|
|
18
16
|
if ((typeof children !== 'undefined' && typeof defaultValue === 'undefined'))
|
|
19
17
|
return children;
|
|
20
18
|
return defaultValue;
|
|
21
19
|
}, [children, defaultValue]);
|
|
22
|
-
return ((
|
|
20
|
+
return (_jsx("span", { "data-gt-variable-name": name, "data-gt-variable-type": "variable", children: renderedValue }));
|
|
23
21
|
};
|
|
24
22
|
ClientVariable.gtTransformation = "variable-variable";
|
|
25
|
-
|
|
23
|
+
export default ClientVariable;
|
|
26
24
|
//# sourceMappingURL=ClientVariable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientVariable.js","sourceRoot":"","sources":["../../../../src/client/primitives/variables/ClientVariable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClientVariable.js","sourceRoot":"","sources":["../../../../src/client/primitives/variables/ClientVariable.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAc,EAAE,OAAO,EAAa,MAAM,OAAO,CAAC;AASlD;;;;;;;;;GASG;AACH,MAAM,cAAc,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAiB,EAAa,EAAE;IAElF,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE;QAC/B,IAAI,CAAC,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,YAAY,KAAK,WAAW,CAAC;YAAE,OAAO,QAAQ,CAAC;QAC9F,OAAO,YAAY,CAAC;IACxB,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAA;IAE5B,OAAO,CACH,wCAA6B,IAAI,2BAAyB,UAAU,YAC/D,aAAa,GACX,CACV,CAAC;AAEN,CAAC,CAAC;AAEF,cAAc,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;AAEtD,eAAe,cAAc,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -1,25 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const useGT_1 = __importDefault(require("./client/hooks/useGT"));
|
|
12
|
-
exports.useGT = useGT_1.default;
|
|
13
|
-
const ClientValue_1 = __importDefault(require("./client/primitives/value/ClientValue"));
|
|
14
|
-
exports.Value = ClientValue_1.default;
|
|
15
|
-
const ClientNumeric_1 = __importDefault(require("./client/primitives/numeric/ClientNumeric"));
|
|
16
|
-
exports.Numeric = ClientNumeric_1.default;
|
|
17
|
-
const ClientVariable_1 = __importDefault(require("./client/primitives/variables/ClientVariable"));
|
|
18
|
-
exports.Variable = ClientVariable_1.default;
|
|
19
|
-
const ClientNumberVariable_1 = __importDefault(require("./client/primitives/variables/ClientNumberVariable"));
|
|
20
|
-
exports.NumberVariable = ClientNumberVariable_1.default;
|
|
21
|
-
const ClientDateVariable_1 = __importDefault(require("./client/primitives/variables/ClientDateVariable"));
|
|
22
|
-
exports.DateVariable = ClientDateVariable_1.default;
|
|
23
|
-
const ClientCurrencyVariable_1 = __importDefault(require("./client/primitives/variables/ClientCurrencyVariable"));
|
|
24
|
-
exports.CurrencyVariable = ClientCurrencyVariable_1.default;
|
|
1
|
+
import useDefaultLocale from "./client/hooks/useDefaultLocale";
|
|
2
|
+
import useLocale from "./client/hooks/useLocale";
|
|
3
|
+
import useGT from "./client/hooks/useGT";
|
|
4
|
+
import ClientValue from "./client/primitives/value/ClientValue";
|
|
5
|
+
import ClientNumeric from "./client/primitives/numeric/ClientNumeric";
|
|
6
|
+
import ClientVariable from "./client/primitives/variables/ClientVariable";
|
|
7
|
+
import ClientNumberVariable from "./client/primitives/variables/ClientNumberVariable";
|
|
8
|
+
import ClientDateVariable from "./client/primitives/variables/ClientDateVariable";
|
|
9
|
+
import ClientCurrencyVariable from "./client/primitives/variables/ClientCurrencyVariable";
|
|
10
|
+
export { useGT, useLocale, useDefaultLocale, ClientValue as Value, ClientNumeric as Numeric, ClientVariable as Variable, ClientNumberVariable as NumberVariable, ClientDateVariable as DateVariable, ClientCurrencyVariable as CurrencyVariable };
|
|
25
11
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAC/D,OAAO,SAAS,MAAM,0BAA0B,CAAC;AACjD,OAAO,KAAK,MAAM,sBAAsB,CAAC;AACzC,OAAO,WAAW,MAAM,uCAAuC,CAAC;AAChE,OAAO,aAAa,MAAM,2CAA2C,CAAC;AACtE,OAAO,cAAc,MAAM,8CAA8C,CAAC;AAC1E,OAAO,oBAAoB,MAAM,oDAAoD,CAAC;AACtF,OAAO,kBAAkB,MAAM,kDAAkD,CAAC;AAClF,OAAO,sBAAsB,MAAM,sDAAsD,CAAC;AAE1F,OAAO,EACH,KAAK,EACL,SAAS,EAAE,gBAAgB,EAC3B,WAAW,IAAI,KAAK,EACpB,aAAa,IAAI,OAAO,EACxB,cAAc,IAAI,QAAQ,EAC1B,oBAAoB,IAAI,cAAc,EACtC,kBAAkB,IAAI,YAAY,EAClC,sBAAsB,IAAI,gBAAgB,EAC7C,CAAA"}
|
|
@@ -70,7 +70,7 @@ export default class I18NConfiguration {
|
|
|
70
70
|
/**
|
|
71
71
|
* Get the rendering instructions
|
|
72
72
|
* @returns An object containing the current method and timeout.
|
|
73
|
-
* As of 7/
|
|
73
|
+
* As of 7/31/24: method is "skeleton", "replace", "hang", "subtle".
|
|
74
74
|
* Timeout is a number or null, representing no assigned timeout.
|
|
75
75
|
*/
|
|
76
76
|
getRenderSettings(): {
|
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -42,15 +18,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
42
18
|
}
|
|
43
19
|
return t;
|
|
44
20
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const RemoteDictionaryManager_1 = __importDefault(require("./RemoteDictionaryManager"));
|
|
51
|
-
const getDictionaryEntry_1 = __importDefault(require("../dictionary/getDictionaryEntry"));
|
|
52
|
-
const LocalDictionaryManager_1 = __importDefault(require("./LocalDictionaryManager"));
|
|
53
|
-
class I18NConfiguration {
|
|
21
|
+
import GT, { isSameLanguage } from "generaltranslation";
|
|
22
|
+
import RemoteDictionaryManager from "./RemoteDictionaryManager";
|
|
23
|
+
import getDictionaryEntry from "../dictionary/getDictionaryEntry";
|
|
24
|
+
import LocalDictionaryManager from "./LocalDictionaryManager";
|
|
25
|
+
export default class I18NConfiguration {
|
|
54
26
|
constructor(_a) {
|
|
55
27
|
var {
|
|
56
28
|
// Cloud integration
|
|
@@ -81,18 +53,18 @@ class I18NConfiguration {
|
|
|
81
53
|
this.dictionaryName = dictionaryName;
|
|
82
54
|
this.translations = translations;
|
|
83
55
|
// GT
|
|
84
|
-
this.gt = new
|
|
56
|
+
this.gt = new GT({ projectID, apiKey, defaultLanguage: defaultLocale, baseURL });
|
|
85
57
|
// Other metadata
|
|
86
58
|
this.getMetadata = getMetadata;
|
|
87
59
|
this.metadata = Object.assign({ projectID: this.projectID, defaultLanguage: this.defaultLocale, dictionaryName }, metadata);
|
|
88
60
|
// Dictionary managers
|
|
89
61
|
if (this.translations) {
|
|
90
|
-
this._localDictionaryManager = new
|
|
62
|
+
this._localDictionaryManager = new LocalDictionaryManager({
|
|
91
63
|
translations: this.translations
|
|
92
64
|
});
|
|
93
65
|
}
|
|
94
66
|
if (this.remoteSource) {
|
|
95
|
-
this._remoteDictionaryManager = new
|
|
67
|
+
this._remoteDictionaryManager = new RemoteDictionaryManager({
|
|
96
68
|
cacheURL: cacheURL,
|
|
97
69
|
projectID: this.projectID
|
|
98
70
|
});
|
|
@@ -131,7 +103,7 @@ class I18NConfiguration {
|
|
|
131
103
|
* @returns An entry from the dictionary determined by id
|
|
132
104
|
*/
|
|
133
105
|
getDictionaryEntry(id) {
|
|
134
|
-
return (
|
|
106
|
+
return getDictionaryEntry(id, this.dictionary);
|
|
135
107
|
}
|
|
136
108
|
/**
|
|
137
109
|
* Get an entry from the dictionary
|
|
@@ -143,7 +115,7 @@ class I18NConfiguration {
|
|
|
143
115
|
/**
|
|
144
116
|
* Get the rendering instructions
|
|
145
117
|
* @returns An object containing the current method and timeout.
|
|
146
|
-
* As of 7/
|
|
118
|
+
* As of 7/31/24: method is "skeleton", "replace", "hang", "subtle".
|
|
147
119
|
* Timeout is a number or null, representing no assigned timeout.
|
|
148
120
|
*/
|
|
149
121
|
getRenderSettings() {
|
|
@@ -160,9 +132,9 @@ class I18NConfiguration {
|
|
|
160
132
|
translationRequired(locale) {
|
|
161
133
|
if (!locale)
|
|
162
134
|
return false;
|
|
163
|
-
if (this.approvedLocales && !this.approvedLocales.some(approvedLocale =>
|
|
135
|
+
if (this.approvedLocales && !this.approvedLocales.some(approvedLocale => isSameLanguage(locale, approvedLocale)))
|
|
164
136
|
return false;
|
|
165
|
-
if (
|
|
137
|
+
if (isSameLanguage(locale, this.defaultLocale))
|
|
166
138
|
return false;
|
|
167
139
|
return true;
|
|
168
140
|
}
|
|
@@ -299,7 +271,6 @@ class I18NConfiguration {
|
|
|
299
271
|
}, this.batchInterval);
|
|
300
272
|
}
|
|
301
273
|
}
|
|
302
|
-
exports.default = I18NConfiguration;
|
|
303
274
|
// Resolve errors in the batch request
|
|
304
275
|
const resolveBatchError = (item) => {
|
|
305
276
|
if (item.type === "react")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"I18NConfiguration.js","sourceRoot":"","sources":["../../src/config/I18NConfiguration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"I18NConfiguration.js","sourceRoot":"","sources":["../../src/config/I18NConfiguration.ts"],"names":[],"mappings":";;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OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnE,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAChE,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAC5B,CAAC,CAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,13 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
const generaltranslation_1 = require("generaltranslation");
|
|
10
|
+
import { isSameLanguage } from "generaltranslation";
|
|
13
11
|
/**
|
|
14
12
|
* LocalDictionaryManager is responsible for managing dictionaries loaded from local file paths.
|
|
15
13
|
* @class
|
|
16
14
|
*/
|
|
17
|
-
class LocalDictionaryManager {
|
|
15
|
+
export default class LocalDictionaryManager {
|
|
18
16
|
/**
|
|
19
17
|
* Creates an instance of LocalDictionaryManager.
|
|
20
18
|
* @param {Object} params - Parameters object.
|
|
@@ -47,7 +45,7 @@ class LocalDictionaryManager {
|
|
|
47
45
|
finalLocale = this.localeCache.get(locale) || '';
|
|
48
46
|
if (!finalLocale) {
|
|
49
47
|
for (const key of Object.keys(this.translations)) {
|
|
50
|
-
if (
|
|
48
|
+
if (isSameLanguage(key, locale)) {
|
|
51
49
|
finalLocale = key;
|
|
52
50
|
break;
|
|
53
51
|
}
|
|
@@ -91,5 +89,4 @@ class LocalDictionaryManager {
|
|
|
91
89
|
});
|
|
92
90
|
}
|
|
93
91
|
}
|
|
94
|
-
exports.default = LocalDictionaryManager;
|
|
95
92
|
//# sourceMappingURL=LocalDictionaryManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalDictionaryManager.js","sourceRoot":"","sources":["../../src/config/LocalDictionaryManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LocalDictionaryManager.js","sourceRoot":"","sources":["../../src/config/LocalDictionaryManager.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAsB;IAMvC;;;;OAIG;IACH,YAAY,EAAE,YAAY,EAAwE;QAC9F,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;QAC/B,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACG,aAAa,CAAC,MAAc;;YAC9B,4CAA4C;YAC5C,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;gBACjC,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;YAClD,CAAC;YAED,qDAAqD;YACrD,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;gBACjC,OAAO,CAAA,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,KAAI,IAAI,CAAC;YACxD,CAAC;YAED,2BAA2B;YAC3B,IAAI,WAAW,GAAG,MAAM,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC;gB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AU,GAAG,MAAM,cAAc,EAAE,CAAC;gBAC1C,OAAO,UAAU,CAAC;YACtB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CAAC,uCAAuC,MAAM,GAAG,EAAE,KAAK,CAAC,CAAC;gBACvE,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;KAAA;CACJ"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,11 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
10
|
const getDictionaryReference = (locale, dictionaryName) => {
|
|
13
11
|
return `${encodeURIComponent(locale)}/${encodeURIComponent(dictionaryName)}`;
|
|
14
12
|
};
|
|
15
|
-
class RemoteDictionaryManager {
|
|
13
|
+
export default class RemoteDictionaryManager {
|
|
16
14
|
constructor({ cacheURL = "https://cache.gtx.dev", projectID }) {
|
|
17
15
|
this.cacheURL = cacheURL;
|
|
18
16
|
this.projectID = projectID;
|
|
@@ -62,5 +60,4 @@ class RemoteDictionaryManager {
|
|
|
62
60
|
this.dictionaryMap.set(reference, Object.assign(Object.assign({}, currentDictionary), { [id]: { k: key, t: translation } }));
|
|
63
61
|
}
|
|
64
62
|
}
|
|
65
|
-
exports.default = RemoteDictionaryManager;
|
|
66
63
|
//# sourceMappingURL=RemoteDictionaryManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteDictionaryManager.js","sourceRoot":"","sources":["../../src/config/RemoteDictionaryManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RemoteDictionaryManager.js","sourceRoot":"","sources":["../../src/config/RemoteDictionaryManager.ts"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,sBAAsB,GAAG,CAAC,MAAc,EAAE,cAAsB,EAAU,EAAE;IAC9E,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,IAAI,kBAAkB,CAAC,cAAc,CAAC,EAAE,CAAC;AACjF,CAAC,CAAA;AAOD,MAAM,CAAC,OAAO,OAAO,uBAAuB;IAQxC,YAAY,EACR,QAAQ,GAAG,uBAAuB,EAClC,SAAS,EACa;QACtB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;QAC/B,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;IACnC,CAAC;IAEK,gBAAgB,CAAC,SAAiB;;YACpC,IAAI,CAAC;gBACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,IAAI,SAAS,EAAE,CAAC,CAAC;gBAChF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACrC,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;oBACtB,OAAO,MAAM,CAAC;gBAClB,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;YACpD,CAAC;YACD,OAAO,IAAI,CAAC;QAChB,CAAC;KAAA;IAEK,aAAa,CAAC,MAAc,EAAE,cAAsB;;YACtD,MAAM,SAAS,GAAG,sBAAsB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;YACjE,IAAI,IAAI,CAAC,aAAa,IAAI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C;IACjG,CAAC;CACJ"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.default = determineLocale;
|
|
4
|
-
const generaltranslation_1 = require("generaltranslation");
|
|
5
|
-
function determineLocale(approvedLocales, possibleLocales, defaultLocale = '') {
|
|
1
|
+
import { isSameLanguage } from "generaltranslation";
|
|
2
|
+
export default function determineLocale(approvedLocales, possibleLocales, defaultLocale = '') {
|
|
6
3
|
if (typeof possibleLocales === 'string')
|
|
7
4
|
possibleLocales = [possibleLocales];
|
|
8
5
|
if (!possibleLocales || !Array.isArray(possibleLocales))
|
|
@@ -21,7 +18,7 @@ function determineLocale(approvedLocales, possibleLocales, defaultLocale = '') {
|
|
|
21
18
|
// check for a linguistic match
|
|
22
19
|
for (const locale of possibleLocales) {
|
|
23
20
|
for (const approvedLocale of approvedLocales) {
|
|
24
|
-
if (
|
|
21
|
+
if (isSameLanguage(locale, approvedLocale)) {
|
|
25
22
|
return approvedLocale;
|
|
26
23
|
}
|
|
27
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"determineLocale.js","sourceRoot":"","sources":["../../src/config/determineLocale.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"determineLocale.js","sourceRoot":"","sources":["../../src/config/determineLocale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,eAA0B,EAAE,eAAmC,EAAE,gBAAwB,EAAE;IAE/H,IAAI,OAAO,eAAe,KAAK,QAAQ;QAAE,eAAe,GAAG,CAAC,eAAe,CAAC,CAAC;IAC7E,IAAI,CAAC,eAAe,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC;QAAE,OAAO,aAAa,CAAC;IAE9E,wCAAwC;IACxC,IAAI,CAAC,eAAe;QAAE,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC;IAEhD,2BAA2B;IAC3B,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;QACnC,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;YAC3C,IAAI,MAAM,KAAK,cAAc,EAAE,CAAC;gBAC5B,OAAO,cAAc,CAAC;YAC1B,CAAC;QACL,CAAC;IACL,CAAC;IAED,+BAA+B;IAC/B,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;QACnC,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;YAC3C,IAAI,cAAc,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE,CAAC;gBACzC,OAAO,cAAc,CAAC;YAC1B,CAAC;QACL,CAAC;IACL,CAAC;IAED,UAAU;IACV,OAAO,aAAa,CAAC;AACzB,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = createDictFunction;
|
|
4
|
-
function createDictFunction(I18NConfig) {
|
|
1
|
+
export default function createDictFunction(I18NConfig) {
|
|
5
2
|
return (id) => {
|
|
6
3
|
return I18NConfig.getDictionaryEntry(id);
|
|
7
4
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDictFunction.js","sourceRoot":"","sources":["../../src/dictionary/createDictFunction.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createDictFunction.js","sourceRoot":"","sources":["../../src/dictionary/createDictFunction.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,UAA6B;IACpE,OAAO,CAAC,EAAU,EAAE,EAAE;QAClB,OAAO,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;IAC7C,CAAC,CAAA;AACL,CAAC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.default = createTFunction;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
function createTFunction({ I18NConfig, I18N }) {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export default function createTFunction({ I18NConfig, I18N }) {
|
|
6
3
|
return (id, options) => {
|
|
7
4
|
const entry = I18NConfig.getDictionaryEntry(id);
|
|
8
|
-
return (
|
|
5
|
+
return _jsx(I18N, Object.assign({ id: id }, options, { children: entry }));
|
|
9
6
|
};
|
|
10
7
|
}
|
|
11
8
|
//# sourceMappingURL=createTFunction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTFunction.js","sourceRoot":"","sources":["../../src/dictionary/createTFunction.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createTFunction.js","sourceRoot":"","sources":["../../src/dictionary/createTFunction.tsx"],"names":[],"mappings":";AAGA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,UAAU,EAAE,IAAI,EAAgD;IACtG,OAAO,CAAC,EAAU,EAAE,OAA6B,EAAE,EAAE;QACjD,MAAM,KAAK,GAAG,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;QAChD,OAAO,KAAC,IAAI,kBAAC,EAAE,EAAE,EAAE,IAAM,OAAO,cAAG,KAAK,IAAQ,CAAC;IACrD,CAAC,CAAA;AACL,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = getDictionaryEntry;
|
|
4
|
-
function getDictionaryEntry(id, dictionary) {
|
|
1
|
+
export default function getDictionaryEntry(id, dictionary) {
|
|
5
2
|
if (!id || typeof id !== 'string' || !dictionary || typeof dictionary !== 'object')
|
|
6
3
|
return null;
|
|
7
4
|
let current = dictionary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDictionaryEntry.js","sourceRoot":"","sources":["../../src/dictionary/getDictionaryEntry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getDictionaryEntry.js","sourceRoot":"","sources":["../../src/dictionary/getDictionaryEntry.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAU,EAAE,UAA+B;IAClF,IAAI,CAAC,EAAE,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,CAAC,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAChG,IAAI,OAAO,GAAG,UAAU,CAAC;IACzB,IAAI,cAAc,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnC,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;QAC/B,OAAO,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import Variables from './types/VariableInterface';
|
|
|
15
15
|
* @param {string[]} [params.approvedLocales] - List of approved locales. Default is an empty array.
|
|
16
16
|
* @param {string} [params.defaultLocale] - Default locale for the translation. Default is the first locale in `approvedLocales` or 'en'.
|
|
17
17
|
* @param {Function} [params.getLocale] - Function to get the current locale. Default returns the `defaultLocale`.
|
|
18
|
-
* @param {string} [params.renderMethod] - How translations are rendered for the first time. options are "replace", "hang", "subtle". Default is "
|
|
18
|
+
* @param {string} [params.renderMethod] - How translations are rendered for the first time. options are "replace", "hang", "subtle". Default is "skeleton".
|
|
19
19
|
* @param {string} [params.renderTimeout] - Timeout before rendering a new translation is called off.
|
|
20
20
|
* @param {string} [params.dictionaryName] - Name of the dictionary to use. Default is "default".
|
|
21
21
|
* @param {Object} [params.dictionary] - Dictionary object containing default language content.
|
|
@@ -25,7 +25,7 @@ import Variables from './types/VariableInterface';
|
|
|
25
25
|
* @param {Object} [...metadata] - Any additional metadata. Used for experimental variables.
|
|
26
26
|
* @returns {GeneralTranslation} An object containing internationalization and translation functions.
|
|
27
27
|
*/
|
|
28
|
-
export declare function createGT({ apiKey, projectID, cacheURL, baseURL, remoteSource, automaticTranslation, approvedLocales, defaultLocale, getLocale, renderMethod, // "hang", "subtle"
|
|
28
|
+
export declare function createGT({ apiKey, projectID, cacheURL, baseURL, remoteSource, automaticTranslation, approvedLocales, defaultLocale, getLocale, renderMethod, // "replace", "hang", "subtle"
|
|
29
29
|
renderTimeout, dictionaryName, dictionary, translations, maxConcurrentRequests, batchInterval, getMetadata, ...metadata }?: CreateI18NConfigProps): GeneralTranslation;
|
|
30
30
|
/**
|
|
31
31
|
* A lightweight configuration function which defines a set of variable components which can be used in a GT dictionary.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAOpB,OAAO,qBAAqB,MAAM,uBAAuB,CAAC;AAS1D,OAAO,kBAAkB,MAAM,qCAAqC,CAAC;AACrE,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,QAAQ,CAAC,EAErB,MAAwC,EACxC,SAA8C,EAC9C,QAAkC,EAClC,OAAgC,EAChC,YAAmB,EACnB,oBAA2B,EAE3B,eAAe,EACf,aAA4C,EAC5C,SAA0C,EAE1C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAOpB,OAAO,qBAAqB,MAAM,uBAAuB,CAAC;AAS1D,OAAO,kBAAkB,MAAM,qCAAqC,CAAC;AACrE,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,QAAQ,CAAC,EAErB,MAAwC,EACxC,SAA8C,EAC9C,QAAkC,EAClC,OAAgC,EAChC,YAAmB,EACnB,oBAA2B,EAE3B,eAAe,EACf,aAA4C,EAC5C,SAA0C,EAE1C,YAAyB,EAAE,8BAA8B;AACzD,aAAoB,EAEpB,cAA0B,EAC1B,UAAe,EACf,YAAY,EAEZ,qBAAyB,EACzB,aAAoB,EAEpB,WAAiC,EACjC,GAAG,QAAQ,EACd,GAAE,qBAgBF,GAAG,kBAAkB,CAsDrB;AAGD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,EAC5B,eAAoB,EACpB,aAA4C,EAC5C,SAA0C,GAC7C,GAAE;IACC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,MAAM,CAAC;CAI3B,GAAG,SAAS,CAeZ"}
|