gt-react 3.1.81 → 3.1.82
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.
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GTClientProvider component for providing translations to entirely client-side React apps.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} props - The properties object.
|
|
5
|
+
* @param {React.ReactNode} [props.children] - The child components to be rendered within the provider.
|
|
6
|
+
* @param {string} [props.projectID] - The project ID for remote translation services.
|
|
7
|
+
* @param {Record<string, any>} [props.dictionary=defaultGTProps.dictionary] - The local dictionary for translations.
|
|
8
|
+
* @param {string} [props.dictionaryName=defaultGTProps.dictionaryName] - The name of the dictionary.
|
|
9
|
+
* @param {string[]} [props.approvedLocales] - The list of approved locales.
|
|
10
|
+
* @param {string} [props.defaultLocale=approvedLocales?.[0] || defaultGTProps.defaultLocale] - The default locale.
|
|
11
|
+
* @param {string} [props.locale=''] - The current locale.
|
|
12
|
+
* @param {boolean} [props.remoteSource=defaultGTProps.remoteSource] - Flag indicating if remote source is used.
|
|
13
|
+
* @param {string} [props.cacheURL=defaultGTProps.cacheURL] - The URL for caching translations.
|
|
14
|
+
* @param {Record<string, () => Promise<Record<string, any>>>} [props.translations] - A local translations object.
|
|
15
|
+
*
|
|
16
|
+
* @throws Will throw an error if projectID is not provided when remoteSource is true and cacheURL is the default.
|
|
17
|
+
*
|
|
18
|
+
* @returns {JSX.Element} The GTClientProvider component.
|
|
19
|
+
*/
|
|
1
20
|
export default function GTClientProvider({ children, projectID, dictionary, dictionaryName, approvedLocales, defaultLocale, locale, remoteSource, cacheURL, translations }: {
|
|
2
21
|
children?: any;
|
|
3
22
|
projectID?: string;
|
|
@@ -9,5 +28,5 @@ export default function GTClientProvider({ children, projectID, dictionary, dict
|
|
|
9
28
|
remoteSource?: boolean;
|
|
10
29
|
cacheURL?: string;
|
|
11
30
|
translations?: Record<string, () => Promise<Record<string, any>>>;
|
|
12
|
-
}):
|
|
31
|
+
}): JSX.Element;
|
|
13
32
|
//# sourceMappingURL=GTClientProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTClientProvider.d.ts","sourceRoot":"","sources":["../../../src/client/client-only/GTClientProvider.tsx"],"names":[],"mappings":"AAkBA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACrC,QAAQ,EACR,SAAS,EACT,UAAsC,EACtC,cAA8C,EAC9C,eAAe,EAAE,aAAoE,EACrF,MAAW,EACX,YAA0C,EAC1C,QAAkC,EAClC,YAAY,EACf,EAAE;IACC,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"GTClientProvider.d.ts","sourceRoot":"","sources":["../../../src/client/client-only/GTClientProvider.tsx"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;;;;;EAkBE;AACF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACrC,QAAQ,EACR,SAAS,EACT,UAAsC,EACtC,cAA8C,EAC9C,eAAe,EAAE,aAAoE,EACrF,MAAW,EACX,YAA0C,EAC1C,QAAkC,EAClC,YAAY,EACf,EAAE;IACC,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;CAErE,GAAG,GAAG,CAAC,OAAO,CA4Gd"}
|
|
@@ -89,6 +89,25 @@ var getEntryTranslationType_1 = __importDefault(require("../../primitives/render
|
|
|
89
89
|
var getEntryMetadata_1 = __importDefault(require("../../primitives/rendering/getEntryMetadata"));
|
|
90
90
|
var ClientPlural_1 = __importDefault(require("../plural/ClientPlural"));
|
|
91
91
|
var addGTIdentifier_1 = __importDefault(require("../../primitives/translation/addGTIdentifier"));
|
|
92
|
+
/**
|
|
93
|
+
* GTClientProvider component for providing translations to entirely client-side React apps.
|
|
94
|
+
*
|
|
95
|
+
* @param {Object} props - The properties object.
|
|
96
|
+
* @param {React.ReactNode} [props.children] - The child components to be rendered within the provider.
|
|
97
|
+
* @param {string} [props.projectID] - The project ID for remote translation services.
|
|
98
|
+
* @param {Record<string, any>} [props.dictionary=defaultGTProps.dictionary] - The local dictionary for translations.
|
|
99
|
+
* @param {string} [props.dictionaryName=defaultGTProps.dictionaryName] - The name of the dictionary.
|
|
100
|
+
* @param {string[]} [props.approvedLocales] - The list of approved locales.
|
|
101
|
+
* @param {string} [props.defaultLocale=approvedLocales?.[0] || defaultGTProps.defaultLocale] - The default locale.
|
|
102
|
+
* @param {string} [props.locale=''] - The current locale.
|
|
103
|
+
* @param {boolean} [props.remoteSource=defaultGTProps.remoteSource] - Flag indicating if remote source is used.
|
|
104
|
+
* @param {string} [props.cacheURL=defaultGTProps.cacheURL] - The URL for caching translations.
|
|
105
|
+
* @param {Record<string, () => Promise<Record<string, any>>>} [props.translations] - A local translations object.
|
|
106
|
+
*
|
|
107
|
+
* @throws Will throw an error if projectID is not provided when remoteSource is true and cacheURL is the default.
|
|
108
|
+
*
|
|
109
|
+
* @returns {JSX.Element} The GTClientProvider component.
|
|
110
|
+
*/
|
|
92
111
|
function GTClientProvider(_a) {
|
|
93
112
|
var _this = this;
|
|
94
113
|
var children = _a.children, projectID = _a.projectID, _b = _a.dictionary, dictionary = _b === void 0 ? defaultGTProps_1.default.dictionary : _b, _c = _a.dictionaryName, dictionaryName = _c === void 0 ? defaultGTProps_1.default.dictionaryName : _c, approvedLocales = _a.approvedLocales, _d = _a.defaultLocale, defaultLocale = _d === void 0 ? (approvedLocales === null || approvedLocales === void 0 ? void 0 : approvedLocales[0]) || defaultGTProps_1.default.defaultLocale : _d, _e = _a.locale, locale = _e === void 0 ? '' : _e, _f = _a.remoteSource, remoteSource = _f === void 0 ? defaultGTProps_1.default.remoteSource : _f, _g = _a.cacheURL, cacheURL = _g === void 0 ? defaultGTProps_1.default.cacheURL : _g, translations = _a.translations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTClientProvider.js","sourceRoot":"","sources":["../../../src/client/client-only/GTClientProvider.tsx"],"names":[],"mappings":";AAAA,uEAAuE;AAEvE,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"GTClientProvider.js","sourceRoot":"","sources":["../../../src/client/client-only/GTClientProvider.tsx"],"names":[],"mappings":";AAAA,uEAAuE;AAEvE,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCZ,mCA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