gt-next 5.2.37-alpha.0 → 5.2.38
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/CHANGELOG.md +18 -0
- package/dist/branches/Plural.d.ts +4 -4
- package/dist/branches/Plural.d.ts.map +1 -1
- package/dist/branches/Plural.js +7 -48
- package/dist/branches/Plural.js.map +1 -1
- package/dist/errors/createErrors.d.ts +0 -2
- package/dist/errors/createErrors.d.ts.map +1 -1
- package/dist/errors/createErrors.js +1 -9
- package/dist/errors/createErrors.js.map +1 -1
- package/dist/index.client.d.ts +2 -2
- package/dist/index.client.d.ts.map +1 -1
- package/dist/index.client.js +1 -3
- package/dist/index.client.js.map +1 -1
- package/dist/index.server.d.ts +9 -12
- package/dist/index.server.d.ts.map +1 -1
- package/dist/index.server.js +16 -35
- package/dist/index.server.js.map +1 -1
- package/dist/index.types.d.ts +16 -35
- package/dist/index.types.d.ts.map +1 -1
- package/dist/index.types.js +16 -41
- package/dist/index.types.js.map +1 -1
- package/dist/provider/GTProvider.js +2 -2
- package/dist/provider/GTProvider.js.map +1 -1
- package/dist/request/getLocale.d.ts +2 -1
- package/dist/request/getLocale.d.ts.map +1 -1
- package/dist/request/getLocale.js +6 -1
- package/dist/request/getLocale.js.map +1 -1
- package/dist/server-dir/buildtime/T.js +2 -2
- package/dist/server-dir/buildtime/T.js.map +1 -1
- package/dist/server-dir/buildtime/getGT.d.ts +11 -1
- package/dist/server-dir/buildtime/getGT.d.ts.map +1 -1
- package/dist/server-dir/buildtime/getGT.js +16 -9
- package/dist/server-dir/buildtime/getGT.js.map +1 -1
- package/dist/server-dir/buildtime/getTranslations.d.ts +16 -2
- package/dist/server-dir/buildtime/getTranslations.d.ts.map +1 -1
- package/dist/server-dir/buildtime/getTranslations.js +22 -4
- package/dist/server-dir/buildtime/getTranslations.js.map +1 -1
- package/dist/server-dir/runtime/_Tx.js +2 -2
- package/dist/server-dir/runtime/_Tx.js.map +1 -1
- package/dist/server-dir/runtime/tx.js +2 -2
- package/dist/server-dir/runtime/tx.js.map +1 -1
- package/dist/server.d.ts +4 -3
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +11 -7
- package/dist/server.js.map +1 -1
- package/dist/utils/use.d.ts +4 -0
- package/dist/utils/use.d.ts.map +1 -0
- package/dist/utils/use.js +73 -0
- package/dist/utils/use.js.map +1 -0
- package/dist/variables/Currency.d.ts +3 -3
- package/dist/variables/Currency.d.ts.map +1 -1
- package/dist/variables/Currency.js +12 -57
- package/dist/variables/Currency.js.map +1 -1
- package/dist/variables/DateTime.d.ts +3 -3
- package/dist/variables/DateTime.d.ts.map +1 -1
- package/dist/variables/DateTime.js +24 -69
- package/dist/variables/DateTime.js.map +1 -1
- package/dist/variables/Num.d.ts +2 -2
- package/dist/variables/Num.d.ts.map +1 -1
- package/dist/variables/Num.js +12 -57
- package/dist/variables/Num.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# gt-next
|
|
2
2
|
|
|
3
|
+
## 5.2.38
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#355](https://github.com/generaltranslation/gt/pull/355) [`740a3d1`](https://github.com/generaltranslation/gt/commit/740a3d1ee565016375d05e5dbb6b7d81fe9294ec) Thanks [@archie-mckenzie](https://github.com/archie-mckenzie)! - feat: add custom gt use hooks on server side components
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`740a3d1`](https://github.com/generaltranslation/gt/commit/740a3d1ee565016375d05e5dbb6b7d81fe9294ec)]:
|
|
10
|
+
- gt-react@9.2.28
|
|
11
|
+
|
|
12
|
+
## 5.2.37
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#353](https://github.com/generaltranslation/gt/pull/353) [`de17003`](https://github.com/generaltranslation/gt/commit/de170039e51383c8c8f3f59d5d94e93e6ccedeb9) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - chore: bump versions
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`de17003`](https://github.com/generaltranslation/gt/commit/de170039e51383c8c8f3f59d5d94e93e6ccedeb9)]:
|
|
19
|
+
- gt-react@9.2.27
|
|
20
|
+
|
|
3
21
|
## 5.2.36
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -12,22 +12,22 @@
|
|
|
12
12
|
* other={<>There are <Num children={n}/> items.</>}
|
|
13
13
|
* />
|
|
14
14
|
* ```
|
|
15
|
-
* In this
|
|
15
|
+
* In this ex ample, if `n` is 1, it renders `"There is 1 item"`. If `n` is a different number, it renders
|
|
16
16
|
* `"There are {n} items"`.
|
|
17
17
|
*
|
|
18
18
|
* @param {any} [children] - Fallback content to render if no matching plural branch is found.
|
|
19
19
|
* @param {number} [n] - The number used to determine the plural form. This is required for pluralization to work.
|
|
20
20
|
* @param {...branches} [branches] - A spread object containing possible plural branches, typically including `one` for singular
|
|
21
21
|
* and `other` for plural forms, but it may vary depending on the locale.
|
|
22
|
-
* @returns {
|
|
22
|
+
* @returns {React.JSX.Element} The rendered content corresponding to the plural form of `n`, or the fallback content.
|
|
23
23
|
* @throws {Error} If `n` is not provided or not a valid number.
|
|
24
24
|
*/
|
|
25
25
|
declare function Plural({ children, n, locales, ...branches }: {
|
|
26
|
-
children?:
|
|
26
|
+
children?: React.ReactNode;
|
|
27
27
|
n?: number;
|
|
28
28
|
locales?: string[];
|
|
29
29
|
[key: string]: any;
|
|
30
|
-
}):
|
|
30
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
31
31
|
declare namespace Plural {
|
|
32
32
|
var gtTransformation: string;
|
|
33
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plural.d.ts","sourceRoot":"","sources":["../../src/branches/Plural.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Plural.d.ts","sourceRoot":"","sources":["../../src/branches/Plural.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,iBAAS,MAAM,CAAC,EACd,QAAQ,EACR,CAAC,EACD,OAA2D,EAC3D,GAAG,QAAQ,EACZ,EAAE;IACD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,2CAQA;kBAlBQ,MAAM;;;AAsBf,eAAe,MAAM,CAAC"}
|
package/dist/branches/Plural.js
CHANGED
|
@@ -1,40 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
39
3
|
var t = {};
|
|
40
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -53,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
53
17
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
54
18
|
var internal_1 = require("gt-react/internal");
|
|
55
19
|
var getI18NConfig_1 = __importDefault(require("../config-dir/getI18NConfig"));
|
|
20
|
+
var getLocale_1 = require("../request/getLocale");
|
|
56
21
|
/**
|
|
57
22
|
* The `<Plural>` component dynamically renders content based on the plural form of the given number (`n`).
|
|
58
23
|
* It determines which content to display by matching the value of `n` to the appropriate pluralization branch,
|
|
@@ -67,27 +32,21 @@ var getI18NConfig_1 = __importDefault(require("../config-dir/getI18NConfig"));
|
|
|
67
32
|
* other={<>There are <Num children={n}/> items.</>}
|
|
68
33
|
* />
|
|
69
34
|
* ```
|
|
70
|
-
* In this
|
|
35
|
+
* In this ex ample, if `n` is 1, it renders `"There is 1 item"`. If `n` is a different number, it renders
|
|
71
36
|
* `"There are {n} items"`.
|
|
72
37
|
*
|
|
73
38
|
* @param {any} [children] - Fallback content to render if no matching plural branch is found.
|
|
74
39
|
* @param {number} [n] - The number used to determine the plural form. This is required for pluralization to work.
|
|
75
40
|
* @param {...branches} [branches] - A spread object containing possible plural branches, typically including `one` for singular
|
|
76
41
|
* and `other` for plural forms, but it may vary depending on the locale.
|
|
77
|
-
* @returns {
|
|
42
|
+
* @returns {React.JSX.Element} The rendered content corresponding to the plural form of `n`, or the fallback content.
|
|
78
43
|
* @throws {Error} If `n` is not provided or not a valid number.
|
|
79
44
|
*/
|
|
80
45
|
function Plural(_a) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
branch = (typeof n === 'number'
|
|
86
|
-
? (0, internal_1.getPluralBranch)(n, locales, branches)
|
|
87
|
-
: children) || children;
|
|
88
|
-
return [2 /*return*/, (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: branch })];
|
|
89
|
-
});
|
|
90
|
-
});
|
|
46
|
+
var children = _a.children, n = _a.n, _b = _a.locales, locales = _b === void 0 ? [(0, getLocale_1.useLocale)(), (0, getI18NConfig_1.default)().getDefaultLocale()] : _b, branches = __rest(_a, ["children", "n", "locales"]);
|
|
47
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (typeof n === 'number'
|
|
48
|
+
? (0, internal_1.getPluralBranch)(n, locales, branches)
|
|
49
|
+
: children) || children }));
|
|
91
50
|
}
|
|
92
51
|
Plural.gtTransformation = 'plural';
|
|
93
52
|
exports.default = Plural;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plural.js","sourceRoot":"","sources":["../../src/branches/Plural.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Plural.js","sourceRoot":"","sources":["../../src/branches/Plural.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8CAAoD;AACpD,8EAAwD;AACxD,kDAAiD;AAEjD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAS,MAAM,CAAC,EAUf;IATC,IAAA,QAAQ,cAAA,EACR,CAAC,OAAA,EACD,eAA2D,EAA3D,OAAO,mBAAG,CAAC,IAAA,qBAAS,GAAE,EAAE,IAAA,uBAAa,GAAE,CAAC,gBAAgB,EAAE,CAAC,KAAA,EACxD,QAAQ,cAJG,4BAKf,CADY;IAOX,OAAO,CACL,2DACG,CAAC,OAAO,CAAC,KAAK,QAAQ;YACrB,CAAC,CAAC,IAAA,0BAAe,EAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC;YACvC,CAAC,CAAC,QAAQ,CAAC,IAAI,QAAQ,GACxB,CACJ,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,gBAAgB,GAAG,QAAQ,CAAC;AAEnC,kBAAe,MAAM,CAAC"}
|
|
@@ -14,8 +14,6 @@ export declare const unresolvedLoadTranslationsBuildError: (path: string) => str
|
|
|
14
14
|
export declare const unresolvedGetLocaleBuildError: (path: string) => string;
|
|
15
15
|
export declare const conflictingConfigurationBuildError: (conflicts: string[]) => string;
|
|
16
16
|
export declare const unsupportedGetLocalePathBuildError = "gt-next Error: custom getLocale() function is not currently supported.";
|
|
17
|
-
export declare const createCustomHookWithoutUseClientError: (hookName: string) => string;
|
|
18
|
-
export declare const createCustomComponentWithoutUseClientError: (componentName: string) => string;
|
|
19
17
|
export declare const typesFileError = "gt-next Error: There is no scenario in which you should be seeing this error.";
|
|
20
18
|
export declare const gtProviderUseClientError: string;
|
|
21
19
|
export declare const txUseClientError: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createErrors.d.ts","sourceRoot":"","sources":["../../src/errors/createErrors.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,uBAAuB,gDACW,CAAC;AAEhD,eAAO,MAAM,2BAA2B,GAAI,SAAQ,MAAW,WACyF,CAAC;AAEzJ,eAAO,MAAM,2BAA2B,GAAI,SAAQ,MAAW,WACmG,CAAC;AAEnK,eAAO,MAAM,4BAA4B,GACvC,QAAQ,MAAM,EACd,KAAK,MAAM,EACX,qBAAmB,WAIa,CAAC;AAEnC,eAAO,MAAM,gCAAgC,GAAI,IAAI,MAAM,WACuB,CAAC;AAEnF,eAAO,MAAM,yBAAyB,GAAI,IAAI,MAAM,EAAE,gBAAgB,MAAM,WACsJ,CAAC;AAEnO,eAAO,MAAM,kCAAkC,4KAA4K,CAAC;AAE5N,eAAO,MAAM,2BAA2B,GAAI,IAAI,MAAM,EAAE,cAAc,MAAM,WAC2G,CAAC;AAExL,eAAO,MAAM,uBAAuB,8NAA8N,CAAC;AAEnQ,eAAO,MAAM,mCAAmC,kKAAkK,CAAC;AAEnN,eAAO,MAAM,qCAAqC,sKAAsK,CAAC;AAEzN,eAAO,MAAM,kCAAkC,GAAI,MAAM,MAAM,WACmB,CAAC;AAEnF,eAAO,MAAM,oCAAoC,GAAI,MAAM,MAAM,WAC4B,CAAC;AAE9F,eAAO,MAAM,6BAA6B,GAAI,MAAM,MAAM,WACmC,CAAC;AAE9F,eAAO,MAAM,kCAAkC,GAAI,WAAW,MAAM,EAAE,WAKjE,CAAC;AAEN,eAAO,MAAM,kCAAkC,2EAC2B,CAAC;AAE3E,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"createErrors.d.ts","sourceRoot":"","sources":["../../src/errors/createErrors.ts"],"names":[],"mappings":"AAIA,eAA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D,CAAC;AAElB,eAAO,MAAM,4BAA4B,GACvC,cAAc,MAAM,EACpB,cAAc,MAAM,WAE2L,CAAC;AAElN,eAAO,MAAM,oBAAoB,qMAAqM,CAAC;AAEvO,eAAO,MAAM,YAAY,QAIoE,CAAC;AAE9F,eAAO,MAAM,iBAAiB,QAGqF,CAAC;AAEpH,eAAO,MAAM,yBAAyB,QAEmD,CAAC;AAE1F,eAAO,MAAM,gCAAgC,4CAA4C,CAAC;AAE1F,eAAO,MAAM,yBAAyB,uLAAuL,CAAC;AAE9N,eAAO,MAAM,0BAA0B,GAAI,SAAS,MAAM,EAAE,WAC8B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// ---- ERRORS ---- //
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.standardizedLocalesWarning = exports.dictionaryNotFoundWarning = exports.runtimeTranslationTimeoutWarning = exports.translationLoadingWarning = exports.APIKeyMissingWarn = exports.noInitGTWarn = exports.projectIdMissingWarn = exports.createMismatchingHashWarning = exports.createUnsupportedLocalesWarning = exports.createInvalidDictionaryEntryWarning = exports.createNoEntryFoundWarning = exports.usingDefaultsWarning = exports.txUseClientError = exports.gtProviderUseClientError = exports.typesFileError = exports.
|
|
4
|
+
exports.standardizedLocalesWarning = exports.dictionaryNotFoundWarning = exports.runtimeTranslationTimeoutWarning = exports.translationLoadingWarning = exports.APIKeyMissingWarn = exports.noInitGTWarn = exports.projectIdMissingWarn = exports.createMismatchingHashWarning = exports.createUnsupportedLocalesWarning = exports.createInvalidDictionaryEntryWarning = exports.createNoEntryFoundWarning = exports.usingDefaultsWarning = exports.txUseClientError = exports.gtProviderUseClientError = exports.typesFileError = exports.unsupportedGetLocalePathBuildError = exports.conflictingConfigurationBuildError = exports.unresolvedGetLocaleBuildError = exports.unresolvedLoadTranslationsBuildError = exports.unresolvedLoadDictionaryBuildError = exports.unresolvedCustomLoadTranslationsError = exports.unresolvedCustomLoadDictionaryError = exports.dictionaryDisabledError = exports.createDictionarySubsetError = exports.devApiKeyIncludedInProductionError = exports.createRequiredPrefixError = exports.createDictionaryTranslationError = exports.createStringTranslationError = exports.customLoadDictionaryWarning = exports.customLoadTranslationsError = exports.remoteTranslationsError = void 0;
|
|
5
5
|
var generaltranslation_1 = require("generaltranslation");
|
|
6
6
|
exports.remoteTranslationsError = 'gt-next Error: fetching remote translation.';
|
|
7
7
|
var customLoadTranslationsError = function (locale) {
|
|
@@ -52,14 +52,6 @@ var conflictingConfigurationBuildError = function (conflicts) {
|
|
|
52
52
|
};
|
|
53
53
|
exports.conflictingConfigurationBuildError = conflictingConfigurationBuildError;
|
|
54
54
|
exports.unsupportedGetLocalePathBuildError = 'gt-next Error: custom getLocale() function is not currently supported.';
|
|
55
|
-
var createCustomHookWithoutUseClientError = function (hookName) {
|
|
56
|
-
return "gt-next Error: You're importing a component that needs `".concat(hookName, "`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `\"use client\"` directive. ");
|
|
57
|
-
};
|
|
58
|
-
exports.createCustomHookWithoutUseClientError = createCustomHookWithoutUseClientError;
|
|
59
|
-
var createCustomComponentWithoutUseClientError = function (componentName) {
|
|
60
|
-
return "gt-next Error: You're importing a component that needs `".concat(componentName, "`. This React component only works in a client component. To fix, mark the file (or its parent) with the `\"use client\"` directive. ");
|
|
61
|
-
};
|
|
62
|
-
exports.createCustomComponentWithoutUseClientError = createCustomComponentWithoutUseClientError;
|
|
63
55
|
exports.typesFileError = "gt-next Error: There is no scenario in which you should be seeing this error.";
|
|
64
56
|
exports.gtProviderUseClientError = "You're attempting to import the Next.js <GTProvider> in a client component. " +
|
|
65
57
|
"Are you sure you want to do this? It's better to import <GTProvider> in a file not marked 'use client' so that it can fetch translations on the server. " +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createErrors.js","sourceRoot":"","sources":["../../src/errors/createErrors.ts"],"names":[],"mappings":";AAAA,sBAAsB;;;AAEtB,yDAAyD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AAuE;IACvE,oEAAoE;IACpE,iHAAiH,CAAC;AAEvG,QAAA,yBAAyB,GACpC,uEAAuE;IACvE,uFAAuF,CAAC;AAE7E,QAAA,gCAAgC,GAAG,yCAAyC,CAAC;AAE7E,QAAA,yBAAyB,GAAG,oLAAoL,CAAC;AAEvN,IAAM,0BAA0B,GAAG,UAAC,OAAiB;IAC1D,OAAA,0EAAmE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAG;AAAxF,CAAwF,CAAC;AAD9E,QAAA,0BAA0B,8BACoD"}
|
package/dist/index.client.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Var, Num, Currency, DateTime, T, Branch, Plural, LocaleSelector, useGT, useTranslations, useLocale, useLocales,
|
|
1
|
+
import { Var, Num, Currency, DateTime, T, Branch, Plural, LocaleSelector, useGT, useTranslations, useLocale, useLocales, useDefaultLocale, useGTClass, useLocaleProperties } from 'gt-react/client';
|
|
2
2
|
export declare function GTProvider(): void;
|
|
3
3
|
export declare function Tx(): void;
|
|
4
4
|
export { T, Var, Num, Currency, DateTime, Branch, Plural, LocaleSelector, useGT, useTranslations,
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated Use useTranslations instead
|
|
7
7
|
*/
|
|
8
|
-
useTranslations as useDict, useLocale, useLocales,
|
|
8
|
+
useTranslations as useDict, useLocale, useLocales, useDefaultLocale, useGTClass, useLocaleProperties, };
|
|
9
9
|
//# sourceMappingURL=index.client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,CAAC,EACD,MAAM,EACN,MAAM,EACN,cAAc,EACd,KAAK,EACL,eAAe,EACf,SAAS,EACT,UAAU,EACV,
|
|
1
|
+
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,CAAC,EACD,MAAM,EACN,MAAM,EACN,cAAc,EACd,KAAK,EACL,eAAe,EACf,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AAOzB,wBAAgB,UAAU,SAEzB;AAGD,wBAAgB,EAAE,SAEjB;AAED,OAAO,EACL,CAAC,EACD,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,MAAM,EACN,cAAc,EACd,KAAK,EACL,eAAe;AACf;;GAEG;AACH,eAAe,IAAI,OAAO,EAC1B,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,mBAAmB,GACpB,CAAC"}
|
package/dist/index.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.useLocaleProperties = exports.useGTClass = exports.
|
|
4
|
+
exports.useLocaleProperties = exports.useGTClass = exports.useDefaultLocale = exports.useLocales = exports.useLocale = exports.useDict = exports.useTranslations = exports.useGT = exports.LocaleSelector = exports.Plural = exports.Branch = exports.DateTime = exports.Currency = exports.Num = exports.Var = exports.T = void 0;
|
|
5
5
|
exports.GTProvider = GTProvider;
|
|
6
6
|
exports.Tx = Tx;
|
|
7
7
|
var client_1 = require("gt-react/client");
|
|
@@ -18,9 +18,7 @@ Object.defineProperty(exports, "useTranslations", { enumerable: true, get: funct
|
|
|
18
18
|
Object.defineProperty(exports, "useDict", { enumerable: true, get: function () { return client_1.useTranslations; } });
|
|
19
19
|
Object.defineProperty(exports, "useLocale", { enumerable: true, get: function () { return client_1.useLocale; } });
|
|
20
20
|
Object.defineProperty(exports, "useLocales", { enumerable: true, get: function () { return client_1.useLocales; } });
|
|
21
|
-
Object.defineProperty(exports, "useSetLocale", { enumerable: true, get: function () { return client_1.useSetLocale; } });
|
|
22
21
|
Object.defineProperty(exports, "useDefaultLocale", { enumerable: true, get: function () { return client_1.useDefaultLocale; } });
|
|
23
|
-
Object.defineProperty(exports, "useLocaleSelector", { enumerable: true, get: function () { return client_1.useLocaleSelector; } });
|
|
24
22
|
Object.defineProperty(exports, "useGTClass", { enumerable: true, get: function () { return client_1.useGTClass; } });
|
|
25
23
|
Object.defineProperty(exports, "useLocaleProperties", { enumerable: true, get: function () { return client_1.useLocaleProperties; } });
|
|
26
24
|
var createErrors_1 = require("./errors/createErrors");
|
package/dist/index.client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.js","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;
|
|
1
|
+
{"version":3,"file":"index.client.js","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAyBb,gCAEC;AAGD,gBAEC;AA9BD,0CAgByB;AAkBvB,oFAjCA,YAAG,OAiCA;AACH,oFAjCA,YAAG,OAiCA;AACH,yFAjCA,iBAAQ,OAiCA;AACR,yFAjCA,iBAAQ,OAiCA;AAJR,kFA5BA,UAAC,OA4BA;AAKD,uFAhCA,eAAM,OAgCA;AACN,uFAhCA,eAAM,OAgCA;AACN,+FAhCA,uBAAc,OAgCA;AACd,sFAhCA,cAAK,OAgCA;AACL,gGAhCA,wBAAe,OAgCA;AAII,wFApCnB,wBAAe,OAoCW;AAC1B,0FApCA,kBAAS,OAoCA;AACT,2FApCA,mBAAU,OAoCA;AACV,iGApCA,yBAAgB,OAoCA;AAChB,2FApCA,mBAAU,OAoCA;AACV,oGApCA,4BAAmB,OAoCA;AAlCrB,sDAG+B;AAE/B,0CAA0C;AAC1C,SAAgB,UAAU;IACxB,MAAM,IAAI,KAAK,CAAC,uCAAwB,CAAC,CAAC;AAC5C,CAAC;AAED,kCAAkC;AAClC,SAAgB,EAAE;IAChB,MAAM,IAAI,KAAK,CAAC,+BAAgB,CAAC,CAAC;AACpC,CAAC"}
|
package/dist/index.server.d.ts
CHANGED
|
@@ -7,16 +7,13 @@ import Branch from './branches/Branch';
|
|
|
7
7
|
import Plural from './branches/Plural';
|
|
8
8
|
import GTProvider from './provider/GTProvider';
|
|
9
9
|
import { Tx } from './server';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
export declare function
|
|
15
|
-
export declare function
|
|
16
|
-
export declare function useLocales():
|
|
17
|
-
export declare function
|
|
18
|
-
export
|
|
19
|
-
export declare function useLocaleSelector(): void;
|
|
20
|
-
export declare function LocaleSelector(): void;
|
|
21
|
-
export { GTProvider, T, Tx, Var, Num, Currency, DateTime, Branch, Plural };
|
|
10
|
+
import { useGT } from './server-dir/buildtime/getGT';
|
|
11
|
+
import { useTranslations } from './server-dir/buildtime/getTranslations';
|
|
12
|
+
import { useLocale } from './request/getLocale';
|
|
13
|
+
export { LocaleSelector } from './index.client';
|
|
14
|
+
export declare function useGTClass(): import("generaltranslation").GT;
|
|
15
|
+
export declare function useLocaleProperties(locale: string): import("generaltranslation/types").LocaleProperties;
|
|
16
|
+
export declare function useLocales(): string[];
|
|
17
|
+
export declare function useDefaultLocale(): string;
|
|
18
|
+
export { GTProvider, T, Tx, Var, Num, Currency, DateTime, Branch, Plural, useGT, useTranslations, useTranslations as useDict, useLocale, };
|
|
22
19
|
//# sourceMappingURL=index.server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":"AAAA,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,CAAC,MAAM,0BAA0B,CAAC;AACzC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":"AAAA,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,CAAC,MAAM,0BAA0B,CAAC;AACzC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,wBAAgB,UAAU,oCAEzB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,uDAEjD;AAED,wBAAgB,UAAU,aAEzB;AAED,wBAAgB,gBAAgB,WAE/B;AAED,OAAO,EACL,UAAU,EACV,CAAC,EACD,EAAE,EACF,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACL,eAAe,EACf,eAAe,IAAI,OAAO,EAC1B,SAAS,GACV,CAAC"}
|
package/dist/index.server.js
CHANGED
|
@@ -3,18 +3,11 @@ 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.Plural = exports.Branch = exports.DateTime = exports.Currency = exports.Num = exports.Var = exports.Tx = exports.T = exports.GTProvider = void 0;
|
|
7
|
-
exports.useGT = useGT;
|
|
8
|
-
exports.useTranslations = useTranslations;
|
|
9
|
-
exports.useDict = useDict;
|
|
6
|
+
exports.useLocale = exports.useDict = exports.useTranslations = exports.useGT = exports.Plural = exports.Branch = exports.DateTime = exports.Currency = exports.Num = exports.Var = exports.Tx = exports.T = exports.GTProvider = exports.LocaleSelector = void 0;
|
|
10
7
|
exports.useGTClass = useGTClass;
|
|
11
8
|
exports.useLocaleProperties = useLocaleProperties;
|
|
12
|
-
exports.useLocale = useLocale;
|
|
13
9
|
exports.useLocales = useLocales;
|
|
14
|
-
exports.useSetLocale = useSetLocale;
|
|
15
10
|
exports.useDefaultLocale = useDefaultLocale;
|
|
16
|
-
exports.useLocaleSelector = useLocaleSelector;
|
|
17
|
-
exports.LocaleSelector = LocaleSelector;
|
|
18
11
|
var Var_1 = __importDefault(require("./variables/Var"));
|
|
19
12
|
exports.Var = Var_1.default;
|
|
20
13
|
var Num_1 = __importDefault(require("./variables/Num"));
|
|
@@ -33,38 +26,26 @@ var GTProvider_1 = __importDefault(require("./provider/GTProvider"));
|
|
|
33
26
|
exports.GTProvider = GTProvider_1.default;
|
|
34
27
|
var server_1 = require("./server");
|
|
35
28
|
Object.defineProperty(exports, "Tx", { enumerable: true, get: function () { return server_1.Tx; } });
|
|
36
|
-
var
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
29
|
+
var getGT_1 = require("./server-dir/buildtime/getGT");
|
|
30
|
+
Object.defineProperty(exports, "useGT", { enumerable: true, get: function () { return getGT_1.useGT; } });
|
|
31
|
+
var getTranslations_1 = require("./server-dir/buildtime/getTranslations");
|
|
32
|
+
Object.defineProperty(exports, "useTranslations", { enumerable: true, get: function () { return getTranslations_1.useTranslations; } });
|
|
33
|
+
Object.defineProperty(exports, "useDict", { enumerable: true, get: function () { return getTranslations_1.useTranslations; } });
|
|
34
|
+
var getLocale_1 = require("./request/getLocale");
|
|
35
|
+
Object.defineProperty(exports, "useLocale", { enumerable: true, get: function () { return getLocale_1.useLocale; } });
|
|
36
|
+
var getI18NConfig_1 = __importDefault(require("./config-dir/getI18NConfig"));
|
|
37
|
+
var index_client_1 = require("./index.client");
|
|
38
|
+
Object.defineProperty(exports, "LocaleSelector", { enumerable: true, get: function () { return index_client_1.LocaleSelector; } });
|
|
46
39
|
function useGTClass() {
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
function useLocaleProperties() {
|
|
50
|
-
throw new Error((0, createErrors_1.createCustomHookWithoutUseClientError)('useLocaleProperties'));
|
|
40
|
+
return (0, getI18NConfig_1.default)().getGTClass();
|
|
51
41
|
}
|
|
52
|
-
function
|
|
53
|
-
|
|
42
|
+
function useLocaleProperties(locale) {
|
|
43
|
+
return useGTClass().getLocaleProperties(locale);
|
|
54
44
|
}
|
|
55
45
|
function useLocales() {
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
function useSetLocale() {
|
|
59
|
-
throw new Error((0, createErrors_1.createCustomHookWithoutUseClientError)('useSetLocale'));
|
|
46
|
+
return (0, getI18NConfig_1.default)().getLocales();
|
|
60
47
|
}
|
|
61
48
|
function useDefaultLocale() {
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
function useLocaleSelector() {
|
|
65
|
-
throw new Error((0, createErrors_1.createCustomHookWithoutUseClientError)('useLocaleSelector'));
|
|
66
|
-
}
|
|
67
|
-
function LocaleSelector() {
|
|
68
|
-
throw new Error((0, createErrors_1.createCustomComponentWithoutUseClientError)('LocaleSelector'));
|
|
49
|
+
return (0, getI18NConfig_1.default)().getDefaultLocale();
|
|
69
50
|
}
|
|
70
51
|
//# sourceMappingURL=index.server.js.map
|
package/dist/index.server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.js","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.server.js","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":";;;;;;AAgBA,gCAEC;AAED,kDAEC;AAED,gCAEC;AAED,4CAEC;AA9BD,wDAAkC;AAoChC,cApCK,aAAG,CAoCL;AAnCL,wDAAkC;AAoChC,cApCK,aAAG,CAoCL;AAnCL,kEAA4C;AAoC1C,mBApCK,kBAAQ,CAoCL;AAnCV,kEAA4C;AAoC1C,mBApCK,kBAAQ,CAoCL;AAnCV,+DAAyC;AA8BvC,YA9BK,WAAC,CA8BL;AA7BH,6DAAuC;AAmCrC,iBAnCK,gBAAM,CAmCL;AAlCR,6DAAuC;AAmCrC,iBAnCK,gBAAM,CAmCL;AAlCR,qEAA+C;AA0B7C,qBA1BK,oBAAU,CA0BL;AAzBZ,mCAA8B;AA2B5B,mFA3BO,WAAE,OA2BP;AA1BJ,sDAAqD;AAiCnD,sFAjCO,aAAK,OAiCP;AAhCP,0EAAyE;AAiCvE,gGAjCO,iCAAe,OAiCP;AACI,wFAlCZ,iCAAe,OAkCI;AAjC5B,iDAAgD;AAkC9C,0FAlCO,qBAAS,OAkCP;AAjCX,6EAAuD;AAEvD,+CAAgD;AAAvC,8GAAA,cAAc,OAAA;AAEvB,SAAgB,UAAU;IACxB,OAAO,IAAA,uBAAa,GAAE,CAAC,UAAU,EAAE,CAAC;AACtC,CAAC;AAED,SAAgB,mBAAmB,CAAC,MAAc;IAChD,OAAO,UAAU,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAClD,CAAC;AAED,SAAgB,UAAU;IACxB,OAAO,IAAA,uBAAa,GAAE,CAAC,UAAU,EAAE,CAAC;AACtC,CAAC;AAED,SAAgB,gBAAgB;IAC9B,OAAO,IAAA,uBAAa,GAAE,CAAC,gBAAgB,EAAE,CAAC;AAC5C,CAAC"}
|
package/dist/index.types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _GTProvider from './provider/GTProvider';
|
|
2
2
|
import _T from './server-dir/buildtime/T';
|
|
3
|
-
import { useGT as _useGT, useTranslations as _useTranslations, useLocale as _useLocale, useLocales as _useLocales,
|
|
3
|
+
import { useGT as _useGT, useTranslations as _useTranslations, useLocale as _useLocale, useLocales as _useLocales, useDefaultLocale as _useDefaultLocale, useGTClass as _useGTClass, useLocaleProperties as _useLocaleProperties, Currency as _Currency, DateTime as _DateTime, Num as _Num, Var as _Var, Branch as _Branch, Plural as _Plural, LocaleSelector as _LocaleSelector } from 'gt-react/client';
|
|
4
4
|
/**
|
|
5
5
|
* Provides General Translation context to its children, which can then access `useGT`, `useLocale`, and `useDefaultLocale`.
|
|
6
6
|
*
|
|
@@ -152,9 +152,7 @@ export declare const Branch: typeof _Branch;
|
|
|
152
152
|
*
|
|
153
153
|
* @param {any} [children] - Fallback content to render if no matching plural branch is found.
|
|
154
154
|
* @param {number} [n] - The number used to determine the plural form. This is required for pluralization to work.
|
|
155
|
-
* @param {string} [locale] - Optional parameter, the locale to use for pluralization format.
|
|
156
|
-
* in <GTProvider> will automatically populate this value as user's current locale. If not provided and not wrapped in
|
|
157
|
-
* <GTProvider>, will use the library default locale (en-US).
|
|
155
|
+
* @param {string} [locale] - Optional parameter, the locale to use for pluralization format.
|
|
158
156
|
* @param {...{[key: string]: any}} [branches] - A spread object containing possible plural branches, typically including `one` for singular
|
|
159
157
|
* and `other` for plural forms, but it may vary depending on the locale.
|
|
160
158
|
* @returns {React.JSX.Element} The rendered content corresponding to the plural form of `n`, or the fallback content.
|
|
@@ -169,9 +167,9 @@ export declare const Plural: typeof _Plural;
|
|
|
169
167
|
*/
|
|
170
168
|
export declare const LocaleSelector: typeof _LocaleSelector;
|
|
171
169
|
/**
|
|
172
|
-
*
|
|
170
|
+
* Returns the string translation function `t`.
|
|
173
171
|
*
|
|
174
|
-
* @returns {Function} A translation function that accepts
|
|
172
|
+
* @returns {Function} A translation function that accepts an ICU format string and returns that ICU format string translated.
|
|
175
173
|
*
|
|
176
174
|
* @example
|
|
177
175
|
* const t = useGT();
|
|
@@ -187,7 +185,7 @@ export declare const LocaleSelector: typeof _LocaleSelector;
|
|
|
187
185
|
*/
|
|
188
186
|
export declare const useGT: typeof _useGT;
|
|
189
187
|
/**
|
|
190
|
-
*
|
|
188
|
+
* Returns the dictionary access function `t`.
|
|
191
189
|
*
|
|
192
190
|
* @param {string} [id] - Optional prefix to prepend to the translation keys.
|
|
193
191
|
* @returns {Function} A translation function that accepts a key string and returns the translated value.
|
|
@@ -201,24 +199,24 @@ export declare const useGT: typeof _useGT;
|
|
|
201
199
|
*/
|
|
202
200
|
export declare const useTranslations: typeof _useTranslations;
|
|
203
201
|
/**
|
|
204
|
-
*
|
|
205
|
-
* @deprecated Use useTranslations instead
|
|
202
|
+
* Returns the dictionary access function `d`.
|
|
203
|
+
* @deprecated Use the equivalent `useTranslations` function instead. `useDict` is supported as an alias.
|
|
206
204
|
*
|
|
207
205
|
* @param {string} [id] - Optional prefix to prepend to the translation keys.
|
|
208
206
|
* @returns {Function} A translation function that accepts a key string and returns the translated value.
|
|
209
207
|
*
|
|
210
208
|
* @example
|
|
211
209
|
* const d = useDict('user');
|
|
212
|
-
* console.log(
|
|
210
|
+
* console.log(d('name')); // Translates item 'user.name'
|
|
213
211
|
*
|
|
214
212
|
* const d = useDict();
|
|
215
|
-
* console.log(
|
|
213
|
+
* console.log(d('hello')); // Translates item 'hello'
|
|
216
214
|
*/
|
|
217
215
|
export declare const useDict: typeof _useTranslations;
|
|
218
216
|
/**
|
|
219
|
-
*
|
|
217
|
+
* Returns the user's current locale.
|
|
220
218
|
*
|
|
221
|
-
* @returns {string}
|
|
219
|
+
* @returns {string} BCP 47 locale tag, e.g., 'en-US'.
|
|
222
220
|
*
|
|
223
221
|
* @example
|
|
224
222
|
* const locale = useLocale();
|
|
@@ -226,9 +224,9 @@ export declare const useDict: typeof _useTranslations;
|
|
|
226
224
|
*/
|
|
227
225
|
export declare const useLocale: typeof _useLocale;
|
|
228
226
|
/**
|
|
229
|
-
*
|
|
227
|
+
* Returns the user's list of supported locales.
|
|
230
228
|
*
|
|
231
|
-
* @returns {string[]}
|
|
229
|
+
* @returns {string[]} List of BCP 47 locale tags, e.g., ['en-US', 'fr', 'jp'].
|
|
232
230
|
*
|
|
233
231
|
* @example
|
|
234
232
|
* const locales = useLocales();
|
|
@@ -236,34 +234,17 @@ export declare const useLocale: typeof _useLocale;
|
|
|
236
234
|
*/
|
|
237
235
|
export declare const useLocales: typeof _useLocales;
|
|
238
236
|
/**
|
|
239
|
-
*
|
|
240
|
-
* If the locale passed is not supported, will fallback on current locale and then defaultLocale if necessary.
|
|
241
|
-
* @note Unless a locale has explicitly been passed to the `<GTProvider>`, this will override the user's browser preferences. The locale passed to `<GTProvider>` will always take priority.
|
|
242
|
-
*
|
|
243
|
-
* @returns {(locale: string) => void} A function that sets the user's locale.
|
|
244
|
-
*
|
|
245
|
-
* @example
|
|
246
|
-
* setLocale('en-US');
|
|
247
|
-
*/
|
|
248
|
-
export declare const useSetLocale: typeof _useSetLocale;
|
|
249
|
-
/**
|
|
250
|
-
* Retrieves the application's default locale from the `<GTProvider>` context.
|
|
237
|
+
* Returns the application's default locale.
|
|
251
238
|
*
|
|
252
|
-
* If no default locale is
|
|
239
|
+
* If no default locale is provided, it defaults to 'en'.
|
|
253
240
|
*
|
|
254
|
-
* @returns {string}
|
|
241
|
+
* @returns {string} A BCP 47 locale tag, e.g., 'en-US'.
|
|
255
242
|
*
|
|
256
243
|
* @example
|
|
257
244
|
* const locale = useDefaultLocale();
|
|
258
245
|
* console.log(locale); // 'en-US'
|
|
259
246
|
*/
|
|
260
247
|
export declare const useDefaultLocale: typeof _useDefaultLocale;
|
|
261
|
-
/**
|
|
262
|
-
* Gets the list of properties for using a locale selector.
|
|
263
|
-
* @param locales an optional list of locales to use for the drop down. These locales must be a subset of the locales provided by the `<GTProvider>` context. When not provided, the list of locales from the `<GTProvider>` context is used.
|
|
264
|
-
* @returns {object} The locale, locales, and setLocale function.
|
|
265
|
-
*/
|
|
266
|
-
export declare const useLocaleSelector: typeof _useLocaleSelector;
|
|
267
248
|
/**
|
|
268
249
|
* Returns the configured GT class instance.
|
|
269
250
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.types.d.ts","sourceRoot":"","sources":["../src/index.types.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAC1C,OAAO,EACL,KAAK,IAAI,MAAM,EACf,eAAe,IAAI,gBAAgB,EACnC,SAAS,IAAI,UAAU,EACvB,UAAU,IAAI,WAAW,EACzB,
|
|
1
|
+
{"version":3,"file":"index.types.d.ts","sourceRoot":"","sources":["../src/index.types.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAC1C,OAAO,EACL,KAAK,IAAI,MAAM,EACf,eAAe,IAAI,gBAAgB,EACnC,SAAS,IAAI,UAAU,EACvB,UAAU,IAAI,WAAW,EACzB,gBAAgB,IAAI,iBAAiB,EACrC,UAAU,IAAI,WAAW,EACzB,mBAAmB,IAAI,oBAAoB,EAC3C,QAAQ,IAAI,SAAS,EACrB,QAAQ,IAAI,SAAS,EACrB,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,MAAM,IAAI,OAAO,EACjB,MAAM,IAAI,OAAO,EACjB,cAAc,IAAI,eAAe,EAClC,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,EAAE,OAAO,WAE/B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,CAAC,EAAE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