gt-next 5.2.20 → 5.2.21-alpha.0

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.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { T, useGT, useDict, useLocale, useDefaultLocale, LocaleSelector, GTProvider, useLocales, useSetLocale, useLocaleSelector } from 'gt-react/client';
2
- export { GTProvider as GTClientProvider, T, useGT, useLocale, useLocales, useSetLocale, useDefaultLocale, useDict, LocaleSelector, useLocaleSelector, };
1
+ import { T, useGT, useDict, useLocale, useDefaultLocale, LocaleSelector, GTProvider, useLocales, useSetLocale, useLocaleSelector, Var, Currency, DateTime, Num, Plural, Branch } from 'gt-react/client';
2
+ export { GTProvider as GTClientProvider, T, useGT, useLocale, useLocales, useSetLocale, useDefaultLocale, useDict, LocaleSelector, useLocaleSelector, Var, Currency, DateTime, Num, Plural, Branch, };
3
3
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,CAAC,EACD,KAAK,EACL,OAAO,EACP,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,UAAU,EACV,YAAY,EACZ,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,UAAU,IAAI,gBAAgB,EAC9B,CAAC,EACD,KAAK,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,iBAAiB,GAClB,CAAC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,CAAC,EACD,KAAK,EACL,OAAO,EACP,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,MAAM,EACN,MAAM,EACP,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,UAAU,IAAI,gBAAgB,EAC9B,CAAC,EACD,KAAK,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,iBAAiB,EACjB,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,MAAM,EACN,MAAM,GACP,CAAC"}
package/dist/client.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  'use client';
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.useLocaleSelector = exports.LocaleSelector = exports.useDict = exports.useDefaultLocale = exports.useSetLocale = exports.useLocales = exports.useLocale = exports.useGT = exports.T = exports.GTClientProvider = void 0;
4
+ exports.Branch = exports.Plural = exports.Num = exports.DateTime = exports.Currency = exports.Var = exports.useLocaleSelector = exports.LocaleSelector = exports.useDict = exports.useDefaultLocale = exports.useSetLocale = exports.useLocales = exports.useLocale = exports.useGT = exports.T = exports.GTClientProvider = void 0;
5
5
  var client_1 = require("gt-react/client");
6
6
  Object.defineProperty(exports, "T", { enumerable: true, get: function () { return client_1.T; } });
7
7
  Object.defineProperty(exports, "useGT", { enumerable: true, get: function () { return client_1.useGT; } });
