gt-next 5.2.36 → 5.2.37
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 +9 -0
- package/dist/client.d.ts +2 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/errors/createErrors.d.ts +3 -0
- package/dist/errors/createErrors.d.ts.map +1 -1
- package/dist/errors/createErrors.js +8 -1
- package/dist/errors/createErrors.js.map +1 -1
- package/dist/index.client.d.ts +8 -5
- package/dist/index.client.d.ts.map +1 -1
- package/dist/index.client.js +19 -10
- package/dist/index.client.js.map +1 -1
- package/dist/index.server.d.ts +1 -0
- package/dist/index.server.d.ts.map +1 -1
- package/dist/index.server.js +13 -1
- package/dist/index.server.js.map +1 -1
- package/dist/index.types.d.ts +288 -0
- package/dist/index.types.d.ts.map +1 -0
- package/dist/index.types.js +353 -0
- package/dist/index.types.js.map +1 -0
- package/dist/provider/GTProvider.d.ts +2 -15
- package/dist/provider/GTProvider.d.ts.map +1 -1
- package/dist/provider/GTProvider.js +0 -9
- package/dist/provider/GTProvider.js.map +1 -1
- package/dist/server-dir/runtime/_Tx.d.ts +2 -36
- package/dist/server-dir/runtime/_Tx.d.ts.map +1 -1
- package/dist/server-dir/runtime/_Tx.js +0 -30
- package/dist/server-dir/runtime/_Tx.js.map +1 -1
- package/dist/utils/types.d.ts +13 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +3 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/variables/Currency.d.ts +0 -17
- package/dist/variables/Currency.d.ts.map +1 -1
- package/dist/variables/Currency.js +0 -17
- package/dist/variables/Currency.js.map +1 -1
- package/dist/variables/DateTime.d.ts +0 -15
- package/dist/variables/DateTime.d.ts.map +1 -1
- package/dist/variables/DateTime.js +0 -15
- package/dist/variables/DateTime.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# gt-next
|
|
2
2
|
|
|
3
|
+
## 5.2.37
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`de17003`](https://github.com/generaltranslation/gt/commit/de170039e51383c8c8f3f59d5d94e93e6ccedeb9)]:
|
|
10
|
+
- gt-react@9.2.27
|
|
11
|
+
|
|
3
12
|
## 5.2.36
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { T, useGT, useLocale, useDefaultLocale, LocaleSelector, GTProvider, useLocales, useSetLocale, useLocaleSelector, Var, Currency, DateTime, Num, Plural, Branch, useLocaleProperties, useGTClass, useTranslations } from 'gt-react/client';
|
|
2
|
-
export {
|
|
2
|
+
export { useGT, useTranslations,
|
|
3
3
|
/**
|
|
4
4
|
* @deprecated Use useTranslations instead
|
|
5
5
|
*/
|
|
6
|
-
useTranslations as useDict,
|
|
6
|
+
useTranslations as useDict, useLocale, useLocales, useSetLocale, useDefaultLocale, useLocaleSelector, useGTClass, useLocaleProperties, GTProvider as GTClientProvider, T, Var, Currency, DateTime, Num, Plural, Branch, LocaleSelector, };
|
|
7
7
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,CAAC,EACD,KAAK,EACL,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,EACN,mBAAmB,EACnB,UAAU,EACV,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,CAAC,EACD,KAAK,EACL,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,EACN,mBAAmB,EACnB,UAAU,EACV,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAEL,KAAK,EACL,eAAe;AACf;;GAEG;AACH,eAAe,IAAI,OAAO,EAC1B,SAAS,EACT,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,mBAAmB,EAGnB,UAAU,IAAI,gBAAgB,EAC9B,CAAC,EACD,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,MAAM,EACN,MAAM,EACN,cAAc,GACf,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.
|
|
4
|
+
exports.LocaleSelector = exports.Branch = exports.Plural = exports.Num = exports.DateTime = exports.Currency = exports.Var = exports.T = exports.GTClientProvider = exports.useLocaleProperties = exports.useGTClass = exports.useLocaleSelector = exports.useDefaultLocale = exports.useSetLocale = exports.useLocales = exports.useLocale = exports.useDict = exports.useTranslations = exports.useGT = 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; } });
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AACb,0CAmByB;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AACb,0CAmByB;AAoBvB,kFAtCA,UAAC,OAsCA;AAhBD,sFArBA,cAAK,OAqBA;AAML,0FA1BA,kBAAS,OA0BA;AAGT,iGA5BA,yBAAgB,OA4BA;AAchB,+FAzCA,uBAAc,OAyCA;AARA,iGAhCd,mBAAU,OAgCoB;AAR9B,2FAvBA,mBAAU,OAuBA;AACV,6FAvBA,qBAAY,OAuBA;AAEZ,kGAxBA,0BAAiB,OAwBA;AAOjB,oFA9BA,YAAG,OA8BA;AACH,yFA9BA,iBAAQ,OA8BA;AACR,yFA9BA,iBAAQ,OA8BA;AACR,oFA9BA,YAAG,OA8BA;AACH,uFA9BA,eAAM,OA8BA;AACN,uFA9BA,eAAM,OA8BA;AAVN,oGAnBA,4BAAmB,OAmBA;AADnB,2FAjBA,mBAAU,OAiBA;AAVV,gGANA,wBAAe,OAMA;AAII,wFAVnB,wBAAe,OAUW"}
|
|
@@ -14,6 +14,9 @@ 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 typesFileError = "gt-next Error: There is no scenario in which you should be seeing this error.";
|
|
18
|
+
export declare const gtProviderUseClientError: string;
|
|
19
|
+
export declare const txUseClientError: string;
|
|
17
20
|
export declare const usingDefaultsWarning = "gt-next: Unable to access gt-next configuration. Using defaults.";
|
|
18
21
|
export declare const createNoEntryFoundWarning: (id: string) => string;
|
|
19
22
|
export declare const createInvalidDictionaryEntryWarning: (id: string) => 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;
|
|
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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Ac,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.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;
|
|
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,6 +52,13 @@ 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
|
+
exports.typesFileError = "gt-next Error: There is no scenario in which you should be seeing this error.";
|
|
56
|
+
exports.gtProviderUseClientError = "You're attempting to import the Next.js <GTProvider> in a client component. " +
|
|
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. " +
|
|
58
|
+
"If you really need to put <GTProvider> on the client, import <GTClientProvider> from 'gt-next/client' instead (discouraged when using the Next.js App Router).";
|
|
59
|
+
exports.txUseClientError = "You're attempting to use the <Tx> runtime translation component in a client component. " +
|
|
60
|
+
"This is currently unsupported. Please use <T> with variables, " +
|
|
61
|
+
"or make sure <Tx> rendered on the server only. ";
|
|
55
62
|
// ---- WARNINGS ---- //
|
|
56
63
|
exports.usingDefaultsWarning = 'gt-next: Unable to access gt-next configuration. Using defaults.';
|
|
57
64
|
var createNoEnt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,QAAA,oBAAoB,GAAG,kMAAkM,CAAC;AAE1N,QAAA,YAAY,GACvB,kFAAkF;IAClF,wHAAwH;IACxH,wDAAwD;IACxD,2FAA2F,CAAC;AAEjF,QAAA,iBAAiB,GAC5B,uEAAuE;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,6 +1,9 @@
|
|
|
1
|
-
import { Var, Num, Currency, DateTime, T, Branch, Plural } from 'gt-react/client';
|
|
2
|
-
export declare function GTProvider(
|
|
3
|
-
export declare function Tx(
|
|
4
|
-
export { T,
|
|
5
|
-
|
|
1
|
+
import { Var, Num, Currency, DateTime, T, Branch, Plural, LocaleSelector, useGT, useTranslations, useLocale, useLocales, useSetLocale, useDefaultLocale, useLocaleSelector, useGTClass, useLocaleProperties } from 'gt-react/client';
|
|
2
|
+
export declare function GTProvider(): void;
|
|
3
|
+
export declare function Tx(): void;
|
|
4
|
+
export { T, Var, Num, Currency, DateTime, Branch, Plural, LocaleSelector, useGT, useTranslations,
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use useTranslations instead
|
|
7
|
+
*/
|
|
8
|
+
useTranslations as useDict, useLocale, useLocales, useSetLocale, useDefaultLocale, useLocaleSelector, useGTClass, useLocaleProperties, };
|
|
6
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":"
|
|
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,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,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,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,mBAAmB,GACpB,CAAC"}
|
package/dist/index.client.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
'use client';
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Plural = exports.Branch = exports.DateTime = exports.Currency = exports.Num = exports.Var = exports.T = void 0;
|
|
4
|
+
exports.useLocaleProperties = exports.useGTClass = exports.useLocaleSelector = exports.useDefaultLocale = exports.useSetLocale = 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;
|
|
4
5
|
exports.GTProvider = GTProvider;
|
|
5
6
|
exports.Tx = Tx;
|
|
6
7
|
var client_1 = require("gt-react/client");
|
|
@@ -11,16 +12,24 @@ Object.defineProperty(exports, "DateTime", { enumerable: true, get: function ()
|
|
|
11
12
|
Object.defineProperty(exports, "T", { enumerable: true, get: function () { return client_1.T; } });
|
|
12
13
|
Object.defineProperty(exports, "Branch", { enumerable: true, get: function () { return client_1.Branch; } });
|
|
13
14
|
Object.defineProperty(exports, "Plural", { enumerable: true, get: function () { return client_1.Plural; } });
|
|
15
|
+
Object.defineProperty(exports, "LocaleSelector", { enumerable: true, get: function () { return client_1.LocaleSelector; } });
|
|
16
|
+
Object.defineProperty(exports, "useGT", { enumerable: true, get: function () { return client_1.useGT; } });
|
|
17
|
+
Object.defineProperty(exports, "useTranslations", { enumerable: true, get: function () { return client_1.useTranslations; } });
|
|
18
|
+
Object.defineProperty(exports, "useDict", { enumerable: true, get: function () { return client_1.useTranslations; } });
|
|
19
|
+
Object.defineProperty(exports, "useLocale", { enumerable: true, get: function () { return client_1.useLocale; } });
|
|
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
|
+
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
|
+
Object.defineProperty(exports, "useGTClass", { enumerable: true, get: function () { return client_1.useGTClass; } });
|
|
25
|
+
Object.defineProperty(exports, "useLocaleProperties", { enumerable: true, get: function () { return client_1.useLocaleProperties; } });
|
|
26
|
+
var createErrors_1 = require("./errors/createErrors");
|
|
14
27
|
// Mock <GTProvider> which throws an error
|
|
15
|
-
function GTProvider(
|
|
16
|
-
throw new Error(
|
|
17
|
-
"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. " +
|
|
18
|
-
"If you really need to put <GTProvider> on the client, import <GTClientProvider> from 'gt-next/client' instead (discouraged when using the Next.js App Router).");
|
|
28
|
+
function GTProvider() {
|
|
29
|
+
throw new Error(createErrors_1.gtProviderUseClientError);
|
|
19
30
|
}
|
|
20
|
-
// Mock <
|
|
21
|
-
function Tx(
|
|
22
|
-
throw new Error(
|
|
23
|
-
"This is currently unsupported. Please use <T> with variables, " +
|
|
24
|
-
"or make sure <Tx> rendered on the server only. ");
|
|
31
|
+
// Mock <Tx> which throws an error
|
|
32
|
+
function Tx() {
|
|
33
|
+
throw new Error(createErrors_1.txUseClientError);
|
|
25
34
|
}
|
|
26
35
|
//# sourceMappingURL=index.client.js.map
|
package/dist/index.client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.js","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.client.js","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AA2Bb,gCAEC;AAGD,gBAEC;AAhCD,0CAkByB;AAkBvB,oFAnCA,YAAG,OAmCA;AACH,oFAnCA,YAAG,OAmCA;AACH,yFAnCA,iBAAQ,OAmCA;AACR,yFAnCA,iBAAQ,OAmCA;AAJR,kFA9BA,UAAC,OA8BA;AAKD,uFAlCA,eAAM,OAkCA;AACN,uFAlCA,eAAM,OAkCA;AACN,+FAlCA,uBAAc,OAkCA;AACd,sFAlCA,cAAK,OAkCA;AACL,gGAlCA,wBAAe,OAkCA;AAII,wFAtCnB,wBAAe,OAsCW;AAC1B,0FAtCA,kBAAS,OAsCA;AACT,2FAtCA,mBAAU,OAsCA;AACV,6FAtCA,qBAAY,OAsCA;AACZ,iGAtCA,yBAAgB,OAsCA;AAChB,kGAtCA,0BAAiB,OAsCA;AACjB,2FAtCA,mBAAU,OAsCA;AACV,oGAtCA,4BAAmB,OAsCA;AApCrB,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,5 +7,6 @@ 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
|
+
export { useGT, useTranslations, useDict, useGTClass, useLocaleProperties, useLocale, useLocales, useSetLocale, useDefaultLocale, useLocaleSelector, LocaleSelector, } from './index.client';
|
|
10
11
|
export { GTProvider, T, Tx, Var, Num, Currency, DateTime, Branch, Plural };
|
|
11
12
|
//# 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,EACL,KAAK,EACL,eAAe,EACf,OAAO,EACP,UAAU,EACV,mBAAmB,EACnB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/index.server.js
CHANGED
|
@@ -3,7 +3,7 @@ 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;
|
|
6
|
+
exports.Plural = exports.Branch = exports.DateTime = exports.Currency = exports.Num = exports.Var = exports.Tx = exports.T = exports.GTProvider = exports.LocaleSelector = exports.useLocaleSelector = exports.useDefaultLocale = exports.useSetLocale = exports.useLocales = exports.useLocale = exports.useLocaleProperties = exports.useGTClass = exports.useDict = exports.useTranslations = exports.useGT = void 0;
|
|
7
7
|
var Var_1 = __importDefault(require("./variables/Var"));
|
|
8
8
|
exports.Var = Var_1.default;
|
|
9
9
|
var Num_1 = __importDefault(require("./variables/Num"));
|
|
@@ -22,4 +22,16 @@ var GTProvider_1 = __importDefault(require("./provider/GTProvider"));
|
|
|
22
22
|
exports.GTProvider = GTProvider_1.default;
|
|
23
23
|
var server_1 = require("./server");
|
|
24
24
|
Object.defineProperty(exports, "Tx", { enumerable: true, get: function () { return server_1.Tx; } });
|
|
25
|
+
var index_client_1 = require("./index.client");
|
|
26
|
+
Object.defineProperty(exports, "useGT", { enumerable: true, get: function () { return index_client_1.useGT; } });
|
|
27
|
+
Object.defineProperty(exports, "useTranslations", { enumerable: true, get: function () { return index_client_1.useTranslations; } });
|
|
28
|
+
Object.defineProperty(exports, "useDict", { enumerable: true, get: function () { return index_client_1.useDict; } });
|
|
29
|
+
Object.defineProperty(exports, "useGTClass", { enumerable: true, get: function () { return index_client_1.useGTClass; } });
|
|
30
|
+
Object.defineProperty(exports, "useLocaleProperties", { enumerable: true, get: function () { return index_client_1.useLocaleProperties; } });
|
|
31
|
+
Object.defineProperty(exports, "useLocale", { enumerable: true, get: function () { return index_client_1.useLocale; } });
|
|
32
|
+
Object.defineProperty(exports, "useLocales", { enumerable: true, get: function () { return index_client_1.useLocales; } });
|
|
33
|
+
Object.defineProperty(exports, "useSetLocale", { enumerable: true, get: function () { return index_client_1.useSetLocale; } });
|
|
34
|
+
Object.defineProperty(exports, "useDefaultLocale", { enumerable: true, get: function () { return index_client_1.useDefaultLocale; } });
|
|
35
|
+
Object.defineProperty(exports, "useLocaleSelector", { enumerable: true, get: function () { return index_client_1.useLocaleSelector; } });
|
|
36
|
+
Object.defineProperty(exports, "LocaleSelector", { enumerable: true, get: function () { return index_client_1.LocaleSelector; } });
|
|
25
37
|
//# 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":";;;;;;AAAA,wDAAkC;
|
|
1
|
+
{"version":3,"file":"index.server.js","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAkC;AAuBN,cAvBrB,aAAG,CAuBqB;AAtB/B,wDAAkC;AAsBD,cAtB1B,aAAG,CAsB0B;AArBpC,kEAA4C;AAqBN,mBArB/B,kBAAQ,CAqB+B;AApB9C,kEAA4C;AAoBI,mBApBzC,kBAAQ,CAoByC;AAnBxD,+DAAyC;AAmBpB,YAnBd,WAAC,CAmBc;AAlBtB,6DAAuC;AAkBmB,iBAlBnD,gBAAM,CAkBmD;AAjBhE,6DAAuC;AAiB2B,iBAjB3D,gBAAM,CAiB2D;AAhBxE,qEAA+C;AAgBtC,qBAhBF,oBAAU,CAgBE;AAfnB,mCAA8B;AAeN,mFAff,WAAE,OAee;AAd1B,+CAYwB;AAXtB,qGAAA,KAAK,OAAA;AACL,+GAAA,eAAe,OAAA;AACf,uGAAA,OAAO,OAAA;AACP,0GAAA,UAAU,OAAA;AACV,mHAAA,mBAAmB,OAAA;AACnB,yGAAA,SAAS,OAAA;AACT,0GAAA,UAAU,OAAA;AACV,4GAAA,YAAY,OAAA;AACZ,gHAAA,gBAAgB,OAAA;AAChB,iHAAA,iBAAiB,OAAA;AACjB,8GAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import _GTProvider from './provider/GTProvider';
|
|
2
|
+
import _T from './server-dir/buildtime/T';
|
|
3
|
+
import { useGT as _useGT, useTranslations as _useTranslations, useLocale as _useLocale, useLocales as _useLocales, useSetLocale as _useSetLocale, useDefaultLocale as _useDefaultLocale, useLocaleSelector as _useLocaleSelector, 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
|
+
/**
|
|
5
|
+
* Provides General Translation context to its children, which can then access `useGT`, `useLocale`, and `useDefaultLocale`.
|
|
6
|
+
*
|
|
7
|
+
* @param {React.ReactNode} children - The children components that will use the translation context.
|
|
8
|
+
* @param {string} id - ID of a nested dictionary, so that only a subset of a large dictionary needs to be sent to the client.
|
|
9
|
+
* @param {string} locale - The locale to use for the translation context.
|
|
10
|
+
*
|
|
11
|
+
* @returns {JSX.Element} The provider component for General Translation context.
|
|
12
|
+
*/
|
|
13
|
+
export declare const GTProvider: typeof _GTProvider;
|
|
14
|
+
/**
|
|
15
|
+
* Build-time translation component that renders its children in the user's given locale.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```jsx
|
|
19
|
+
* // Basic usage:
|
|
20
|
+
* <T id="welcome_message">
|
|
21
|
+
* Hello, <Var>{name}</Var>!
|
|
22
|
+
* </T>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```jsx
|
|
27
|
+
* // Translating a plural
|
|
28
|
+
* <T id="item_count">
|
|
29
|
+
* <Plural n={3} singular={<>You have <Num children={n}/> item.</>}>
|
|
30
|
+
* You have <Num children={n}/> items.
|
|
31
|
+
* </Plural>
|
|
32
|
+
* </T>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @param {React.ReactNode} children - The content to be translated or displayed.
|
|
36
|
+
* @param {string} [id] - Optional identifier for the translation string. If not provided, a hash will be generated from the content.
|
|
37
|
+
* @param {any} [context] - Additional context for translation key generation.
|
|
38
|
+
*
|
|
39
|
+
* @returns {JSX.Element} The rendered translation or fallback content based on the provided configuration.
|
|
40
|
+
*
|
|
41
|
+
* @throws {Error} If a plural translation is requested but the `n` option is not provided.
|
|
42
|
+
*/
|
|
43
|
+
export declare const T: typeof _T;
|
|
44
|
+
/**
|
|
45
|
+
* The `<Currency>` component renders a formatted currency string, allowing customization of name, default value, currency type, and formatting options.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```jsx
|
|
49
|
+
* <Currency
|
|
50
|
+
* currency="USD"
|
|
51
|
+
* >
|
|
52
|
+
* 1000
|
|
53
|
+
* </Currency>
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @param {any} [children] - Optional content to render inside the currency component.
|
|
57
|
+
* @param {string} [currency] - The currency type (e.g., USD, EUR, etc.).
|
|
58
|
+
* @param {Intl.NumberFormatOptions} [options] - Optional formatting options to customize how the currency is displayed.
|
|
59
|
+
* @returns {React.JSX.Element} The formatted currency component.
|
|
60
|
+
*/
|
|
61
|
+
export declare const Currency: typeof _Currency;
|
|
62
|
+
/**
|
|
63
|
+
* The `<DateTime>` component renders a formatted date or time string, allowing customization of the name, default value, and formatting options.
|
|
64
|
+
* It utilizes the current locale and optional format settings to display the date.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```jsx
|
|
68
|
+
* <DateTime>
|
|
69
|
+
* {new Date()}
|
|
70
|
+
* </DateTime>
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @param {any} [children] - Optional content (typically a date) to render inside the component.
|
|
74
|
+
* @param {Intl.DateTimeFormatOptions} [options={}] - Optional formatting options for the date, following `Intl.DateTimeFormatOptions` specifications.
|
|
75
|
+
* @returns {Promise<React.JSX.Element>} The formatted date or time component.
|
|
76
|
+
*/
|
|
77
|
+
export declare const DateTime: typeof _DateTime;
|
|
78
|
+
/**
|
|
79
|
+
* The `<Num>` component renders a formatted number string, allowing customization of the name, default value, and formatting options.
|
|
80
|
+
* It formats the number according to the current locale and optionally passed formatting options.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```jsx
|
|
84
|
+
* <Num
|
|
85
|
+
* options={{ style: "decimal", maximumFractionDigits: 2 }}
|
|
86
|
+
* >
|
|
87
|
+
* 1000
|
|
88
|
+
* </Num>
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @param {any} [children] - Optional content (typically a number) to render inside the component.
|
|
92
|
+
* @param {Intl.NumberFormatOptions} [options={}] - Optional formatting options for the number, following `Intl.NumberFormatOptions` specifications.
|
|
93
|
+
* @returns {Promise<React.JSX.Element>} The formatted number component.
|
|
94
|
+
*/
|
|
95
|
+
export declare const Num: typeof _Num;
|
|
96
|
+
/**
|
|
97
|
+
* The `<Var>` component renders a variable value, which can either be passed as `children` or a `value`.
|
|
98
|
+
* If `children` is provided, it will be used; otherwise, the `value` is rendered.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```jsx
|
|
102
|
+
* <Var>
|
|
103
|
+
* John
|
|
104
|
+
* </Var>
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @param {any} [children] - The content to render inside the component. If provided, it will take precedence over `value`.
|
|
108
|
+
* @returns {React.JSX.Element} The rendered variable component with either `children` or `value`.
|
|
109
|
+
*/
|
|
110
|
+
export declare const Var: typeof _Var;
|
|
111
|
+
/**
|
|
112
|
+
* The `<Branch>` component dynamically renders a specified branch of content or a fallback child component.
|
|
113
|
+
* It allows for flexible content switching based on the `branch` prop and an object of possible branches (`...branches`).
|
|
114
|
+
* If the specified `branch` is present in the `branches` object, it renders the content of that branch.
|
|
115
|
+
* If the `branch` is not found, it renders the provided `children` as fallback content.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```jsx
|
|
119
|
+
* <Branch
|
|
120
|
+
* branch="summary"
|
|
121
|
+
* summary={<p>This is a summary</p>}
|
|
122
|
+
* details={<p>Details here</p>}
|
|
123
|
+
* >
|
|
124
|
+
* <p>Fallback content</p>
|
|
125
|
+
* </Branch>
|
|
126
|
+
* ```
|
|
127
|
+
* If the `branch` prop is set to `"summary"`, it will render `<p>This is a summary</p>`. If the `branch` is not set or does not match any keys in the branches object, it renders the fallback content `<p>Fallback content</p>`.
|
|
128
|
+
*
|
|
129
|
+
* @param {any} [children] - Fallback content to render if no matching branch is found.
|
|
130
|
+
* @param {string} [name="branch"] - Optional name for the component, used for metadata or tracking purposes.
|
|
131
|
+
* @param {string} [branch] - The name of the branch to render. The component looks for this key in the `...branches` object.
|
|
132
|
+
* @param {...{[key: string]: any}} [branches] - A spread object containing possible branches as keys and their corresponding content as values.
|
|
133
|
+
* @returns {React.JSX.Element} The rendered branch or fallback content.
|
|
134
|
+
*/
|
|
135
|
+
export declare const Branch: typeof _Branch;
|
|
136
|
+
/**
|
|
137
|
+
* The `<Plural>` component dynamically renders content based on the plural form of the given number (`n`).
|
|
138
|
+
* It determines which content to display by matching the value of `n` to the appropriate pluralization branch,
|
|
139
|
+
* based on the current locale or a default locale. If no matching plural branch is found, the component renders
|
|
140
|
+
* the fallback `children` content.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```jsx
|
|
144
|
+
* <Plural
|
|
145
|
+
* n={1}
|
|
146
|
+
* one="There is 1 item"
|
|
147
|
+
* other="There are {n} items"
|
|
148
|
+
* />
|
|
149
|
+
* ```
|
|
150
|
+
* In this example, if `n` is 1, it renders `"There is 1 item"`. If `n` is a different number, it renders
|
|
151
|
+
* `"There are {n} items"`.
|
|
152
|
+
*
|
|
153
|
+
* @param {any} [children] - Fallback content to render if no matching plural branch is found.
|
|
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. If not provided and wrapped
|
|
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).
|
|
158
|
+
* @param {...{[key: string]: any}} [branches] - A spread object containing possible plural branches, typically including `one` for singular
|
|
159
|
+
* and `other` for plural forms, but it may vary depending on the locale.
|
|
160
|
+
* @returns {React.JSX.Element} The rendered content corresponding to the plural form of `n`, or the fallback content.
|
|
161
|
+
* @throws {Error} If `n` is not provided or not a valid number.
|
|
162
|
+
*/
|
|
163
|
+
export declare const Plural: typeof _Plural;
|
|
164
|
+
/**
|
|
165
|
+
* A dropdown component that allows users to select a locale.
|
|
166
|
+
* @param {string[]} locales - An optional list of locales to use for the dropdown. If not provided, the list of locales from the `<GTProvider>` context is used.
|
|
167
|
+
* @param {object} customNames - An optional object to map locales to custom names.
|
|
168
|
+
* @returns {React.ReactElement | null} The rendered locale dropdown component or null to prevent rendering.
|
|
169
|
+
*/
|
|
170
|
+
export declare const LocaleSelector: typeof _LocaleSelector;
|
|
171
|
+
/**
|
|
172
|
+
* Gets the translation function `t` provided by `<GTProvider>`.
|
|
173
|
+
*
|
|
174
|
+
* @returns {Function} A translation function that accepts a key string and returns the translated value.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* const t = useGT();
|
|
178
|
+
* console.log(t('To be or not to be...'));
|
|
179
|
+
*
|
|
180
|
+
* const t = useGT();
|
|
181
|
+
* return (<>
|
|
182
|
+
* {
|
|
183
|
+
* t('My name is {customName}', { variables: { customName: "Brian" } } )
|
|
184
|
+
* }
|
|
185
|
+
* </>);
|
|
186
|
+
*
|
|
187
|
+
*/
|
|
188
|
+
export declare const useGT: typeof _useGT;
|
|
189
|
+
/**
|
|
190
|
+
* Gets the dictionary access function `t` provided by `<GTProvider>`.
|
|
191
|
+
*
|
|
192
|
+
* @param {string} [id] - Optional prefix to prepend to the translation keys.
|
|
193
|
+
* @returns {Function} A translation function that accepts a key string and returns the translated value.
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* const t = useTranslations('user');
|
|
197
|
+
* console.log(t('name')); // Translates item 'user.name'
|
|
198
|
+
*
|
|
199
|
+
* const t = useTranslations();
|
|
200
|
+
* console.log(t('hello')); // Translates item 'hello'
|
|
201
|
+
*/
|
|
202
|
+
export declare const useTranslations: typeof _useTranslations;
|
|
203
|
+
/**
|
|
204
|
+
* Gets the dictionary access function `d` provided by `<GTProvider>`.
|
|
205
|
+
* @deprecated Use useTranslations instead
|
|
206
|
+
*
|
|
207
|
+
* @param {string} [id] - Optional prefix to prepend to the translation keys.
|
|
208
|
+
* @returns {Function} A translation function that accepts a key string and returns the translated value.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* const d = useDict('user');
|
|
212
|
+
* console.log(t('name')); // Translates item 'user.name'
|
|
213
|
+
*
|
|
214
|
+
* const d = useDict();
|
|
215
|
+
* console.log(t('hello')); // Translates item 'hello'
|
|
216
|
+
*/
|
|
217
|
+
export declare const useDict: typeof _useTranslations;
|
|
218
|
+
/**
|
|
219
|
+
* Retrieves the user's locale from the `<GTProvider>` context.
|
|
220
|
+
*
|
|
221
|
+
* @returns {string} The user's locale, e.g., 'en-US'.
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* const locale = useLocale();
|
|
225
|
+
* console.log(locale); // 'en-US'
|
|
226
|
+
*/
|
|
227
|
+
export declare const useLocale: typeof _useLocale;
|
|
228
|
+
/**
|
|
229
|
+
* Retrieves the user's list of supported locales from the `<GTProvider>` context.
|
|
230
|
+
*
|
|
231
|
+
* @returns {string[]} The user's locales, e.g., ['en-US', 'fr', 'jp'].
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* const locales = useLocales();
|
|
235
|
+
* console.log(locale); // ['en-US', 'fr', 'jp]
|
|
236
|
+
*/
|
|
237
|
+
export declare const useLocales: typeof _useLocales;
|
|
238
|
+
/**
|
|
239
|
+
* Sets the user's locale in the `<GTProvider>` context.
|
|
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.
|
|
251
|
+
*
|
|
252
|
+
* If no default locale is passed to the `<GTProvider>`, it defaults to providing 'en'.
|
|
253
|
+
*
|
|
254
|
+
* @returns {string} The application's default locale, e.g., 'en-US'.
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* const locale = useDefaultLocale();
|
|
258
|
+
* console.log(locale); // 'en-US'
|
|
259
|
+
*/
|
|
260
|
+
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
|
+
/**
|
|
268
|
+
* Returns the configured GT class instance.
|
|
269
|
+
*
|
|
270
|
+
* @returns {GT} The configured GT class instance.
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* const gt = useGTClass();
|
|
274
|
+
* console.log(gt.getLocaleProperties('en-US'));
|
|
275
|
+
*/
|
|
276
|
+
export declare const useGTClass: typeof _useGTClass;
|
|
277
|
+
/**
|
|
278
|
+
* Returns the locale properties for the given locale.
|
|
279
|
+
*
|
|
280
|
+
* @param {string} locale - The locale to get the properties for.
|
|
281
|
+
* @returns {LocaleProperties} The locale properties for the given locale.
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* const localeProperties = useLocaleProperties('en-US');
|
|
285
|
+
* console.log(localeProperties);
|
|
286
|
+
*/
|
|
287
|
+
export declare const useLocaleProperties: typeof _useLocaleProperties;
|
|
288
|
+
//# sourceMappingURL=index.types.d.ts.map
|
|
@@ -0,0 +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,YAAY,IAAI,aAAa,EAC7B,gBAAgB,IAAI,iBAAiB,EACrC,iBAAiB,IAAI,kBAAkB,EACvC,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,OA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