gt-react 5.4.0 → 6.0.1
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/cookies/getLocaleCookie.d.ts.map +1 -1
- package/dist/cookies/getLocaleCookie.js +2 -6
- package/dist/cookies/getLocaleCookie.js.map +1 -1
- package/dist/hooks/useBrowserLocale.d.ts +3 -3
- package/dist/hooks/useBrowserLocale.d.ts.map +1 -1
- package/dist/hooks/useBrowserLocale.js +16 -19
- package/dist/hooks/useBrowserLocale.js.map +1 -1
- package/dist/hooks/useGT.d.ts +16 -2
- package/dist/hooks/useGT.d.ts.map +1 -1
- package/dist/hooks/useGT.js +76 -1
- package/dist/hooks/useGT.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/inline/T.d.ts +6 -4
- package/dist/inline/T.d.ts.map +1 -1
- package/dist/inline/T.js +10 -16
- package/dist/inline/T.js.map +1 -1
- package/dist/internal/addGTIdentifier.d.ts.map +1 -1
- package/dist/internal/addGTIdentifier.js +5 -3
- package/dist/internal/addGTIdentifier.js.map +1 -1
- package/dist/internal/hashReactChildrenObjects.js +2 -2
- package/dist/internal/hashReactChildrenObjects.js.map +1 -1
- package/dist/internal/writeChildrenAsObjects.d.ts.map +1 -1
- package/dist/internal/writeChildrenAsObjects.js +8 -3
- package/dist/internal/writeChildrenAsObjects.js.map +1 -1
- package/dist/internal.d.ts +2 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +4 -4
- package/dist/internal.js.map +1 -1
- package/dist/primitives/primitives.d.ts +0 -5
- package/dist/primitives/primitives.d.ts.map +1 -1
- package/dist/primitives/primitives.js +0 -8
- package/dist/primitives/primitives.js.map +1 -1
- package/dist/provider/GTContext.d.ts.map +1 -1
- package/dist/provider/GTContext.js +1 -0
- package/dist/provider/GTContext.js.map +1 -1
- package/dist/provider/GTProvider.d.ts +1 -1
- package/dist/provider/GTProvider.d.ts.map +1 -1
- package/dist/provider/GTProvider.js +14 -12
- package/dist/provider/GTProvider.js.map +1 -1
- package/dist/provider/helpers/extractEntryMetadata.d.ts +1 -1
- package/dist/provider/helpers/extractEntryMetadata.d.ts.map +1 -1
- package/dist/provider/helpers/getDictionaryEntry.d.ts +1 -1
- package/dist/provider/helpers/getDictionaryEntry.d.ts.map +1 -1
- package/dist/provider/helpers/getGTProp.d.ts +1 -1
- package/dist/provider/helpers/getGTProp.d.ts.map +1 -1
- package/dist/provider/rendering/renderDefaultChildren.d.ts.map +1 -1
- package/dist/provider/rendering/renderDefaultChildren.js +18 -9
- package/dist/provider/rendering/renderDefaultChildren.js.map +1 -1
- package/dist/provider/rendering/renderTranslatedChildren.d.ts +1 -1
- package/dist/provider/rendering/renderTranslatedChildren.d.ts.map +1 -1
- package/dist/provider/rendering/renderTranslatedChildren.js +38 -12
- package/dist/provider/rendering/renderTranslatedChildren.js.map +1 -1
- package/dist/types/types.d.ts +53 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +3 -0
- package/dist/types/types.js.map +1 -0
- package/dist/variables/Currency.d.ts +1 -1
- package/dist/variables/Currency.d.ts.map +1 -1
- package/dist/variables/Currency.js +2 -2
- package/dist/variables/Currency.js.map +1 -1
- package/dist/variables/DateTime.d.ts +1 -1
- package/dist/variables/DateTime.d.ts.map +1 -1
- package/dist/variables/DateTime.js +2 -2
- package/dist/variables/DateTime.js.map +1 -1
- package/dist/variables/Num.d.ts +1 -1
- package/dist/variables/Num.d.ts.map +1 -1
- package/dist/variables/Num.js +2 -2
- package/dist/variables/Num.js.map +1 -1
- package/dist/variables/_getVariableProps.js +2 -2
- package/dist/variables/_getVariableProps.js.map +1 -1
- package/dist/variables/getVariableName.d.ts +3 -0
- package/dist/variables/getVariableName.d.ts.map +1 -0
- package/dist/variables/getVariableName.js +24 -0
- package/dist/variables/getVariableName.js.map +1 -0
- package/package.json +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLocaleCookie.d.ts","sourceRoot":"","sources":["../../src/cookies/getLocaleCookie.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getLocaleCookie.d.ts","sourceRoot":"","sources":["../../src/cookies/getLocaleCookie.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,IAAI,GAAE,MAAyB,GAAG,MAAM,GAAG,IAAI,CAkBtF"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.default = getLocaleCookie;
|
|
7
|
-
var
|
|
8
|
-
var localeCookieName = primitives_1.default.localeCookieName;
|
|
4
|
+
var internal_1 = require("generaltranslation/internal");
|
|
9
5
|
/**
|
|
10
6
|
* Function to get the value of a specific cookie by its name.
|
|
11
7
|
*
|
|
@@ -13,7 +9,7 @@ var localeCookieName = primitives_1.default.localeCookieName;
|
|
|
13
9
|
* @returns {string|null} - The value of the cookie, or null if not found.
|
|
14
10
|
*/
|
|
15
11
|
function getLocaleCookie(name) {
|
|
16
|
-
if (name === void 0) { name = localeCookieName; }
|
|
12
|
+
if (name === void 0) { name = internal_1.localeCookieName; }
|
|
17
13
|
var cookieString = document.cookie;
|
|
18
14
|
// Split the cookies string by "; " to get an array of "key=value" strings
|
|
19
15
|
var cookiesArray = cookieString.split("; ");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLocaleCookie.js","sourceRoot":"","sources":["../../src/cookies/getLocaleCookie.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getLocaleCookie.js","sourceRoot":"","sources":["../../src/cookies/getLocaleCookie.ts"],"names":[],"mappings":";;AAQA,kCAkBC;AA1BD,wDAA8D;AAE9D;;;;;GAKG;AACH,SAAwB,eAAe,CAAC,IAA+B;IAA/B,qBAAA,EAAA,OAAe,2BAAgB;IACnE,IAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC;IAErC,0EAA0E;IAC1E,IAAM,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE9C,oEAAoE;IACpE,KAAmB,UAAY,EAAZ,6BAAY,EAAZ,0BAAY,EAAZ,IAAY,EAAE,CAAC;QAA7B,IAAI,MAAM,qBAAA;QACP,IAAA,KAA4B,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAA5C,UAAU,QAAA,EAAE,WAAW,QAAqB,CAAC;QAEpD,uDAAuD;QACvD,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;YACxB,OAAO,kBAAkB,CAAC,WAAW,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,0CAA0C;IAC1C,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hook to retrieve the browser's default
|
|
2
|
+
* Hook to retrieve the browser's default locale, with support for a fallback and locale stored in a cookie.
|
|
3
3
|
*
|
|
4
4
|
* @param {string} [defaultLocale=libraryDefaultLocale] - The default locale to use if the browser locale is not available.
|
|
5
5
|
* @param {string} [cookieName=localeCookieName] - The name of the cookie to check for a stored locale. If omitted, no cookie is used.
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* console.log(browserLocale); // Outputs locale from cookie 'localeCookie' if available, or browser's locale otherwise
|
|
15
15
|
*
|
|
16
16
|
* @description
|
|
17
|
-
* This hook attempts to determine the browser's preferred
|
|
17
|
+
* This hook attempts to determine the browser's preferred locale. If a locale is stored in a cookie (specified by `cookieName`),
|
|
18
18
|
* it will take precedence. If not, it falls back to the `navigator.language` or `navigator.userLanguage`. If none of these are available,
|
|
19
19
|
* the provided `defaultLocale` is used.
|
|
20
20
|
*/
|
|
21
|
-
export default function useBrowserLocale(defaultLocale?: string,
|
|
21
|
+
export default function useBrowserLocale(defaultLocale?: string, locales?: string[]): string;
|
|
22
22
|
//# sourceMappingURL=useBrowserLocale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBrowserLocale.d.ts","sourceRoot":"","sources":["../../src/hooks/useBrowserLocale.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useBrowserLocale.d.ts","sourceRoot":"","sources":["../../src/hooks/useBrowserLocale.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACpC,aAAa,GAAE,MAA6B,EAC5C,OAAO,CAAC,EAAE,MAAM,EAAE,GACnB,MAAM,CAgBR"}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
2
|
+
'use client';
|
|
5
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
4
|
exports.default = useBrowserLocale;
|
|
7
5
|
var react_1 = require("react");
|
|
8
|
-
var getLocaleCookie_1 = __importDefault(require("../cookies/getLocaleCookie"));
|
|
9
6
|
var generaltranslation_1 = require("generaltranslation");
|
|
10
|
-
var
|
|
11
|
-
var libraryDefaultLocale = primitives_1.default.libraryDefaultLocale, localeCookieName = primitives_1.default.localeCookieName;
|
|
7
|
+
var internal_1 = require("generaltranslation/internal");
|
|
12
8
|
/**
|
|
13
|
-
* Hook to retrieve the browser's default
|
|
9
|
+
* Hook to retrieve the browser's default locale, with support for a fallback and locale stored in a cookie.
|
|
14
10
|
*
|
|
15
11
|
* @param {string} [defaultLocale=libraryDefaultLocale] - The default locale to use if the browser locale is not available.
|
|
16
12
|
* @param {string} [cookieName=localeCookieName] - The name of the cookie to check for a stored locale. If omitted, no cookie is used.
|
|
@@ -25,23 +21,24 @@ var libraryDefaultLocale = primitives_1.default.libraryDefaultLocale, localeCook
|
|
|
25
21
|
* console.log(browserLocale); // Outputs locale from cookie 'localeCookie' if available, or browser's locale otherwise
|
|
26
22
|
*
|
|
27
23
|
* @description
|
|
28
|
-
* This hook attempts to determine the browser's preferred
|
|
24
|
+
* This hook attempts to determine the browser's preferred locale. If a locale is stored in a cookie (specified by `cookieName`),
|
|
29
25
|
* it will take precedence. If not, it falls back to the `navigator.language` or `navigator.userLanguage`. If none of these are available,
|
|
30
26
|
* the provided `defaultLocale` is used.
|
|
31
27
|
*/
|
|
32
|
-
function useBrowserLocale(defaultLocale,
|
|
33
|
-
if (defaultLocale === void 0) { defaultLocale = libraryDefaultLocale; }
|
|
34
|
-
if (cookieName === void 0) { cookieName = localeCookieName; }
|
|
28
|
+
function useBrowserLocale(defaultLocale, locales) {
|
|
29
|
+
if (defaultLocale === void 0) { defaultLocale = internal_1.libraryDefaultLocale; }
|
|
35
30
|
var _a = (0, react_1.useState)(''), locale = _a[0], setLocale = _a[1];
|
|
36
31
|
(0, react_1.useEffect)(function () {
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
||
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
32
|
+
var browserLocales = structuredClone(navigator.languages ||
|
|
33
|
+
[navigator.language] ||
|
|
34
|
+
[navigator === null || navigator === void 0 ? void 0 : navigator.userLanguage] ||
|
|
35
|
+
[defaultLocale]);
|
|
36
|
+
if (locales) {
|
|
37
|
+
setLocale((0, generaltranslation_1.determineLocale)(browserLocales, locales) || defaultLocale);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
setLocale(browserLocales[0] || defaultLocale);
|
|
41
|
+
}
|
|
45
42
|
}, [defaultLocale, locales]);
|
|
46
43
|
return locale;
|
|
47
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBrowserLocale.js","sourceRoot":"","sources":["../../src/hooks/useBrowserLocale.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useBrowserLocale.js","sourceRoot":"","sources":["../../src/hooks/useBrowserLocale.ts"],"names":[],"mappings":";AAAA,YAAY,CAAA;;AA0BZ,mCAmBC;AA3CD,+BAA4C;AAC5C,yDAAqD;AACrD,wDAAmE;AAEnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAwB,gBAAgB,CACpC,aAA4C,EAC5C,OAAkB;IADlB,8BAAA,EAAA,gBAAwB,+BAAoB;IAGtC,IAAA,KAAsB,IAAA,gBAAQ,EAAS,EAAE,CAAC,EAAzC,MAAM,QAAA,EAAE,SAAS,QAAwB,CAAC;IACjD,IAAA,iBAAS,EAAC;QACN,IAAM,cAAc,GAAG,eAAe,CAClC,SAAS,CAAC,SAAS;YACnB,CAAC,SAAS,CAAC,QAAQ,CAAC;YACpB,CAAE,SAAiB,aAAjB,SAAS,uBAAT,SAAS,CAAU,YAAY,CAAC;YAClC,CAAC,aAAa,CAAC,CACN,CAAC;QACd,IAAI,OAAO,EAAE,CAAC;YACV,SAAS,CAAC,IAAA,oCAAe,EAAC,cAAc,EAAE,OAAO,CAAC,IAAI,aAAa,CAAC,CAAC;QACzE,CAAC;aAAM,CAAC;YACJ,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC;QAClD,CAAC;IACL,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
package/dist/hooks/useGT.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* Gets the translation function `t` provided by `<GTProvider>`.
|
|
4
3
|
*
|
|
@@ -12,5 +11,20 @@ import { ReactNode } from "react";
|
|
|
12
11
|
* const t = useGT();
|
|
13
12
|
* console.log(t('hello')); // Translates item 'hello'
|
|
14
13
|
*/
|
|
15
|
-
export
|
|
14
|
+
export declare function useGT(id?: string): (id: string, options?: Record<string, any>, f?: Function) => JSX.Element | string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Flagship `gt()` hook which gets the translation function `t()` provided by `<GTProvider>`.
|
|
17
|
+
* `t()` returns only JSX elements. For returning strings as well, see `useGT()`.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} [id] - Optional prefix to prepend to the translation keys.
|
|
20
|
+
* @returns {Function} A translation function that accepts a key string and returns the translated value.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const t = gt('user');
|
|
24
|
+
* console.log(t('name')); // Translates item 'user.name'
|
|
25
|
+
*
|
|
26
|
+
* const t = gt();
|
|
27
|
+
* console.log(t('hello')); // Translates item 'hello'
|
|
28
|
+
*/
|
|
29
|
+
export declare function gt(id?: string): (id: string, options?: Record<string, any>, f?: Function) => JSX.Element;
|
|
16
30
|
//# sourceMappingURL=useGT.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGT.d.ts","sourceRoot":"","sources":["../../src/hooks/useGT.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useGT.d.ts","sourceRoot":"","sources":["../../src/hooks/useGT.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CACjB,EAAE,GAAE,MAAW,GAChB,CACC,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,CAAC,CAAC,EAAE,QAAQ,KACX,GAAG,CAAC,OAAO,GAAG,MAAM,GAAG,SAAS,CAoCpC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,EAAE,CACd,EAAE,GAAE,MAAW,GAChB,CACC,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,CAAC,CAAC,EAAE,QAAQ,KACX,GAAG,CAAC,OAAO,CAsCf"}
|
package/dist/hooks/useGT.js
CHANGED
|
@@ -1,9 +1,35 @@
|
|
|
1
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
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
29
|
+
exports.useGT = useGT;
|
|
30
|
+
exports.gt = gt;
|
|
31
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
32
|
+
var react_1 = __importStar(require("react"));
|
|
7
33
|
var GTContext_1 = __importDefault(require("../provider/GTContext"));
|
|
8
34
|
/**
|
|
9
35
|
* Gets the translation function `t` provided by `<GTProvider>`.
|
|
@@ -50,4 +76,53 @@ function useGT(id) {
|
|
|
50
76
|
;
|
|
51
77
|
return t;
|
|
52
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Flagship `gt()` hook which gets the translation function `t()` provided by `<GTProvider>`.
|
|
81
|
+
* `t()` returns only JSX elements. For returning strings as well, see `useGT()`.
|
|
82
|
+
*
|
|
83
|
+
* @param {string} [id] - Optional prefix to prepend to the translation keys.
|
|
84
|
+
* @returns {Function} A translation function that accepts a key string and returns the translated value.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* const t = gt('user');
|
|
88
|
+
* console.log(t('name')); // Translates item 'user.name'
|
|
89
|
+
*
|
|
90
|
+
* const t = gt();
|
|
91
|
+
* console.log(t('hello')); // Translates item 'hello'
|
|
92
|
+
*/
|
|
93
|
+
function gt(id) {
|
|
94
|
+
if (id === void 0) { id = ''; }
|
|
95
|
+
// Create a prefix for translation keys if an id is provided
|
|
96
|
+
var getID = function (suffix) {
|
|
97
|
+
return id ? "".concat(id, ".").concat(suffix) : suffix;
|
|
98
|
+
};
|
|
99
|
+
// Get the translation context
|
|
100
|
+
var translate = (0, GTContext_1.default)("gt('".concat(id, "'): No context provided. You're trying to get the t() function on the client, which can only be done inside a <GTProvider>.")).translate;
|
|
101
|
+
/**
|
|
102
|
+
* Translates a dictionary item based on its `id` and options.
|
|
103
|
+
* Always returns a JSX.Element. Returns a fragment if there is no translation.
|
|
104
|
+
*
|
|
105
|
+
* @param {string} [id=''] - The ID of the item in the dictionary to translate.
|
|
106
|
+
* @param {Record<string, any>} [options={}] - Variables or parameters (e.g., `n`) passed into the translation for dynamic content.
|
|
107
|
+
* @param {Function} [f] - `f` is executed with `options` as parameters, and its result is translated based on the dictionary value of `id`. You likely don't need this parameter unless you are using `gt-next`.
|
|
108
|
+
*
|
|
109
|
+
* @returns {JSX.Element}
|
|
110
|
+
*/
|
|
111
|
+
function t(id, options, f) {
|
|
112
|
+
if (id === void 0) { id = ''; }
|
|
113
|
+
if (options === void 0) { options = {}; }
|
|
114
|
+
var prefixedID = getID(id);
|
|
115
|
+
if (translate) {
|
|
116
|
+
var translation = translate(prefixedID, options, f);
|
|
117
|
+
if (!translation)
|
|
118
|
+
console.warn("t('".concat(id, "') finding no translation for dictionary item ").concat(prefixedID, " !"));
|
|
119
|
+
if (!(0, react_1.isValidElement)(translation))
|
|
120
|
+
return (0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: translation });
|
|
121
|
+
return translation;
|
|
122
|
+
}
|
|
123
|
+
return (0, jsx_runtime_1.jsx)(react_1.default.Fragment, {});
|
|
124
|
+
}
|
|
125
|
+
;
|
|
126
|
+
return t;
|
|
127
|
+
}
|
|
53
128
|
//# sourceMappingURL=useGT.js.map
|
package/dist/hooks/useGT.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGT.js","sourceRoot":"","sources":["../../src/hooks/useGT.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useGT.js","sourceRoot":"","sources":["../../src/hooks/useGT.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,sBA0CC;AAgBD,gBA4CC;;AAtHD,6CAA8C;AAC9C,oEAAiD;AAEjD;;;;;;;;;;;;GAYG;AACH,SAAgB,KAAK,CACjB,EAAe;IAAf,mBAAA,EAAA,OAAe;IAOf,4DAA4D;IAC5D,IAAM,KAAK,GAAG,UAAC,MAAc;QACzB,OAAO,EAAE,CAAC,CAAC,CAAC,UAAG,EAAE,cAAI,MAAM,CAAE,CAAC,CAAC,CAAC,MAAM,CAAC;IAC3C,CAAC,CAAA;IAED,8BAA8B;IACtB,IAAA,SAAS,GAAK,IAAA,mBAAY,EAC9B,iBAAU,EAAE,gIAA6H,CAC5I,UAFgB,CAEf;IAEF;;;;;;;;MAQE;IACF,SAAS,CAAC,CACN,EAAe,EACf,OAAiC,EACjC,CAAY;QAFZ,mBAAA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AC,QAAQ,cAAE,WAAW,GAAkB,CAAA;YACvF,OAAO,WAAW,CAAC;QACvB,CAAC;QACD,OAAO,uBAAC,eAAK,CAAC,QAAQ,KAAG,CAAC;IAC9B,CAAC;IAAA,CAAC;IAEF,OAAO,CAAC,CAAC;AACb,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import T from "./inline/T";
|
|
2
|
-
import useGT from "./hooks/useGT";
|
|
2
|
+
import { useGT, gt } from "./hooks/useGT";
|
|
3
3
|
import useDefaultLocale from "./hooks/useDefaultLocale";
|
|
4
4
|
import useLocale from "./hooks/useLocale";
|
|
5
5
|
import GTProvider from "./provider/GTProvider";
|
|
@@ -9,5 +9,5 @@ import Currency from "./variables/Currency";
|
|
|
9
9
|
import DateTime from "./variables/DateTime";
|
|
10
10
|
import Plural from "./branches/plurals/Plural";
|
|
11
11
|
import Branch from "./branches/Branch";
|
|
12
|
-
export { Var, Num, Currency, DateTime, T, GTProvider, Plural, Branch, useGT, useDefaultLocale, useLocale };
|
|
12
|
+
export { Var, Num, Currency, DateTime, T, GTProvider, Plural, Branch, useGT, gt, useDefaultLocale, useLocale };
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
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,CAAC,MAAM,YAAY,CAAC;AAC3B,OAAO,KAAK,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,YAAY,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AACxD,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,GAAG,MAAM,iBAAiB,CAAC;AAClC,OAAO,GAAG,MAAM,iBAAiB,CAAC;AAClC,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAC/C,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACH,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAC5B,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAC7B,KAAK,EAAE,EAAE,EAAE,gBAAgB,EAAE,SAAS,EACzC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -3,11 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useLocale = exports.useDefaultLocale = exports.useGT = exports.Branch = exports.Plural = exports.GTProvider = exports.T = exports.DateTime = exports.Currency = exports.Num = exports.Var = void 0;
|
|
6
|
+
exports.useLocale = exports.useDefaultLocale = exports.gt = exports.useGT = exports.Branch = exports.Plural = exports.GTProvider = exports.T = exports.DateTime = exports.Currency = exports.Num = exports.Var = void 0;
|
|
7
7
|
var T_1 = __importDefault(require("./inline/T"));
|
|
8
8
|
exports.T = T_1.default;
|
|
9
|
-
var useGT_1 =
|
|
10
|
-
exports
|
|
9
|
+
var useGT_1 = require("./hooks/useGT");
|
|
10
|
+
Object.defineProperty(exports, "useGT", { enumerable: true, get: function () { return useGT_1.useGT; } });
|
|
11
|
+
Object.defineProperty(exports, "gt", { enumerable: true, get: function () { return useGT_1.gt; } });
|
|
11
12
|
var useDefaultLocale_1 = __importDefault(require("./hooks/useDefaultLocale"));
|
|
12
13
|
exports.useDefaultLocale = useDefaultLocale_1.default;
|
|
13
14
|
var useLocale_1 = __importDefault(require("./hooks/useLocale"));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,iDAA2B;AAcvB,YAdG,WAAC,CAcH;AAbL,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,iDAA2B;AAcvB,YAdG,WAAC,CAcH;AAbL,uCAA0C;AActC,sFAdK,aAAK,OAcL;AAAE,mFAdK,UAAE,OAcL;AAbb,8EAAwD;AAazC,2BAbR,0BAAgB,CAaQ;AAZ/B,gEAA0C;AAYT,oBAZ1B,mBAAS,CAY0B;AAX1C,qEAA+C;AAUxC,qBAVA,oBAAU,CAUA;AATjB,wDAAkC;AAQ9B,cARG,aAAG,CAQH;AAPP,wDAAkC;AAOzB,cAPF,aAAG,CAOE;AANZ,kEAA4C;AAM9B,mBANP,kBAAQ,CAMO;AALtB,kEAA4C;AAKpB,mBALjB,kBAAQ,CAKiB;AAJhC,qEAA+C;AAK5B,iBALZ,gBAAM,CAKY;AAJzB,6DAAuC;AAIZ,iBAJpB,gBAAM,CAIoB"}
|
package/dist/inline/T.d.ts
CHANGED
|
@@ -13,16 +13,18 @@
|
|
|
13
13
|
* @example
|
|
14
14
|
* ```jsx
|
|
15
15
|
* // Basic usage:
|
|
16
|
-
* <T id="welcome_message"
|
|
17
|
-
* Hello, <Var name="name"
|
|
16
|
+
* <T id="welcome_message">
|
|
17
|
+
* Hello, <Var name="name">{name}</Var>!
|
|
18
18
|
* </T>
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
21
21
|
* @example
|
|
22
22
|
* ```jsx
|
|
23
23
|
* // Using plural translations:
|
|
24
|
-
* <T id="item_count"
|
|
25
|
-
* You have <Num/>
|
|
24
|
+
* <T id="item_count">
|
|
25
|
+
* <Plural n={n} singular={<>You have <Num value={n}/> item</>}>
|
|
26
|
+
* You have <Num value={n}/> items
|
|
27
|
+
* </Plural>
|
|
26
28
|
* </T>
|
|
27
29
|
* ```
|
|
28
30
|
*
|
package/dist/inline/T.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"T.d.ts","sourceRoot":"","sources":["../../src/inline/T.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"T.d.ts","sourceRoot":"","sources":["../../src/inline/T.tsx"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC,EACtB,QAAQ,EAAE,EAAE,EAAE,GAAG,KAAK,EACzB,EAAE;IACC,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACrB,GAAG,GAAG,CAAC,OAAO,GAAG,SAAS,CAmE1B"}
|
package/dist/inline/T.js
CHANGED
|
@@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.default = T;
|
|
18
18
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
var react_1 = require("react");
|
|
20
|
-
var generaltranslation_1 = require("generaltranslation");
|
|
21
20
|
var useDefaultLocale_1 = __importDefault(require("../hooks/useDefaultLocale"));
|
|
22
21
|
var useLocale_1 = __importDefault(require("../hooks/useLocale"));
|
|
23
22
|
var renderDefaultChildren_1 = __importDefault(require("../provider/rendering/renderDefaultChildren"));
|
|
@@ -40,16 +39,18 @@ var react_2 = require("react");
|
|
|
40
39
|
* @example
|
|
41
40
|
* ```jsx
|
|
42
41
|
* // Basic usage:
|
|
43
|
-
* <T id="welcome_message"
|
|
44
|
-
* Hello, <Var name="name"
|
|
42
|
+
* <T id="welcome_message">
|
|
43
|
+
* Hello, <Var name="name">{name}</Var>!
|
|
45
44
|
* </T>
|
|
46
45
|
* ```
|
|
47
46
|
*
|
|
48
47
|
* @example
|
|
49
48
|
* ```jsx
|
|
50
49
|
* // Using plural translations:
|
|
51
|
-
* <T id="item_count"
|
|
52
|
-
* You have <Num/>
|
|
50
|
+
* <T id="item_count">
|
|
51
|
+
* <Plural n={n} singular={<>You have <Num value={n}/> item</>}>
|
|
52
|
+
* You have <Num value={n}/> items
|
|
53
|
+
* </Plural>
|
|
53
54
|
* </T>
|
|
54
55
|
* ```
|
|
55
56
|
*
|
|
@@ -62,17 +63,10 @@ function T(_a) {
|
|
|
62
63
|
throw new Error("Client-side <T> with no provided 'id' prop. Children: ".concat(children));
|
|
63
64
|
}
|
|
64
65
|
var variables = props.variables, variablesOptions = props.variablesOptions;
|
|
65
|
-
var
|
|
66
|
+
var _b = (0, GTContext_1.default)("<T id=\"".concat(id, "\"> used on the client-side outside of <GTProvider>")), translations = _b.translations, translationRequired = _b.translationRequired;
|
|
66
67
|
var locale = (0, useLocale_1.default)();
|
|
67
68
|
var defaultLocale = (0, useDefaultLocale_1.default)();
|
|
68
69
|
var taggedChildren = (0, react_2.useMemo)(function () { return (0, internal_1.addGTIdentifier)(children); }, [children]);
|
|
69
|
-
var translationRequired = (function () {
|
|
70
|
-
if (!locale)
|
|
71
|
-
return false;
|
|
72
|
-
if ((0, generaltranslation_1.isSameLanguage)(locale, defaultLocale))
|
|
73
|
-
return false;
|
|
74
|
-
return true;
|
|
75
|
-
})();
|
|
76
70
|
if (!translationRequired) {
|
|
77
71
|
return (0, renderDefaultChildren_1.default)({
|
|
78
72
|
children: taggedChildren,
|
|
@@ -83,11 +77,11 @@ function T(_a) {
|
|
|
83
77
|
}
|
|
84
78
|
// Do translation
|
|
85
79
|
var context = props.context;
|
|
86
|
-
var
|
|
80
|
+
var _c = (0, react_2.useMemo)(function () {
|
|
87
81
|
var childrenAsObjects = (0, internal_1.writeChildrenAsObjects)(taggedChildren);
|
|
88
82
|
var key = (0, internal_1.hashReactChildrenObjects)(context ? [childrenAsObjects, context] : childrenAsObjects);
|
|
89
83
|
return [childrenAsObjects, key];
|
|
90
|
-
}, [context, taggedChildren]), childrenAsObjects =
|
|
84
|
+
}, [context, taggedChildren]), childrenAsObjects = _c[0], key = _c[1];
|
|
91
85
|
var translation = translations[id];
|
|
92
86
|
if (translation === null || translation === void 0 ? void 0 : translation.promise) {
|
|
93
87
|
throw new Error("<T id=\"".concat(id, "\">, \"").concat(id, "\" is also used as a key in the dictionary. Don't give <T> components the same ID as dictionary entries."));
|
|
@@ -95,7 +89,7 @@ function T(_a) {
|
|
|
95
89
|
if (!translation || !translation.t || translation.k !== key) {
|
|
96
90
|
if ((process === null || process === void 0 ? void 0 : process.env.NODE_ENV) === 'development' || (process === null || process === void 0 ? void 0 : process.env.NODE_ENV) === 'test') {
|
|
97
91
|
throw new Error("<T id=\"".concat(id, "\"> is used in a client component without a valid corresponding translation. This can cause Next.js hydration errors.")
|
|
98
|
-
+ "\n\nYour current environment: \"".concat(process === null || process === void 0 ? void 0 : process.env.NODE_ENV, "\". In production, this error will display as a warning only, and content will be rendered in your default
|
|
92
|
+
+ "\n\nYour current environment: \"".concat(process === null || process === void 0 ? void 0 : process.env.NODE_ENV, "\". In production, this error will display as a warning only, and content will be rendered in your default locale.")
|
|
99
93
|
+ "\n\nTo fix this error, consider using a getGT() dictionary pattern or pushing translations from the command line in advance.");
|
|
100
94
|
}
|
|
101
95
|
console.warn("<T id=\"".concat(id, "\"> is used in a client component without a valid corresponding translation."));
|
package/dist/inline/T.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"T.js","sourceRoot":"","sources":["../../src/inline/T.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"T.js","sourceRoot":"","sources":["../../src/inline/T.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAwCA,oBA0EC;;AAlHD,+BAAwC;AACxC,+EAAyD;AACzD,iEAA2C;AAC3C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,kCAAwB,EAAC;QAC5B,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QAC7C,SAAS,WAAA;QAAE,gBAAgB,kBAAA;QAAE,OAAO,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC;KAChE,CAAgB,CAAC;AACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addGTIdentifier.d.ts","sourceRoot":"","sources":["../../src/internal/addGTIdentifier.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAgC,MAAM,OAAO,CAAA;AAGtE,KAAK,KAAK,GAAG,SAAS,CAAC;AACvB,KAAK,QAAQ,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;AAOhC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,aAAa,GAAE,MAAU,GAAG,GAAG,
|
|
1
|
+
{"version":3,"file":"addGTIdentifier.d.ts","sourceRoot":"","sources":["../../src/internal/addGTIdentifier.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAgC,MAAM,OAAO,CAAA;AAGtE,KAAK,KAAK,GAAG,SAAS,CAAC;AACvB,KAAK,QAAQ,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;AAOhC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,aAAa,GAAE,MAAU,GAAG,GAAG,CAkFxH"}
|
|
@@ -47,7 +47,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
48
|
exports.default = addGTIdentifier;
|
|
49
49
|
var react_1 = __importStar(require("react"));
|
|
50
|
-
var
|
|
50
|
+
var internal_1 = require("generaltranslation/internal");
|
|
51
51
|
function addGTIdentifier(children, outerID, startingIndex) {
|
|
52
52
|
if (startingIndex === void 0) { startingIndex = 0; }
|
|
53
53
|
// Object to keep track of the current index for GT IDs
|
|
@@ -66,7 +66,7 @@ function addGTIdentifier(children, outerID, startingIndex) {
|
|
|
66
66
|
transformation = typeof type === 'function' ? (type.gtTransformation || '') : '';
|
|
67
67
|
}
|
|
68
68
|
catch (error) {
|
|
69
|
-
console.error(error)
|
|
69
|
+
// console.error(error)
|
|
70
70
|
transformation = '';
|
|
71
71
|
}
|
|
72
72
|
if (transformation) {
|
|
@@ -77,7 +77,7 @@ function addGTIdentifier(children, outerID, startingIndex) {
|
|
|
77
77
|
if (transformationParts[0] === "plural") {
|
|
78
78
|
var pluralBranches = Object.entries(props).reduce(function (acc, _a) {
|
|
79
79
|
var branchName = _a[0], branch = _a[1];
|
|
80
|
-
if ((0,
|
|
80
|
+
if ((0, internal_1.isAcceptedPluralForm)(branchName)) {
|
|
81
81
|
acc[branchName] = addGTIdentifier(branch, branchName, index);
|
|
82
82
|
}
|
|
83
83
|
return acc;
|
|
@@ -102,6 +102,8 @@ function addGTIdentifier(children, outerID, startingIndex) {
|
|
|
102
102
|
function handleSingleChild(child) {
|
|
103
103
|
if ((0, react_1.isValidElement)(child)) {
|
|
104
104
|
var props = child.props;
|
|
105
|
+
if (props['data-_gt'])
|
|
106
|
+
throw new Error("General Translation: data-_gt prop already in use on child ".concat(child, ". This usually occurs when you nest <T> components within the same file. Remove one of the <T> components to continue."));
|
|
105
107
|
// Create new props for the element, including the GT identifier and a key
|
|
106
108
|
var generaltranslation = createGTProp(child);
|
|
107
109
|
var newProps = __assign(__assign({}, props), { 'data-_gt': generaltranslation });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addGTIdentifier.js","sourceRoot":"","sources":["../../src/internal/addGTIdentifier.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,
|
|
1
|
+
{"version":3,"file":"addGTIdentifier.js","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MAA1B,CAA2B;YACxC,IAAI,KAAK,CAAC,UAAU,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,qEAA8D,KAAK,2HAAwH,CAAC,CAAA;YAChN,0EAA0E;YAC1E,IAAI,kBAAkB,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;YAC7C,IAAI,QAAQ,yBACL,KAAK,KACR,UAAU,EAAE,kBAAkB,GACjC,CAAC;YACF,IAAI,OAAO,EAAE,CAAC;gBACV,QAAQ,CAAC,GAAG,GAAG,OAAO,CAAC;gBACvB,OAAO,GAAG,SAAS,CAAC;YACxB,CAAC;YACD,kCAAkC;YAClC,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACjB,QAAQ,CAAC,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACvD,CAAC;YACD,OAAO,eAAK,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,SAAS,cAAc,CAAC,QAAkB;QACtC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,OAAO,GAAG,SAAS,CAAC;YACpB,OAAO,eAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAA;QAC1D,CAAC;aAAM,CAAC;YACJ,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;IACL,CAAC;IAED,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC;AACpC,CAAC;AAAA,CAAC"}
|
|
@@ -23,7 +23,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.default = hashReactChildrenObjects;
|
|
26
|
-
var
|
|
26
|
+
var id_1 = require("generaltranslation/id");
|
|
27
27
|
/**
|
|
28
28
|
* Calculates a unique ID for the given children objects by hashing their sanitized JSON string representation.
|
|
29
29
|
*
|
|
@@ -32,7 +32,7 @@ var internal_1 = require("generaltranslation/internal");
|
|
|
32
32
|
*/
|
|
33
33
|
function hashReactChildrenObjects(childrenAsObjects) {
|
|
34
34
|
var unhashedKey = JSON.stringify(sanitizeChildrenAsObjects(childrenAsObjects));
|
|
35
|
-
return (0,
|
|
35
|
+
return (0, id_1.hashString)(unhashedKey);
|
|
36
36
|
}
|
|
37
37
|
function sanitizeChildrenAsObjects(childrenAsObjects) {
|
|
38
38
|
var sanitizeChild = function (child) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashReactChildrenObjects.js","sourceRoot":"","sources":["../../src/internal/hashReactChildrenObjects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAQA,2CAGC;AAXD,
|
|
1
|
+
{"version":3,"file":"hashReactChildrenObjects.js","sourceRoot":"","sources":["../../src/internal/hashReactChildrenObjects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAQA,2CAGC;AAXD,4CAAmD;AAEnD;;;;;GAKG;AACH,SAAwB,wBAAwB,CAAC,iBAAsB;IACnE,IAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACjF,OAAO,IAAA,eAAU,EAAC,WAAW,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,yBAAyB,CAAC,iBAAsB;IACrD,IAAM,aAAa,GAAG,UAAC,KAAU;;QAC7B,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YACpD,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,0CAAE,QAAQ,EAAE,CAAC;gBACjB,IAAA,IAAI,GAAc,KAAK,KAAnB,EAAK,IAAI,UAAK,KAAK,EAAzB,QAAiB,CAAF,CAAW;gBAChC,6BACO,IAAI,KACP,KAAK,wBACE,KAAK,CAAC,KAAK,KACd,QAAQ,EAAE,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,OAEvD;YACL,CAAC;iBAAM,CAAC;gBACI,IAAA,IAAI,GAAc,KAAK,KAAnB,EAAK,IAAI,UAAK,KAAK,EAAzB,QAAiB,CAAF,CAAW;gBAChC,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAA;IACD,IAAM,gBAAgB,GAAG,UAAC,QAAa;QACnC,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;IAC1F,CAAC,CAAA;IACD,OAAO,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeChildrenAsObjects.d.ts","sourceRoot":"","sources":["../../src/internal/writeChildrenAsObjects.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"writeChildrenAsObjects.d.ts","sourceRoot":"","sources":["../../src/internal/writeChildrenAsObjects.ts"],"names":[],"mappings":"AAyEA;;;;EAIE;AACF,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,CAEjE"}
|
|
@@ -16,7 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.default = writeChildrenAsObjects;
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
|
-
var
|
|
19
|
+
var getVariableName_1 = __importDefault(require("../variables/getVariableName"));
|
|
20
20
|
/**
|
|
21
21
|
* Gets the tag name of a React element.
|
|
22
22
|
* @param {ReactElement} child - The React element.
|
|
@@ -53,8 +53,13 @@ var handleSingleChild = function (child) {
|
|
|
53
53
|
var newGTProp = __assign({}, generaltranslation);
|
|
54
54
|
var transformation = generaltranslation.transformation;
|
|
55
55
|
if (transformation === "variable") {
|
|
56
|
-
var
|
|
57
|
-
|
|
56
|
+
var variableType = generaltranslation.variableType || "variable";
|
|
57
|
+
var variableName = (0, getVariableName_1.default)(props, variableType);
|
|
58
|
+
return {
|
|
59
|
+
variable: variableType,
|
|
60
|
+
key: variableName,
|
|
61
|
+
id: generaltranslation.id
|
|
62
|
+
};
|
|
58
63
|
}
|
|
59
64
|
if (transformation === "plural" && generaltranslation.branches) {
|
|
60
65
|
objectElement.type = 'Plural';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeChildrenAsObjects.js","sourceRoot":"","sources":["../../src/internal/writeChildrenAsObjects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"writeChildrenAsObjects.js","sourceRoot":"","sources":["../../src/internal/writeChildrenAsObjects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA8EA,yCAEC;AAhFD,gDAA2C;AAE3C,iFAA2D;AAE3D;;;;GAIG;AACH,IAAM,UAAU,GAAG,UAAC,KAAmB;;IACnC,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACd,IAAA,IAAI,GAAY,KAAK,KAAjB,EAAE,KAAK,GAAK,KAAK,MAAV,CAAW;IAC9B,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QACrC,IAAI,aAAa,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC,WAAW,CAAC;QAC/G,IAAI,MAAM,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC,IAAI,CAAC;IACvF,CAAC;IACD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AiB,CAAC,QAAQ,CAAC,CAAC;AAClG,CAAC"}
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import primitives, { isAcceptedPluralForm } from './primitives/primitives';
|
|
2
1
|
import hashReactChildrenObjects from "./internal/hashReactChildrenObjects";
|
|
3
2
|
import flattenDictionary from "./internal/flattenDictionary";
|
|
4
3
|
import addGTIdentifier from "./internal/addGTIdentifier";
|
|
@@ -8,5 +7,6 @@ import getDictionaryEntry from "./provider/helpers/getDictionaryEntry";
|
|
|
8
7
|
import extractEntryMetadata from "./provider/helpers/extractEntryMetadata";
|
|
9
8
|
import getVariableProps from './variables/_getVariableProps';
|
|
10
9
|
import isVariableObject from './provider/helpers/isVariableObject';
|
|
11
|
-
|
|
10
|
+
import getVariableName, { getFallbackVariableName } from "./variables/getVariableName";
|
|
11
|
+
export { addGTIdentifier, writeChildrenAsObjects, isVariableObject, flattenDictionary, getDictionaryEntry, getVariableProps, hashReactChildrenObjects, getPluralBranch, extractEntryMetadata, getVariableName, getFallbackVariableName };
|
|
12
12
|
//# sourceMappingURL=internal.d.ts.map
|
package/dist/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,MAAM,qCAAqC,CAAC;AAC3E,OAAO,iBAAiB,MAAM,8BAA8B,CAAC;AAC7D,OAAO,eAAe,MAAM,4BAA4B,CAAC;AACzD,OAAO,sBAAsB,MAAM,mCAAmC,CAAC;AACvE,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,kBAAkB,MAAM,uCAAuC,CAAC;AACvE,OAAO,oBAAoB,MAAM,yCAAyC,CAAC;AAC3E,OAAO,gBAAgB,MAAM,+BAA+B,CAAC;AAC7D,OAAO,gBAAgB,MAAM,qCAAqC,CAAC;AACnE,OAAO,eAAe,EAAE,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EACH,eAAe,EAAE,sBAAsB,EAAE,gBAAgB,EACzD,iBAAiB,EAAE,kBAAkB,EAAE,gBAAgB,EACvD,wBAAwB,EAAE,eAAe,EAAE,oBAAoB,EAC/D,eAAe,EAAE,uBAAuB,EAC3C,CAAA"}
|
package/dist/internal.js
CHANGED
|
@@ -26,10 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
30
|
-
var primitives_1 = __importStar(require("./primitives/primitives"));
|
|
31
|
-
exports.primitives = primitives_1.default;
|
|
32
|
-
Object.defineProperty(exports, "isAcceptedPluralForm", { enumerable: true, get: function () { return primitives_1.isAcceptedPluralForm; } });
|
|
29
|
+
exports.getFallbackVariableName = exports.getVariableName = exports.extractEntryMetadata = exports.getPluralBranch = exports.hashReactChildrenObjects = exports.getVariableProps = exports.getDictionaryEntry = exports.flattenDictionary = exports.isVariableObject = exports.writeChildrenAsObjects = exports.addGTIdentifier = void 0;
|
|
33
30
|
var hashReactChildrenObjects_1 = __importDefault(require("./internal/hashReactChildrenObjects"));
|
|
34
31
|
exports.hashReactChildrenObjects = hashReactChildrenObjects_1.default;
|
|
35
32
|
var flattenDictionary_1 = __importDefault(require("./internal/flattenDictionary"));
|
|
@@ -48,4 +45,7 @@ var _getVariableProps_1 = __importDefault(require("./variables/_getVariableProps
|
|
|
48
45
|
exports.getVariableProps = _getVariableProps_1.default;
|
|
49
46
|
var isVariableObject_1 = __importDefault(require("./provider/helpers/isVariableObject"));
|
|
50
47
|
exports.isVariableObject = isVariableObject_1.default;
|
|
48
|
+
var getVariableName_1 = __importStar(require("./variables/getVariableName"));
|
|
49
|
+
exports.getVariableName = getVariableName_1.default;
|
|
50
|
+
Object.defineProperty(exports, "getFallbackVariableName", { enumerable: true, get: function () { return getVariableName_1.getFallbackVariableName; } });
|
|
51
51
|
//# sourceMappingURL=internal.js.map
|