@@ -13,4 +13,10 @@ Object.defineProperty(exports, "GTClientProvider", { enumerable: true, get: func
13
13
  Object.defineProperty(exports, "useLocales", { enumerable: true, get: function () { return client_1.useLocales; } });
14
14
  Object.defineProperty(exports, "useSetLocale", { enumerable: true, get: function () { return client_1.useSetLocale; } });
15
15
  Object.defineProperty(exports, "useLocaleSelector", { enumerable: true, get: function () { return client_1.useLocaleSelector; } });
16
+ Object.defineProperty(exports, "Var", { enumerable: true, get: function () { return client_1.Var; } });
17
+ Object.defineProperty(exports, "Currency", { enumerable: true, get: function () { return client_1.Currency; } });
18
+ Object.defineProperty(exports, "DateTime", { enumerable: true, get: function () { return client_1.DateTime; } });
19
+ Object.defineProperty(exports, "Num", { enumerable: true, get: function () { return client_1.Num; } });
20
+ Object.defineProperty(exports, "Plural", { enumerable: true, get: function () { return client_1.Plural; } });
21
+ Object.defineProperty(exports, "Branch", { enumerable: true, get: function () { return client_1.Branch; } });
16
22
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AACb,0CAWyB;AAIvB,kFAdA,UAAC,OAcA;AACD,sFAdA,cAAK,OAcA;AAKL,wFAlBA,gBAAO,OAkBA;AAJP,0FAbA,kBAAS,OAaA;AAGT,iGAfA,yBAAgB,OAeA;AAEhB,+FAhBA,uBAAc,OAgBA;AARA,iGAPd,mBAAU,OAOoB;AAI9B,2FAVA,mBAAU,OAUA;AACV,6FAVA,qBAAY,OAUA;AAIZ,kGAbA,0BAAiB,OAaA"}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AACb,0CAiByB;AAIvB,kFApBA,UAAC,OAoBA;AACD,sFApBA,cAAK,OAoBA;AAKL,wFAxBA,gBAAO,OAwBA;AAJP,0FAnBA,kBAAS,OAmBA;AAGT,iGArBA,yBAAgB,OAqBA;AAEhB,+FAtBA,uBAAc,OAsBA;AARA,iGAbd,mBAAU,OAaoB;AAI9B,2FAhBA,mBAAU,OAgBA;AACV,6FAhBA,qBAAY,OAgBA;AAIZ,kGAnBA,0BAAiB,OAmBA;AACjB,oFAnBA,YAAG,OAmBA;AACH,yFAnBA,iBAAQ,OAmBA;AACR,yFAnBA,iBAAQ,OAmBA;AACR,oFAnBA,YAAG,OAmBA;AACH,uFAnBA,eAAM,OAmBA;AACN,uFAnBA,eAAM,OAmBA"}
@@ -4,11 +4,13 @@ import { ReactNode } from 'react';
4
4
  *
5
5
  * @param {React.ReactNode} children - The children components that will use the translation context.
6
6
  * @param {string} id - ID of a nested dictionary, so that only a subset of a large dictionary needs to be sent to the client.
7
+ * @param {string} locale - The locale to use for the translation context.
7
8
  *
8
9
  * @returns {JSX.Element} The provider component for General Translation context.
9
10
  */
10
- export default function GTProvider({ children, id: prefixId, }: {
11
+ export default function GTProvider({ children, id: prefixId, locale: _locale, }: {
11
12
  children?: ReactNode;
12
13
  id?: string;
14
+ locale?: string;
13
15
  }): Promise<import("react/jsx-runtime").JSX.Element>;
14
16
  //# sourceMappingURL=GTProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GTProvider.d.ts","sourceRoot":"","sources":["../../src/provider/GTProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,SAAS,EAAE,MAAM,OAAO,CAAC;AAQlD;;;;;;;GAOG;AACH,wBAA8B,UAAU,CAAC,EACvC,QAAQ,EACR,EAAE,EAAE,QAAQ,GACb,EAAE;IACD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,oDAmEA"}
1
+ {"version":3,"file":"GTProvider.d.ts","sourceRoot":"","sources":["../../src/provider/GTProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,SAAS,EAAE,MAAM,OAAO,CAAC;AAQlD;;;;;;;;GAQG;AACH,wBAA8B,UAAU,CAAC,EACvC,QAAQ,EACR,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,OAAO,GAChB,EAAE;IACD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,oDAmEA"}
@@ -96,37 +96,43 @@ var ClientProviderWrapper_1 = __importDefault(require("./ClientProviderWrapper")
96
96
  *
97
97
  * @param {React.ReactNode} children - The children components that will use the translation context.
98
98
  * @param {string} id - ID of a nested dictionary, so that only a subset of a large dictionary needs to be sent to the client.
99
+ * @param {string} locale - The locale to use for the translation context.
99
100
  *
100
101
  * @returns {JSX.Element} The provider component for General Translation context.
101
102
  */
102
103
  function GTProvider(_a) {
103
104
  return __awaiter(this, arguments, void 0, function (_b) {
104
- var I18NConfig, locale, defaultLocale, _c, translationRequired, dialectTranslationRequired, dictionaryTranslations, cachedTranslationsPromise, dictionary, _d, prefixPath, translations;
105
- var children = _b.children, prefixId = _b.id;
106
- return __generator(this, function (_e) {
107
- switch (_e.label) {
105
+ var I18NConfig, locale, _c, defaultLocale, _d, translationRequired, dialectTranslationRequired, dictionaryTranslations, cachedTranslationsPromise, dictionary, _e, prefixPath, translations;
106
+ var children = _b.children, prefixId = _b.id, _locale = _b.locale;
107
+ return __generator(this, function (_f) {
108
+ switch (_f.label) {
108
109
  case 0:
109
110
  I18NConfig = (0, getI18NConfig_1.default)();
111
+ _c = _locale;
112
+ if (_c) return [3 /*break*/, 2];
110
113
  return [4 /*yield*/, (0, getLocale_1.default)()];
111
114
  case 1:
112
- locale = _e.sent();
115
+ _c = (_f.sent());
116
+ _f.label = 2;
117
+ case 2:
118
+ locale = _c;
113
119
  defaultLocale = I18NConfig.getDefaultLocale();
114
- _c = I18NConfig.requiresTranslation(locale), translationRequired = _c[0], dialectTranslationRequired = _c[1];
120
+ _d = I18NConfig.requiresTranslation(locale), translationRequired = _d[0], dialectTranslationRequired = _d[1];
115
121
  return [4 /*yield*/, I18NConfig.getDictionaryTranslations(locale)];
116
- case 2:
117
- dictionaryTranslations = (_e.sent()) || {};
122
+ case 3:
123
+ dictionaryTranslations = (_f.sent()) || {};
118
124
  cachedTranslationsPromise = translationRequired
119
125
  ? I18NConfig.getCachedTranslations(locale)
120
126
  : {};
121
- if (!prefixId) return [3 /*break*/, 3];
122
- _d = (0, getDictionary_1.getDictionaryEntry)(prefixId);
123
- return [3 /*break*/, 5];
124
- case 3: return [4 /*yield*/, (0, getDictionary_1.default)()];
125
- case 4:
126
- _d = _e.sent();
127
- _e.label = 5;
127
+ if (!prefixId) return [3 /*break*/, 4];
128
+ _e = (0, getDictionary_1.getDictionaryEntry)(prefixId);
129
+ return [3 /*break*/, 6];
130
+ case 4: return [4 /*yield*/, (0, getDictionary_1.default)()];
128
131
  case 5:
129
- dictionary = (_d) || {};
132
+ _e = _f.sent();
133
+ _f.label = 6;
134
+ case 6:
135
+ dictionary = (_e) || {};
130
136
  // Check provisional dictionary
131
137
  if ((0, react_1.isValidElement)(dictionary) ||
132
138
  Array.isArray(dictionary) ||
@@ -143,8 +149,8 @@ function GTProvider(_a) {
143
149
  }, dictionary);
144
150
  }
145
151
  return [4 /*yield*/, cachedTranslationsPromise];
146
- case 6:
147
- translations = _e.sent();
152
+ case 7:
153
+ translations = _f.sent();
148
154
  return [2 /*return*/, ((0, jsx_runtime_1.jsx)(ClientProviderWrapper_1.default, __assign({ dictionary: dictionary, initialTranslations: translations, dictionaryTranslations: dictionaryTranslations, locale: locale, locales: I18NConfig.getLocales(), defaultLocale: defaultLocale, translationRequired: translationRequired, dialectTranslationRequired: dialectTranslationRequired, gtServicesEnabled: process.env._GENERALTRANSLATION_GT_SERVICES_ENABLED === 'true' }, I18NConfig.getClientSideConfig(), { children: children })))];
149
155
  }
150
156
  });
@@ -1 +1 @@
1
- {"version":3,"file":"GTProvider.js","sourceRoot":"","sources":["../../src/provider/GTProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,6BAyEC;;AAzFD,+BAAkD;AAClD,8EAAwD;AACxD,mEAA6C;AAC7C,2EAAgF;AAEhF,uDAAqE;AACrE,kFAAqD;AAErD;;;;;;;GAOG;AACH,SAA8B,UAAU;wDAAC,EAMxC;;YALC,QAAQ,cAAA,EACJ,QAAQ,QAAA;;;;oBAMN,UAAU,GAAG,IAAA,uBAAa,GAAE,CAAC;oBACpB,qBAAM,IAAA,mBAAS,GAAE,EAAA;;oBAA1B,MAAM,GAAG,SAAiB;oBAC1B,aAAa,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAC;oBAC9C,KACJ,UAAU,C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AAC,uCAAuC,KAAK,MAAM,IAE5D,UAAU,CAAC,mBAAmB,EAAE,cAEnC,QAAQ,IACM,CAClB,EAAC;;;;CACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gt-next",
3
- "version": "5.2.20",
3
+ "version": "5.2.21-alpha.0",
4
4
  "description": "A Next.js library for automatic internationalization.",
5
5
  "main": "dist/index.server.js",
6
6
  "peerDependencies": {