gt-next 6.2.5 → 6.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/client.d.ts +2 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +5 -1
- package/dist/client.js.map +1 -1
- package/dist/errors/createErrors.d.ts +1 -0
- package/dist/errors/createErrors.d.ts.map +1 -1
- package/dist/errors/createErrors.js +5 -1
- package/dist/errors/createErrors.js.map +1 -1
- package/dist/index.client.d.ts +3 -2
- package/dist/index.client.d.ts.map +1 -1
- package/dist/index.client.js +6 -1
- package/dist/index.client.js.map +1 -1
- package/dist/index.server.d.ts +3 -2
- package/dist/index.server.d.ts.map +1 -1
- package/dist/index.server.js +8 -3
- package/dist/index.server.js.map +1 -1
- package/dist/index.types.d.ts +19 -1
- package/dist/index.types.d.ts.map +1 -1
- package/dist/index.types.js +24 -1
- package/dist/index.types.js.map +1 -1
- package/dist/server-dir/buildtime/getTranslationFunction.d.ts +31 -0
- package/dist/server-dir/buildtime/getTranslationFunction.d.ts.map +1 -0
- package/dist/server-dir/buildtime/{getGT.js → getTranslationFunction.js} +155 -66
- package/dist/server-dir/buildtime/getTranslationFunction.js.map +1 -0
- package/dist/server-dir/buildtime/getTranslations.d.ts.map +1 -1
- package/dist/server-dir/buildtime/getTranslations.js +4 -3
- package/dist/server-dir/buildtime/getTranslations.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +4 -3
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
- package/dist/server-dir/buildtime/getGT.d.ts +0 -22
- package/dist/server-dir/buildtime/getGT.d.ts.map +0 -1
- package/dist/server-dir/buildtime/getGT.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# gt-next
|
|
2
2
|
|
|
3
|
+
## 6.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#604](https://github.com/generaltranslation/gt/pull/604) [`43c6a76`](https://github.com/generaltranslation/gt/commit/43c6a76be3d3be420e892b86188ef41c45ae8ffe) Thanks [@archie-mckenzie](https://github.com/archie-mckenzie)! - Refactored useGT and useMessages in order to make useMessages function like an unlintable useGT
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`43c6a76`](https://github.com/generaltranslation/gt/commit/43c6a76be3d3be420e892b86188ef41c45ae8ffe)]:
|
|
10
|
+
- gt-react@10.4.1
|
|
11
|
+
|
|
12
|
+
## 6.3.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#599](https://github.com/generaltranslation/gt/pull/599) [`5950592`](https://github.com/generaltranslation/gt/commit/5950592ca44197915216ec5c8e26f9714cb4f55c) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - feat: msg() function
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`5950592`](https://github.com/generaltranslation/gt/commit/5950592ca44197915216ec5c8e26f9714cb4f55c)]:
|
|
21
|
+
- gt-react@10.4.0
|
|
22
|
+
|
|
3
23
|
## 6.2.5
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/client.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { T, useGT, useLocale, useDefaultLocale, LocaleSelector, RegionSelector, GTProvider, useLocales, useSetLocale, useLocaleSelector, Var, Currency, DateTime, Num, Plural, Branch, useLocaleProperties, useGTClass, useTranslations, useRegion, useRegionSelector, useLocaleDirection } from 'gt-react/client';
|
|
2
|
-
export { useGT, useTranslations, useLocale, useLocales, useSetLocale, useDefaultLocale, useLocaleSelector, useRegion, useRegionSelector, useGTClass, useLocaleProperties, useLocaleDirection, GTProvider as GTClientProvider, T, Var, Currency, DateTime, Num, Plural, Branch, LocaleSelector, RegionSelector, };
|
|
1
|
+
import { T, useGT, useLocale, useDefaultLocale, LocaleSelector, RegionSelector, GTProvider, useLocales, useSetLocale, useLocaleSelector, Var, Currency, DateTime, Num, Plural, Branch, useLocaleProperties, useGTClass, useTranslations, useRegion, useRegionSelector, useLocaleDirection, msg, decodeMsg, decodeOptions, useMessages } from 'gt-react/client';
|
|
2
|
+
export { useGT, useTranslations, useLocale, useLocales, useSetLocale, useDefaultLocale, useLocaleSelector, useRegion, useRegionSelector, useGTClass, useLocaleProperties, useLocaleDirection, msg, decodeMsg, decodeOptions, useMessages, GTProvider as GTClientProvider, T, Var, Currency, DateTime, Num, Plural, Branch, LocaleSelector, RegionSelector, };
|
|
3
3
|
//# 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,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,EACf,SAAS,EACT,iBAAiB,EACjB,kBAAkB,
|
|
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,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,EACf,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAClB,GAAG,EACH,SAAS,EACT,aAAa,EACb,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAEL,KAAK,EACL,eAAe,EACf,SAAS,EACT,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,GAAG,EACH,SAAS,EACT,aAAa,EACb,WAAW,EAEX,UAAU,IAAI,gBAAgB,EAC9B,CAAC,EACD,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,MAAM,EACN,MAAM,EACN,cAAc,EACd,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.RegionSelector = exports.LocaleSelector = exports.Branch = exports.Plural = exports.Num = exports.DateTime = exports.Currency = exports.Var = exports.T = exports.GTClientProvider = exports.useLocaleDirection = exports.useLocaleProperties = exports.useGTClass = exports.useRegionSelector = exports.useRegion = exports.useLocaleSelector = exports.useDefaultLocale = exports.useSetLocale = exports.useLocales = exports.useLocale = exports.useTranslations = exports.useGT = void 0;
|
|
4
|
+
exports.RegionSelector = exports.LocaleSelector = exports.Branch = exports.Plural = exports.Num = exports.DateTime = exports.Currency = exports.Var = exports.T = exports.GTClientProvider = exports.useMessages = exports.decodeOptions = exports.decodeMsg = exports.msg = exports.useLocaleDirection = exports.useLocaleProperties = exports.useGTClass = exports.useRegionSelector = exports.useRegion = exports.useLocaleSelector = exports.useDefaultLocale = exports.useSetLocale = exports.useLocales = exports.useLocale = 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; } });
|
|
@@ -25,4 +25,8 @@ Object.defineProperty(exports, "useTranslations", { enumerable: true, get: funct
|
|
|
25
25
|
Object.defineProperty(exports, "useRegion", { enumerable: true, get: function () { return client_1.useRegion; } });
|
|
26
26
|
Object.defineProperty(exports, "useRegionSelector", { enumerable: true, get: function () { return client_1.useRegionSelector; } });
|
|
27
27
|
Object.defineProperty(exports, "useLocaleDirection", { enumerable: true, get: function () { return client_1.useLocaleDirection; } });
|
|
28
|
+
Object.defineProperty(exports, "msg", { enumerable: true, get: function () { return client_1.msg; } });
|
|
29
|
+
Object.defineProperty(exports, "decodeMsg", { enumerable: true, get: function () { return client_1.decodeMsg; } });
|
|
30
|
+
Object.defineProperty(exports, "decodeOptions", { enumerable: true, get: function () { return client_1.decodeOptions; } });
|
|
31
|
+
Object.defineProperty(exports, "useMessages", { enumerable: true, get: function () { return client_1.useMessages; } });
|
|
28
32
|
//# sourceMappingURL=client.js.map
|
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,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AACb,0CA2ByB;AAsBvB,kFAhDA,UAAC,OAgDA;AAlBD,sFA7BA,cAAK,OA6BA;AAEL,0FA9BA,kBAAS,OA8BA;AAGT,iGAhCA,yBAAgB,OAgCA;AAoBhB,+FAnDA,uBAAc,OAmDA;AACd,+FAnDA,uBAAc,OAmDA;AATA,iGAzCd,mBAAU,OAyCoB;AAd9B,2FA1BA,mBAAU,OA0BA;AACV,6FA1BA,qBAAY,OA0BA;AAEZ,kGA3BA,0BAAiB,OA2BA;AAajB,oFAvCA,YAAG,OAuCA;AACH,yFAvCA,iBAAQ,OAuCA;AACR,yFAvCA,iBAAQ,OAuCA;AACR,oFAvCA,YAAG,OAuCA;AACH,uFAvCA,eAAM,OAuCA;AACN,uFAvCA,eAAM,OAuCA;AAdN,oGAxBA,4BAAmB,OAwBA;AADnB,2FAtBA,mBAAU,OAsBA;AARV,gGAbA,wBAAe,OAaA;AAMf,0FAlBA,kBAAS,OAkBA;AACT,kGAlBA,0BAAiB,OAkBA;AAGjB,mGApBA,2BAAkB,OAoBA;AAClB,oFApBA,YAAG,OAoBA;AACH,0FApBA,kBAAS,OAoBA;AACT,8FApBA,sBAAa,OAoBA;AACb,4FApBA,oBAAW,OAoBA"}
|
|
@@ -23,6 +23,7 @@ export declare const createStringRenderError: (message: string, id: string | und
|
|
|
23
23
|
export declare const usingDefaultsWarning = "gt-next: Unable to access gt-next configuration. Using defaults.";
|
|
24
24
|
export declare const createNoEntryFoundWarning: (id: string) => string;
|
|
25
25
|
export declare const createInvalidDictionaryEntryWarning: (id: string) => string;
|
|
26
|
+
export declare const createInvalidDictionaryTranslationEntryWarning: (id: string) => string;
|
|
26
27
|
export declare const createUnsupportedLocalesWarning: (locales: string[]) => string;
|
|
27
28
|
export declare const createMismatchingHashWarning: (expectedHash: string, receivedHash: string) => string;
|
|
28
29
|
export declare const projectIdMissingWarn = "gt-next: Project ID missing! Set projectId as GT_PROJECT_ID in your environment or by passing the projectId parameter to withGTConfig(). Find your project ID: generaltranslation.com/dashboard.";
|
|
@@ -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,gCAAgC,GAAI,OAAO,KAAK,WACM,CAAC;AAEpE,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,y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,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.createTranslationLoadingWarning = exports.APIKeyMissingWarn = exports.noInitGTWarn = exports.projectIdMissingWarn = exports.createMismatchingHashWarning = exports.createUnsupportedLocalesWarning = exports.createInvalidDictionaryEntryWarning = exports.createNoEntryFoundWarning = exports.usingDefaultsWarning = exports.createStringRenderError = exports.missingVariablesError = 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.createUnresolvedNextVersionError = exports.customLoadDictionaryWarning = exports.customLoadTranslationsError = exports.remoteTranslationsError = void 0;
|
|
4
|
+
exports.standardizedLocalesWarning = exports.dictionaryNotFoundWarning = exports.runtimeTranslationTimeoutWarning = exports.createTranslationLoadingWarning = exports.APIKeyMissingWarn = exports.noInitGTWarn = exports.projectIdMissingWarn = exports.createMismatchingHashWarning = exports.createUnsupportedLocalesWarning = exports.createInvalidDictionaryTranslationEntryWarning = exports.createInvalidDictionaryEntryWarning = exports.createNoEntryFoundWarning = exports.usingDefaultsWarning = exports.createStringRenderError = exports.missingVariablesError = 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.createUnresolvedNextVersionError = 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) {
|
|
@@ -81,6 +81,10 @@ var createInvalidDictionaryEntryWarning = function (id) {
|
|
|
81
81
|
return "gt-next: Invalid dictionary entry found for id: \"".concat(id, "\"");
|
|
82
82
|
};
|
|
83
83
|
exports.createInvalidDictionaryEntryWarning = createInvalidDictionaryEntryWarning;
|
|
84
|
+
var createInvalidDictionaryTranslationEntryWarning = function (id) {
|
|
85
|
+
return "gt-next: Invalid dictionary translation entry found for id: \"".concat(id, "\"");
|
|
86
|
+
};
|
|
87
|
+
exports.createInvalidDictionaryTranslationEntryWarning = createInvalidDictionaryTranslationEntryWarning;
|
|
84
88
|
var createUnsupportedLocalesWarning = function (locales) {
|
|
85
89
|
return "gt-next: The following locales are currently unsupported by our service: ".concat(locales
|
|
86
90
|
.map(function (locale) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createErrors.js","sourceRoot":"","sources":["../../src/errors/createErrors.ts"],"names":[],"mappings":";AAAA,sBAAsB;;;AAEtB,yDAAyD;AAE5C,QAAA,uBAAuB,GAClC,6CAA6C,CAAC;AAEzC,IAAM,2BAA2B,GAAG,UAAC,MAAmB;IAAnB,uBAAA,EAAA,WAAmB;IAC7D,OAAA,4GAAoG,MAAM,gDAA4C;AAAtJ,CAAsJ,CAAC;AAD5I,QAAA,2BAA2B,+BACiH;AAElJ,IAAM,2BAA2B,GAAG,UAAC,MAAmB;I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AAA,4BAA4B,gCAIyK;AAErM,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;AAE7G,IAAM,+BAA+B,GAAG,UAAC,EAQ/C;QAPC,MAAM,YAAA,EACN,WAAW,iBAAA,EACX,EAAE,QAAA;IAMF,OAAA,4DAAoD,MAAM,qBAAS,WAAW,OAAG;QACjF,CAAC,EAAE,CAAC,CAAC,CAAC,oBAAY,EAAE,OAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7B,IAAI;QACJ,iGAAiG;QACjG,6EAA6E;AAJ7E,CAI6E,CAAC;AAbnE,QAAA,+BAA+B,mCAaoC;AAEnE,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,7 @@
|
|
|
1
|
-
import { Var, Num, Currency, DateTime, T, Branch, Plural, LocaleSelector, RegionSelector, useGT, useTranslations, useLocale, useLocales, useDefaultLocale, useGTClass, useLocaleProperties, useLocaleDirection } from 'gt-react/client';
|
|
1
|
+
import { Var, Num, Currency, DateTime, T, Branch, Plural, LocaleSelector, RegionSelector, useGT, useTranslations, useLocale, useLocales, useDefaultLocale, useGTClass, useLocaleProperties, useLocaleDirection, useMessages } from 'gt-react/client';
|
|
2
|
+
import { msg, decodeMsg, decodeOptions } from 'gt-react/internal';
|
|
2
3
|
import { DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions } from 'gt-react';
|
|
3
4
|
export declare function GTProvider(): void;
|
|
4
5
|
export declare function Tx(): void;
|
|
5
|
-
export { T, Var, Num, Currency, DateTime, Branch, Plural, LocaleSelector, RegionSelector, useGT, useTranslations, useLocale, useLocales, useDefaultLocale, useGTClass, useLocaleProperties, useLocaleDirection, DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions, };
|
|
6
|
+
export { T, Var, Num, Currency, DateTime, Branch, Plural, LocaleSelector, RegionSelector, useGT, useTranslations, useLocale, useLocales, useDefaultLocale, useGTClass, useLocaleProperties, useLocaleDirection, useMessages, DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions, msg, decodeMsg, decodeOptions, };
|
|
6
7
|
//# 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,cAAc,EACd,KAAK,EACL,eAAe,EACf,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,kBAAkB,
|
|
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,cAAc,EACd,KAAK,EACL,eAAe,EACf,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKlE,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,UAAU,CAAC;AAGlB,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,cAAc,EACd,KAAK,EACL,eAAe,EACf,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EACzB,GAAG,EACH,SAAS,EACT,aAAa,GACd,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.useLocaleDirection = exports.useLocaleProperties = exports.useGTClass = exports.useDefaultLocale = exports.useLocales = exports.useLocale = exports.useTranslations = exports.useGT = exports.RegionSelector = exports.LocaleSelector = exports.Plural = exports.Branch = exports.DateTime = exports.Currency = exports.Num = exports.Var = exports.T = void 0;
|
|
4
|
+
exports.decodeOptions = exports.decodeMsg = exports.msg = exports.useMessages = exports.useLocaleDirection = exports.useLocaleProperties = exports.useGTClass = exports.useDefaultLocale = exports.useLocales = exports.useLocale = exports.useTranslations = exports.useGT = exports.RegionSelector = 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");
|
|
@@ -22,6 +22,11 @@ Object.defineProperty(exports, "useDefaultLocale", { enumerable: true, get: func
|
|
|
22
22
|
Object.defineProperty(exports, "useGTClass", { enumerable: true, get: function () { return client_1.useGTClass; } });
|
|
23
23
|
Object.defineProperty(exports, "useLocaleProperties", { enumerable: true, get: function () { return client_1.useLocaleProperties; } });
|
|
24
24
|
Object.defineProperty(exports, "useLocaleDirection", { enumerable: true, get: function () { return client_1.useLocaleDirection; } });
|
|
25
|
+
Object.defineProperty(exports, "useMessages", { enumerable: true, get: function () { return client_1.useMessages; } });
|
|
26
|
+
var internal_1 = require("gt-react/internal");
|
|
27
|
+
Object.defineProperty(exports, "msg", { enumerable: true, get: function () { return internal_1.msg; } });
|
|
28
|
+
Object.defineProperty(exports, "decodeMsg", { enumerable: true, get: function () { return internal_1.decodeMsg; } });
|
|
29
|
+
Object.defineProperty(exports, "decodeOptions", { enumerable: true, get: function () { return internal_1.decodeOptions; } });
|
|
25
30
|
var createErrors_1 = require("./errors/createErrors");
|
|
26
31
|
// Mock <GTProvider> which throws an error
|
|
27
32
|
function GTProvider() {
|
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;;;AAkCb,gCAEC;AAGD,gBAEC;AAvCD,0CAmByB;AAwBvB,oFA1CA,YAAG,OA0CA;AACH,oFA1CA,YAAG,OA0CA;AACH,yFA1CA,iBAAQ,OA0CA;AACR,yFA1CA,iBAAQ,OA0CA;AAJR,kFArCA,UAAC,OAqCA;AAKD,uFAzCA,eAAM,OAyCA;AACN,uFAzCA,eAAM,OAyCA;AACN,+FAzCA,uBAAc,OAyCA;AACd,+FAzCA,uBAAc,OAyCA;AACd,sFAzCA,cAAK,OAyCA;AACL,gGAzCA,wBAAe,OAyCA;AACf,0FAzCA,kBAAS,OAyCA;AACT,2FAzCA,mBAAU,OAyCA;AACV,iGAzCA,yBAAgB,OAyCA;AAChB,2FAzCA,mBAAU,OAyCA;AACV,oGAzCA,4BAAmB,OAyCA;AACnB,mGAzCA,2BAAkB,OAyCA;AAClB,4FAzCA,oBAAW,OAyCA;AAvCb,8CAAkE;AA2ChE,oFA3CO,cAAG,OA2CP;AACH,0FA5CY,oBAAS,OA4CZ;AACT,8FA7CuB,wBAAa,OA6CvB;AA5Cf,sDAG+B;AAO/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,17 @@ 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
|
-
import { useGT } from './server-dir/buildtime/getGT';
|
|
11
10
|
import { useTranslations } from './server-dir/buildtime/getTranslations';
|
|
12
11
|
import { useLocale } from './request/getLocale';
|
|
13
12
|
import { useLocaleDirection } from './request/getLocaleDirection';
|
|
13
|
+
import { msg, decodeMsg, decodeOptions } from 'gt-react/internal';
|
|
14
14
|
import { DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions } from 'gt-react';
|
|
15
15
|
import { GT } from 'generaltranslation';
|
|
16
|
+
import { useMessages, useGT } from './server-dir/buildtime/getTranslationFunction';
|
|
16
17
|
export { LocaleSelector, RegionSelector } from './index.client';
|
|
17
18
|
export declare function useGTClass(): GT;
|
|
18
19
|
export declare function useLocaleProperties(locale: string): import("generaltranslation/dist/locales/getLocaleProperties").LocaleProperties;
|
|
19
20
|
export declare function useLocales(): string[];
|
|
20
21
|
export declare function useDefaultLocale(): string;
|
|
21
|
-
export { GTProvider, T, Tx, Var, Num, Currency, DateTime, Branch, Plural, useGT, useTranslations, useLocale, useLocaleDirection, DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions, };
|
|
22
|
+
export { GTProvider, T, Tx, Var, Num, Currency, DateTime, Branch, Plural, useGT, useTranslations, useMessages, useLocale, useLocaleDirection, DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions, msg, decodeMsg, decodeOptions, };
|
|
22
23
|
//# 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;AAC9B,OAAO,EAAE,
|
|
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,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EACL,WAAW,EACX,KAAK,EACN,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhE,wBAAgB,UAAU,OAEzB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,kFAEjD;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,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EACzB,GAAG,EACH,SAAS,EACT,aAAa,GACd,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.useLocaleDirection = exports.useLocale = exports.useTranslations = exports.useGT = exports.Plural = exports.Branch = exports.DateTime = exports.Currency = exports.Num = exports.Var = exports.Tx = exports.T = exports.GTProvider = exports.RegionSelector = exports.LocaleSelector = void 0;
|
|
6
|
+
exports.decodeOptions = exports.decodeMsg = exports.msg = exports.useLocaleDirection = exports.useLocale = exports.useMessages = exports.useTranslations = exports.useGT = exports.Plural = exports.Branch = exports.DateTime = exports.Currency = exports.Num = exports.Var = exports.Tx = exports.T = exports.GTProvider = exports.RegionSelector = exports.LocaleSelector = void 0;
|
|
7
7
|
exports.useGTClass = useGTClass;
|
|
8
8
|
exports.useLocaleProperties = useLocaleProperties;
|
|
9
9
|
exports.useLocales = useLocales;
|
|
@@ -26,8 +26,6 @@ var GTProvider_1 = __importDefault(require("./provider/GTProvider"));
|
|
|
26
26
|
exports.GTProvider = GTProvider_1.default;
|
|
27
27
|
var server_1 = require("./server");
|
|
28
28
|
Object.defineProperty(exports, "Tx", { enumerable: true, get: function () { return server_1.Tx; } });
|
|
29
|
-
var getGT_1 = require("./server-dir/buildtime/getGT");
|
|
30
|
-
Object.defineProperty(exports, "useGT", { enumerable: true, get: function () { return getGT_1.useGT; } });
|
|
31
29
|
var getTranslations_1 = require("./server-dir/buildtime/getTranslations");
|
|
32
30
|
Object.defineProperty(exports, "useTranslations", { enumerable: true, get: function () { return getTranslations_1.useTranslations; } });
|
|
33
31
|
var getLocale_1 = require("./request/getLocale");
|
|
@@ -35,6 +33,13 @@ Object.defineProperty(exports, "useLocale", { enumerable: true, get: function ()
|
|
|
35
33
|
var getLocaleDirection_1 = require("./request/getLocaleDirection");
|
|
36
34
|
Object.defineProperty(exports, "useLocaleDirection", { enumerable: true, get: function () { return getLocaleDirection_1.useLocaleDirection; } });
|
|
37
35
|
var getI18NConfig_1 = __importDefault(require("./config-dir/getI18NConfig"));
|
|
36
|
+
var internal_1 = require("gt-react/internal");
|
|
37
|
+
Object.defineProperty(exports, "msg", { enumerable: true, get: function () { return internal_1.msg; } });
|
|
38
|
+
Object.defineProperty(exports, "decodeMsg", { enumerable: true, get: function () { return internal_1.decodeMsg; } });
|
|
39
|
+
Object.defineProperty(exports, "decodeOptions", { enumerable: true, get: function () { return internal_1.decodeOptions; } });
|
|
40
|
+
var getTranslationFunction_1 = require("./server-dir/buildtime/getTranslationFunction");
|
|
41
|
+
Object.defineProperty(exports, "useMessages", { enumerable: true, get: function () { return getTranslationFunction_1.useMessages; } });
|
|
42
|
+
Object.defineProperty(exports, "useGT", { enumerable: true, get: function () { return getTranslationFunction_1.useGT; } });
|
|
38
43
|
var index_client_1 = require("./index.client");
|
|
39
44
|
Object.defineProperty(exports, "LocaleSelector", { enumerable: true, get: function () { return index_client_1.LocaleSelector; } });
|
|
40
45
|
Object.defineProperty(exports, "RegionSelector", { enumerable: true, get: function () { return index_client_1.RegionSelector; } });
|
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":";;;;;;AA2BA,gCAEC;AAED,kDAEC;AAED,gCAEC;AAED,4CAEC;AAzCD,wDAAkC;AA+ChC,cA/CK,aAAG,CA+CL;AA9CL,wDAAkC;AA+ChC,cA/CK,aAAG,CA+CL;AA9CL,kEAA4C;AA+C1C,mBA/CK,kBAAQ,CA+CL;AA9CV,kEAA4C;AA+C1C,mBA/CK,kBAAQ,CA+CL;AA9CV,+DAAyC;AAyCvC,YAzCK,WAAC,CAyCL;AAxCH,6DAAuC;AA8CrC,iBA9CK,gBAAM,CA8CL;AA7CR,6DAAuC;AA8CrC,iBA9CK,gBAAM,CA8CL;AA7CR,qEAA+C;AAqC7C,qBArCK,oBAAU,CAqCL;AApCZ,mCAA8B;AAsC5B,mFAtCO,WAAE,OAsCP;AArCJ,0EAAyE;AA6CvE,gGA7CO,iCAAe,OA6CP;AA5CjB,iDAAgD;AA8C9C,0FA9CO,qBAAS,OA8CP;AA7CX,mEAAkE;AA8ChE,mGA9CO,uCAAkB,OA8CP;AA7CpB,6EAAuD;AACvD,8CAAkE;AAgDhE,oFAhDO,cAAG,OAgDP;AACH,0FAjDY,oBAAS,OAiDZ;AACT,8FAlDuB,wBAAa,OAkDvB;AA3Cf,wFAGuD;AAgCrD,4FAlCA,oCAAW,OAkCA;AAFX,sFA/BA,8BAAK,OA+BA;AA5BP,+CAAgE;AAAvD,8GAAA,cAAc,OAAA;AAAE,8GAAA,cAAc,OAAA;AAEvC,SAAgB,UAAU;IACxB,OAAO,IAAA,uBAAa,GAAE,CAAC,UAAU,EAAE,CAAC;AACtC,CAAC;AAED,SAAgB,mBAAmB,CAAC,MAAc;IAChD,OAAQ,UAAU,EAAS,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAC1D,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,7 +1,8 @@
|
|
|
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, 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, RegionSelector as _RegionSelector, useLocaleDirection as _useLocaleDirection } from 'gt-react/client';
|
|
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, RegionSelector as _RegionSelector, useLocaleDirection as _useLocaleDirection, useMessages as _useMessages } from 'gt-react/client';
|
|
4
4
|
import { DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions } from 'gt-react';
|
|
5
|
+
import { msg, decodeMsg, decodeOptions } from 'gt-react/internal';
|
|
5
6
|
/**
|
|
6
7
|
* Provides General Translation context to its children, which can then access `useGT`, `useLocale`, and `useDefaultLocale`.
|
|
7
8
|
*
|
|
@@ -287,5 +288,22 @@ export declare const useLocaleDirection: typeof _useLocaleDirection;
|
|
|
287
288
|
* ```
|
|
288
289
|
*/
|
|
289
290
|
export declare const RegionSelector: typeof _RegionSelector;
|
|
291
|
+
/**
|
|
292
|
+
* Gets the message decoding and translation function `m` provided by `<GTProvider>`.
|
|
293
|
+
*
|
|
294
|
+
* @returns {Function} A translation function that accepts an encoded message, decodes it, and returns the translated value.
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* const encodedMessage = msg("Hello, world")
|
|
298
|
+
* const m = useMessages();
|
|
299
|
+
* m(encodedMessage) // returns "Hello, world" translated
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* const encodedMessage = msg("My name is {name}", { name: "Brian" });
|
|
303
|
+
* const m = useMessages();
|
|
304
|
+
* m(encodedMessage) // returns "My name is Brian" translated
|
|
305
|
+
*/
|
|
306
|
+
export declare const useMessages: typeof _useMessages;
|
|
290
307
|
export { DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions, };
|
|
308
|
+
export { msg, decodeMsg, decodeOptions };
|
|
291
309
|
//# sourceMappingURL=index.types.d.ts.map
|
|
@@ -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,gBAAgB,IAAI,iBAAiB,EACrC,UAAU,IAAI,WAAW,EACzB,mBAAmB,IAAI,oBAAoB,EAC3C,QAAQ,IAAI,SAAS,EACrB,QAAQ,IAAI,SAAS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AAC;AAEF,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/index.types.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RegionSelector = exports.useLocaleDirection = exports.useLocaleProperties = exports.useGTClass = exports.useDefaultLocale = exports.useLocales = exports.useLocale = exports.useTranslations = exports.useGT = exports.LocaleSelector = exports.Plural = exports.Branch = exports.Var = exports.Num = exports.DateTime = exports.Currency = exports.T = exports.GTProvider = void 0;
|
|
3
|
+
exports.decodeOptions = exports.decodeMsg = exports.msg = exports.useMessages = exports.RegionSelector = exports.useLocaleDirection = exports.useLocaleProperties = exports.useGTClass = exports.useDefaultLocale = exports.useLocales = exports.useLocale = exports.useTranslations = exports.useGT = exports.LocaleSelector = exports.Plural = exports.Branch = exports.Var = exports.Num = exports.DateTime = exports.Currency = exports.T = exports.GTProvider = void 0;
|
|
4
4
|
var createErrors_1 = require("./errors/createErrors");
|
|
5
|
+
var internal_1 = require("gt-react/internal");
|
|
6
|
+
Object.defineProperty(exports, "msg", { enumerable: true, get: function () { return internal_1.msg; } });
|
|
7
|
+
Object.defineProperty(exports, "decodeMsg", { enumerable: true, get: function () { return internal_1.decodeMsg; } });
|
|
8
|
+
Object.defineProperty(exports, "decodeOptions", { enumerable: true, get: function () { return internal_1.decodeOptions; } });
|
|
5
9
|
/**
|
|
6
10
|
* Provides General Translation context to its children, which can then access `useGT`, `useLocale`, and `useDefaultLocale`.
|
|
7
11
|
*
|
|
@@ -355,4 +359,23 @@ var RegionSelector = function () {
|
|
|
355
359
|
throw new Error(createErrors_1.typesFileError);
|
|
356
360
|
};
|
|
357
361
|
exports.RegionSelector = RegionSelector;
|
|
362
|
+
/**
|
|
363
|
+
* Gets the message decoding and translation function `m` provided by `<GTProvider>`.
|
|
364
|
+
*
|
|
365
|
+
* @returns {Function} A translation function that accepts an encoded message, decodes it, and returns the translated value.
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* const encodedMessage = msg("Hello, world")
|
|
369
|
+
* const m = useMessages();
|
|
370
|
+
* m(encodedMessage) // returns "Hello, world" translated
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* const encodedMessage = msg("My name is {name}", { name: "Brian" });
|
|
374
|
+
* const m = useMessages();
|
|
375
|
+
* m(encodedMessage) // returns "My name is Brian" translated
|
|
376
|
+
*/
|
|
377
|
+
var useMessages = function () {
|
|
378
|
+
throw new Error(createErrors_1.typesFileError);
|
|
379
|
+
};
|
|
380
|
+
exports.useMessages = useMessages;
|
|
358
381
|
//# sourceMappingURL=index.types.js.map
|
package/dist/index.types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.types.js","sourceRoot":"","sources":["../src/index.types.ts"],"names":[],"mappings":";;;AAAA,sDAAuD;AA2BvD;;;;;;;;GAQG;AACI,IAAM,UAAU,GAAuB;IAC5C,MAAM,IAAI,KAAK,CAAC,6BAAc,CAAC,CAAC;AAClC,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACI,IAAM,CAAC,GAAc;IAC1B,MAAM,IAAI,KAAK,CAAC,6BAAc,CAAC,CAAC;AAClC,CAAC,CAAC;AAFW,QAAA,CAAC,KAEZ;AACF,gEAAgE;AAChE,SAAC,CAAC,IAAI,GAAG,WAAW,CAAC;AAErB;;;;;;;;;;;;;;;;GAgBG;AACI,IAAM,QAAQ,GAAqB;IACxC,MAAM,IAAI,KAAK,CAAC,6BAAc,CAAC,CAAC;AAClC,CAAC,CAAC;AAFW,QAAA,QAAQ,YAEnB;AACF,gEAAgE;AAChE,gBAAQ,CAAC,IAAI,GAAG,mBAAmB,CAAC;AAEpC;;;;;;;;;;;;;;GAcG;AACI,IAAM,QAAQ,GAAqB;IACxC,MAAM,IAAI,KAAK,CAAC,6BA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AACI,IAAM,gBAAgB,GAA6B;IACxD,MAAM,IAAI,KAAK,CAAC,6BAAc,CAAC,CAAC;AAClC,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B;AAEF;;;;;;;;GAQG;AACI,IAAM,UAAU,GAAuB;IAC5C,MAAM,IAAI,KAAK,CAAC,6BAAc,CAAC,CAAC;AAClC,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEF;;;;;;;;;GASG;AACI,IAAM,mBAAmB,GAAgC;IAC9D,MAAM,IAAI,KAAK,CAAC,6BAAc,CAAC,CAAC;AAClC,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAEF;;;;;;;;;;;GAWG;AACI,IAAM,kBAAkB,GAA+B;IAC5D,MAAM,IAAI,KAAK,CAAC,6BAAc,CAAC,CAAC;AAClC,CAAC,CAAC;AAFW,QAAA,kBAAkB,sBAE7B;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,IAAM,cAAc,GAA2B;IACpD,MAAM,IAAI,KAAK,CAAC,6BAAc,CAAC,CAAC;AAClC,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB;AAEF;;;;;;;;;;;;;;GAcG;AACI,IAAM,WAAW,GAAwB;IAC9C,MAAM,IAAI,KAAK,CAAC,6BAAc,CAAC,CAAC;AAClC,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { InlineTranslationOptions, _Messages } from 'gt-react/internal';
|
|
2
|
+
/**
|
|
3
|
+
* getGT() returns a function that translates an ICU message string.
|
|
4
|
+
*
|
|
5
|
+
* @returns A promise of the t() function used for translating strings
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const t = await getGT();
|
|
9
|
+
* console.log(t('Hello, world!')); // Translates 'Hello, world!'
|
|
10
|
+
*/
|
|
11
|
+
export declare function getGT(_messages?: _Messages): Promise<(message: string, options?: InlineTranslationOptions) => string>;
|
|
12
|
+
/**
|
|
13
|
+
* Hook wrapper for getGT
|
|
14
|
+
*/
|
|
15
|
+
export declare function useGT(_messages?: _Messages): (message: string, options?: InlineTranslationOptions) => string;
|
|
16
|
+
/**
|
|
17
|
+
* getMessages() returns a function that translates an encoded ICU message string.
|
|
18
|
+
*
|
|
19
|
+
* @returns A promise of the m() function used for translating encoded ICU message strings
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const encodedMsg = msg('Hello, world!')
|
|
23
|
+
* const m = await getMessages();
|
|
24
|
+
* console.log(m(encodedMsg)); // Translates 'Hello, world!'
|
|
25
|
+
*/
|
|
26
|
+
export declare function getMessages(_messages?: _Messages): Promise<(message: string, options?: InlineTranslationOptions) => string>;
|
|
27
|
+
/**
|
|
28
|
+
* Hook wrapper for getMessages
|
|
29
|
+
*/
|
|
30
|
+
export declare function useMessages(_messages?: _Messages): (message: string, options?: InlineTranslationOptions) => string;
|
|
31
|
+
//# sourceMappingURL=getTranslationFunction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTranslationFunction.d.ts","sourceRoot":"","sources":["../../../src/server-dir/buildtime/getTranslationFunction.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,wBAAwB,EAExB,SAAS,EAIV,MAAM,mBAAmB,CAAC;AA6T3B;;;;;;;;GAQG;AACH,wBAAsB,KAAK,CACzB,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB,KAAK,MAAM,CAAC,CAG1E;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,SAAS,CAAC,EAAE,SAAS,aARtB,MAAM,YAAY,wBAAwB,KAAK,MAAM,CAUzE;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB,KAAK,MAAM,CAAC,CAG1E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,SAAS,CAAC,EAAE,SAAS,aAR5B,MAAM,YAAY,wBAAwB,KAAK,MAAM,CAUzE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// getTranslationFunction.ts (refactored)
|
|
2
3
|
var __assign = (this && this.__assign) || function () {
|
|
3
4
|
__assign = Object.assign || function(t) {
|
|
4
5
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -63,70 +64,68 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
63
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
65
|
exports.getGT = getGT;
|
|
65
66
|
exports.useGT = useGT;
|
|
67
|
+
exports.getMessages = getMessages;
|
|
68
|
+
exports.useMessages = useMessages;
|
|
66
69
|
var getI18NConfig_1 = __importDefault(require("../../config-dir/getI18NConfig"));
|
|
67
70
|
var server_1 = require("../../server");
|
|
68
71
|
var id_1 = require("generaltranslation/id");
|
|
69
72
|
var createErrors_1 = require("../../errors/createErrors");
|
|
70
73
|
var internal_1 = require("gt-react/internal");
|
|
71
74
|
var use_1 = __importDefault(require("../../utils/use"));
|
|
72
|
-
|
|
73
|
-
* getGT() returns a function that translates a string, being marked as translated at build time.
|
|
74
|
-
*
|
|
75
|
-
* @returns A promise of the t() function used for translating strings
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* const t = await getGT();
|
|
79
|
-
* console.log(t('Hello, world!')); // Translates 'Hello, world!'
|
|
80
|
-
*/
|
|
81
|
-
function getGT(_messages) {
|
|
75
|
+
function createTranslator(_messages) {
|
|
82
76
|
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
-
// ---------
|
|
77
|
+
// --------- HELPERS --------- //
|
|
84
78
|
function initializeT(message, options) {
|
|
85
79
|
if (options === void 0) { options = {}; }
|
|
86
80
|
if (!message || typeof message !== 'string')
|
|
87
81
|
return null;
|
|
88
82
|
var id = options.$id, context = options.$context, _hash = options.$_hash, variables = __rest(options, ["$id", "$context", "$_hash"]);
|
|
89
|
-
// Update renderContent to use actual variables
|
|
90
83
|
var renderMessage = function (msg, locales) {
|
|
91
84
|
return gt.formatMessage(msg, {
|
|
92
85
|
locales: locales,
|
|
93
86
|
variables: variables,
|
|
94
87
|
});
|
|
95
88
|
};
|
|
96
|
-
// Calculate hash
|
|
97
89
|
var calculateHash = function () {
|
|
98
90
|
return (0, id_1.hashSource)(__assign(__assign(__assign({ source: message }, (context && { context: context })), (id && { id: id })), { dataFormat: 'ICU' }));
|
|
99
91
|
};
|
|
100
|
-
return {
|
|
101
|
-
id: id,
|
|
102
|
-
context: context,
|
|
103
|
-
_hash: _hash,
|
|
104
|
-
variables: variables,
|
|
105
|
-
calculateHash: calculateHash,
|
|
106
|
-
renderMessage: renderMessage,
|
|
107
|
-
};
|
|
92
|
+
return { id: id, context: context, _hash: _hash, variables: variables, calculateHash: calculateHash, renderMessage: renderMessage };
|
|
108
93
|
}
|
|
109
94
|
function getTranslationData(calculateHash, id, _hash) {
|
|
110
95
|
var translationEntry;
|
|
111
|
-
var hash = ''; //
|
|
112
|
-
if (id)
|
|
96
|
+
var hash = ''; // lazily computed if needed
|
|
97
|
+
if (id)
|
|
113
98
|
translationEntry = translations === null || translations === void 0 ? void 0 : translations[id];
|
|
114
|
-
|
|
115
|
-
if (_hash && (translations === null || translations === void 0 ? void 0 : translations[_hash])) {
|
|
99
|
+
if (!translationEntry && _hash && (translations === null || translations === void 0 ? void 0 : translations[_hash]) !== undefined) {
|
|
116
100
|
hash = _hash;
|
|
117
101
|
translationEntry = translations === null || translations === void 0 ? void 0 : translations[_hash];
|
|
118
102
|
}
|
|
119
|
-
// Use calculated hash to index
|
|
120
103
|
if (!translationEntry) {
|
|
121
104
|
hash = calculateHash();
|
|
122
105
|
translationEntry = translations === null || translations === void 0 ? void 0 : translations[hash];
|
|
123
106
|
}
|
|
124
|
-
return {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
107
|
+
return { translationEntry: translationEntry, hash: hash };
|
|
108
|
+
}
|
|
109
|
+
function scheduleTranslateOnDemand(args) {
|
|
110
|
+
var source = args.source, context = args.context, id = args.id, hash = args.hash, renderMessage = args.renderMessage;
|
|
111
|
+
try {
|
|
112
|
+
I18NConfig.translateIcu({
|
|
113
|
+
source: source,
|
|
114
|
+
targetLocale: locale,
|
|
115
|
+
options: __assign(__assign(__assign({}, (context && { context: context })), (id && { id: id })), { hash: hash }),
|
|
116
|
+
}).then(function (result) {
|
|
117
|
+
// eslint-disable-next-line no-console
|
|
118
|
+
console.warn((0, createErrors_1.createTranslationLoadingWarning)(__assign(__assign({}, (id && { id: id })), { source: renderMessage(source, [defaultLocale]), translation: renderMessage(result, [
|
|
119
|
+
locale,
|
|
120
|
+
defaultLocale,
|
|
121
|
+
]) })));
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
console.warn(error);
|
|
126
|
+
}
|
|
128
127
|
}
|
|
129
|
-
var I18NConfig, locale, defaultLocale, translationRequired, gt, translations, _a, preloadedTranslations, preload, t;
|
|
128
|
+
var I18NConfig, locale, defaultLocale, translationRequired, gt, translations, _a, preloadedTranslations, preload, t, m;
|
|
130
129
|
var _this = this;
|
|
131
130
|
return __generator(this, function (_b) {
|
|
132
131
|
switch (_b.label) {
|
|
@@ -159,7 +158,6 @@ function getGT(_messages) {
|
|
|
159
158
|
return __generator(this, function (_e) {
|
|
160
159
|
switch (_e.label) {
|
|
161
160
|
case 0:
|
|
162
|
-
// Early return if possible
|
|
163
161
|
if (!message)
|
|
164
162
|
return [2 /*return*/];
|
|
165
163
|
init = initializeT(message, options);
|
|
@@ -167,9 +165,8 @@ function getGT(_messages) {
|
|
|
167
165
|
return [2 /*return*/];
|
|
168
166
|
id = init.id, context = init.context, _hash = init._hash, calculateHash = init.calculateHash;
|
|
169
167
|
_b = getTranslationData(calculateHash, id, _hash), translationEntry = _b.translationEntry, hash = _b.hash;
|
|
170
|
-
// Return if no translation needed
|
|
171
168
|
if (translationEntry)
|
|
172
|
-
return [2 /*return*/];
|
|
169
|
+
return [2 /*return*/]; // exists already
|
|
173
170
|
_e.label = 1;
|
|
174
171
|
case 1:
|
|
175
172
|
_e.trys.push([1, 3, , 4]);
|
|
@@ -181,8 +178,7 @@ function getGT(_messages) {
|
|
|
181
178
|
options: __assign(__assign(__assign({}, (context && { context: context })), (id && { id: id })), { hash: hash }),
|
|
182
179
|
})];
|
|
183
180
|
case 2:
|
|
184
|
-
_c[_d] =
|
|
185
|
-
(_e.sent());
|
|
181
|
+
_c[_d] = (_e.sent());
|
|
186
182
|
return [3 /*break*/, 4];
|
|
187
183
|
case 3:
|
|
188
184
|
error_1 = _e.sent();
|
|
@@ -198,20 +194,15 @@ function getGT(_messages) {
|
|
|
198
194
|
_b.label = 6;
|
|
199
195
|
case 6:
|
|
200
196
|
t = function (message, options) {
|
|
201
|
-
// ----- SET UP ----- //
|
|
202
197
|
if (options === void 0) { options = {}; }
|
|
203
198
|
var init = initializeT(message, options);
|
|
204
199
|
if (!init)
|
|
205
200
|
return '';
|
|
206
201
|
var id = init.id, context = init.context, _hash = init._hash, calculateHash = init.calculateHash, renderMessage = init.renderMessage;
|
|
207
|
-
//
|
|
208
|
-
// Check: translation required
|
|
202
|
+
// Early: no translation needed
|
|
209
203
|
if (!translationRequired)
|
|
210
204
|
return renderMessage(message, [defaultLocale]);
|
|
211
|
-
// ----- GET TRANSLATION ----- //
|
|
212
205
|
var _a = getTranslationData(calculateHash, id, _hash), translationEntry = _a.translationEntry, hash = _a.hash;
|
|
213
|
-
// ----- RENDER TRANSLATION ----- //
|
|
214
|
-
// If a translation already exists
|
|
215
206
|
if (translationEntry) {
|
|
216
207
|
try {
|
|
217
208
|
return renderMessage(translationEntry, [
|
|
@@ -224,12 +215,10 @@ function getGT(_messages) {
|
|
|
224
215
|
return renderMessage(message, [defaultLocale]);
|
|
225
216
|
}
|
|
226
217
|
}
|
|
227
|
-
// If it is not possible to create a translation
|
|
228
218
|
if (!I18NConfig.isDevelopmentApiEnabled()) {
|
|
229
219
|
console.warn((0, createErrors_1.createStringTranslationError)(message, id, 't'));
|
|
230
220
|
return renderMessage(message, [defaultLocale]);
|
|
231
221
|
}
|
|
232
|
-
// If the translation has been preloaded
|
|
233
222
|
if (!translationEntry && (preloadedTranslations === null || preloadedTranslations === void 0 ? void 0 : preloadedTranslations[hash])) {
|
|
234
223
|
try {
|
|
235
224
|
return renderMessage(preloadedTranslations[hash], [
|
|
@@ -242,43 +231,143 @@ function getGT(_messages) {
|
|
|
242
231
|
return renderMessage(message, [defaultLocale]);
|
|
243
232
|
}
|
|
244
233
|
}
|
|
245
|
-
//
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
234
|
+
// On-demand translate
|
|
235
|
+
scheduleTranslateOnDemand({
|
|
236
|
+
source: message,
|
|
237
|
+
context: context,
|
|
238
|
+
id: id,
|
|
239
|
+
hash: hash,
|
|
240
|
+
renderMessage: renderMessage,
|
|
241
|
+
});
|
|
242
|
+
return renderMessage(message, [defaultLocale]);
|
|
243
|
+
};
|
|
244
|
+
m = function (encodedMsg, options) {
|
|
245
|
+
if (options === void 0) { options = {}; }
|
|
246
|
+
// Try to decode first
|
|
247
|
+
var decodedOptions = (0, internal_1.decodeOptions)(encodedMsg);
|
|
248
|
+
// Fallback to t() if not an encoded message
|
|
249
|
+
if (!decodedOptions || !decodedOptions.$_hash || !decodedOptions.$_source) {
|
|
250
|
+
return encodedMsg;
|
|
251
|
+
// return t(encodedMsg, options); (moved to compiler based solution instead)
|
|
252
|
+
}
|
|
253
|
+
var $_hash = decodedOptions.$_hash, $_source = decodedOptions.$_source, $context = decodedOptions.$context, $id = decodedOptions.$id, decodedVariables = __rest(decodedOptions, ["$_hash", "$_source", "$context", "$id"]);
|
|
254
|
+
var renderMessage = function (msg, locales) {
|
|
255
|
+
return gt.formatMessage(msg, {
|
|
256
|
+
locales: locales,
|
|
257
|
+
variables: __assign(__assign({}, decodedVariables), options),
|
|
259
258
|
});
|
|
259
|
+
};
|
|
260
|
+
// Early: default locale only
|
|
261
|
+
if (!translationRequired)
|
|
262
|
+
return renderMessage($_source, [defaultLocale]);
|
|
263
|
+
// Translation exists?
|
|
264
|
+
var translationEntry = translations === null || translations === void 0 ? void 0 : translations[$_hash];
|
|
265
|
+
if (translationEntry === null) {
|
|
266
|
+
return renderMessage($_source, [defaultLocale]);
|
|
267
|
+
}
|
|
268
|
+
if (translationEntry) {
|
|
269
|
+
try {
|
|
270
|
+
return renderMessage(translationEntry, [
|
|
271
|
+
locale,
|
|
272
|
+
defaultLocale,
|
|
273
|
+
]);
|
|
274
|
+
}
|
|
275
|
+
catch (error) {
|
|
276
|
+
console.error((0, createErrors_1.createStringRenderError)($_source, (0, internal_1.decodeMsg)(encodedMsg)), 'Error: ', error);
|
|
277
|
+
return renderMessage($_source, [defaultLocale]);
|
|
278
|
+
}
|
|
260
279
|
}
|
|
261
|
-
|
|
262
|
-
|
|
280
|
+
// Dev-only paths for loading or preloaded
|
|
281
|
+
if (!I18NConfig.isDevelopmentApiEnabled()) {
|
|
282
|
+
console.warn((0, createErrors_1.createStringTranslationError)($_source, (0, internal_1.decodeMsg)(encodedMsg), 'm'));
|
|
283
|
+
return renderMessage($_source, [defaultLocale]);
|
|
263
284
|
}
|
|
264
|
-
|
|
265
|
-
|
|
285
|
+
if (typeof (preloadedTranslations === null || preloadedTranslations === void 0 ? void 0 : preloadedTranslations[$_hash]) !== 'undefined') {
|
|
286
|
+
if (preloadedTranslations === null || preloadedTranslations === void 0 ? void 0 : preloadedTranslations[$_hash]) {
|
|
287
|
+
try {
|
|
288
|
+
return renderMessage(preloadedTranslations[$_hash], [
|
|
289
|
+
locale,
|
|
290
|
+
defaultLocale,
|
|
291
|
+
]);
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
console.error((0, createErrors_1.createStringRenderError)($_source, (0, internal_1.decodeMsg)(encodedMsg)), 'Error: ', error);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return renderMessage($_source, [defaultLocale]);
|
|
298
|
+
}
|
|
299
|
+
// On-demand translate
|
|
300
|
+
scheduleTranslateOnDemand({
|
|
301
|
+
source: $_source,
|
|
302
|
+
context: $context,
|
|
303
|
+
id: $id,
|
|
304
|
+
hash: $_hash,
|
|
305
|
+
renderMessage: renderMessage,
|
|
306
|
+
});
|
|
307
|
+
// Default: return source while translation loads
|
|
308
|
+
return renderMessage($_source, [defaultLocale]);
|
|
266
309
|
};
|
|
267
|
-
return [2 /*return*/, t];
|
|
310
|
+
return [2 /*return*/, { t: t, m: m }];
|
|
268
311
|
}
|
|
269
312
|
});
|
|
270
313
|
});
|
|
271
314
|
}
|
|
315
|
+
// ---------------- Public API (kept stable) ---------------- //
|
|
272
316
|
/**
|
|
273
|
-
*
|
|
317
|
+
* getGT() returns a function that translates an ICU message string.
|
|
274
318
|
*
|
|
275
319
|
* @returns A promise of the t() function used for translating strings
|
|
276
320
|
*
|
|
277
321
|
* @example
|
|
278
|
-
* const t =
|
|
322
|
+
* const t = await getGT();
|
|
279
323
|
* console.log(t('Hello, world!')); // Translates 'Hello, world!'
|
|
280
324
|
*/
|
|
325
|
+
function getGT(_messages) {
|
|
326
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
327
|
+
var t;
|
|
328
|
+
return __generator(this, function (_a) {
|
|
329
|
+
switch (_a.label) {
|
|
330
|
+
case 0: return [4 /*yield*/, createTranslator(_messages)];
|
|
331
|
+
case 1:
|
|
332
|
+
t = (_a.sent()).t;
|
|
333
|
+
return [2 /*return*/, t];
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Hook wrapper for getGT
|
|
340
|
+
*/
|
|
281
341
|
function useGT(_messages) {
|
|
282
342
|
return (0, use_1.default)(getGT(_messages));
|
|
283
343
|
}
|
|
284
|
-
|
|
344
|
+
/**
|
|
345
|
+
* getMessages() returns a function that translates an encoded ICU message string.
|
|
346
|
+
*
|
|
347
|
+
* @returns A promise of the m() function used for translating encoded ICU message strings
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
* const encodedMsg = msg('Hello, world!')
|
|
351
|
+
* const m = await getMessages();
|
|
352
|
+
* console.log(m(encodedMsg)); // Translates 'Hello, world!'
|
|
353
|
+
*/
|
|
354
|
+
function getMessages(_messages) {
|
|
355
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
356
|
+
var m;
|
|
357
|
+
return __generator(this, function (_a) {
|
|
358
|
+
switch (_a.label) {
|
|
359
|
+
case 0: return [4 /*yield*/, createTranslator(_messages)];
|
|
360
|
+
case 1:
|
|
361
|
+
m = (_a.sent()).m;
|
|
362
|
+
return [2 /*return*/, m];
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Hook wrapper for getMessages
|
|
369
|
+
*/
|
|
370
|
+
function useMessages(_messages) {
|
|
371
|
+
return (0, use_1.default)(getMessages(_messages));
|
|
372
|
+
}
|
|
373
|
+
//# sourceMappingURL=getTranslationFunction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTranslationFunction.js","sourceRoot":"","sources":["../../../src/server-dir/buildtime/getTranslationFunction.ts"],"names":[],"mappings":";AAAA,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuVzC,sBAKC;AAKD,sBAEC;AAYD,kCAKC;AAKD,kCAEC;AAzXD,iFAA2D;AAC3D,uCAAyC;AACzC,4CAAmD;AACnD,0DAImC;AACnC,8CAO2B;AAC3B,wDAAkC;AAyBlC,SAAe,gBAAg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C;oBAClD,CAAC,CAAC;oBAEF,sBAAO,EAAE,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,EAAC;;;;CACjB;AAED,gEAAgE;AAEhE;;;;;;;;GAQG;AACH,SAAsB,KAAK,CACzB,SAAqB;;;;;wBAEP,qBAAM,gBAAgB,CAAC,SAAS,CAAC,EAAA;;oBAAvC,CAAC,GAAK,CAAA,SAAiC,CAAA,EAAtC;oBACT,sBAAO,CAAC,EAAC;;;;CACV;AAED;;GAEG;AACH,SAAgB,KAAK,CAAC,SAAqB;IACzC,OAAO,IAAA,aAAG,EAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;;;GASG;AACH,SAAsB,WAAW,CAC/B,SAAqB;;;;;wBAEP,qBAAM,gBAAgB,CAAC,SAAS,CAAC,EAAA;;oBAAvC,CAAC,GAAK,CAAA,SAAiC,CAAA,EAAtC;oBACT,sBAAO,CAAC,EAAC;;;;CACV;AAED;;GAEG;AACH,SAAgB,WAAW,CAAC,SAAqB;IAC/C,OAAO,IAAA,aAAG,EAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTranslations.d.ts","sourceRoot":"","sources":["../../../src/server-dir/buildtime/getTranslations.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAI7B,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"getTranslations.d.ts","sourceRoot":"","sources":["../../../src/server-dir/buildtime/getTranslations.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAI7B,MAAM,mBAAmB,CAAC;AAgB3B;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,EAAE,CAAC,EAAE,MAAM,GACV,OAAO,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,4BAA4B,KAAK,MAAM,CAAC,CAmKzE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,EAAE,CAAC,EAAE,MAAM,QAlL3B,MAAM,YAAY,4BAA4B,KAAK,MAAM,CAoLxE"}
|
|
@@ -146,9 +146,10 @@ function getTranslations(id) {
|
|
|
146
146
|
// Get dictionaryTranslation
|
|
147
147
|
var dictionaryTranslation = (0, internal_1.getDictionaryEntry)(dictionaryTranslations || {}, id);
|
|
148
148
|
// Check: invalid entry
|
|
149
|
-
if (
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
if (dictionaryTranslation !== undefined &&
|
|
150
|
+
(!(0, internal_1.isValidDictionaryEntry)(dictionaryTranslation) ||
|
|
151
|
+
typeof dictionaryTranslation !== 'string')) {
|
|
152
|
+
console.warn((0, createErrors_1.createInvalidDictionaryTranslationEntryWarning)(id));
|
|
152
153
|
return renderContent(entry, [defaultLocale]);
|
|
153
154
|
}
|
|
154
155
|
// Render dictionaryTranslation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTranslations.js","sourceRoot":"","sources":["../../../src/server-dir/buildtime/getTranslations.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getTranslations.js","sourceRoot":"","sources":["../../../src/server-dir/buildtime/getTranslations.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,0CAqKC;AAeD,0CAEC;AAxND,8CAK2B;AAE3B,iFAA2D;AAC3D,0DAMmC;AACnC,iFAA2D;AAC3D,qDAAoD;AACpD,yDAAmD;AACnD,4CAAmD;AACnD,wDAAkC;AAElC;;;;;;;;;;;;GAYG;AACH,SAAsB,eAAe,CACnC,EAAW;;;;;;oBAIL,KAAK,GAAG,UAAC,MAAc;wBAC3B,OAAO,EAAE,CAAC,CAAC,CAAC,UAAG,EAAE,cAAI,MAAM,CAAE,CAAC,C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D;gCACpD,sCAAsC;gCACtC,OAAO,CAAC,IAAI,CACV,IAAA,8CAA+B,wBAC1B,CAAC,EAAE,IAAI,EAAE,EAAE,IAAA,EAAE,CAAC,KACjB,MAAM,EAAE,aAAa,CAAC,KAAK,EAAE,CAAC,aAAa,CAAC,CAAC,EAC7C,WAAW,EAAE,aAAa,CAAC,MAAgB,EAAE;wCAC3C,MAAM;wCACN,aAAa;qCACd,CAAC,IACF,CACH,CAAC;4BACJ,CAAC,CAAC,CAAC;wBACL,CAAC;wBAAC,OAAO,KAAK,EAAE,CAAC;4BACf,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;wBACtB,CAAC;wBAED,qEAAqE;wBACrE,OAAO,aAAa,CAAC,KAAK,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;oBAC/C,CAAC,CAAC;oBAEF,sBAAO,CAAC,EAAC;;;;CACV;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,eAAe,CAAC,EAAW;IACzC,OAAO,IAAA,aAAG,EAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -4,12 +4,12 @@ import { getLocale } from './request/getLocale';
|
|
|
4
4
|
import { getTranslations } from './server-dir/buildtime/getTranslations';
|
|
5
5
|
import GTProvider from './provider/GTProvider';
|
|
6
6
|
import Tx from './server-dir/runtime/_Tx';
|
|
7
|
-
import { getGT } from './server-dir/buildtime/getGT';
|
|
8
7
|
import { LocaleProperties } from 'generaltranslation/types';
|
|
9
8
|
import { getLocaleDirection } from './request/getLocaleDirection';
|
|
9
|
+
import { getMessages, getGT } from './server-dir/buildtime/getTranslationFunction';
|
|
10
10
|
export declare function getDefaultLocale(): string;
|
|
11
11
|
export declare function getGTClass(): import("generaltranslation").GT;
|
|
12
12
|
export declare function getLocaleProperties(locale: string): LocaleProperties;
|
|
13
13
|
export declare function getLocales(): string[];
|
|
14
|
-
export { GTProvider, T, getGT, tx, Tx, getLocale,
|
|
14
|
+
export { GTProvider, T, getGT, getTranslations, getMessages, tx, Tx, getLocale, getLocaleDirection, };
|
|
15
15
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,0BAA0B,CAAC;AACzC,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAC1C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,0BAA0B,CAAC;AACzC,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EACL,WAAW,EACX,KAAK,EACN,MAAM,+CAA+C,CAAC;AAEvD,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,UAAU,oCAEzB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAEpE;AAED,wBAAgB,UAAU,IAAI,MAAM,EAAE,CAErC;AAED,OAAO,EACL,UAAU,EACV,CAAC,EACD,KAAK,EACL,eAAe,EACf,WAAW,EACX,EAAE,EACF,EAAE,EACF,SAAS,EACT,kBAAkB,GACnB,CAAC"}
|
package/dist/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.getLocaleDirection = exports.
|
|
6
|
+
exports.getLocaleDirection = exports.getLocale = exports.Tx = exports.tx = exports.getMessages = exports.getTranslations = exports.getGT = exports.T = exports.GTProvider = void 0;
|
|
7
7
|
exports.getDefaultLocale = getDefaultLocale;
|
|
8
8
|
exports.getGTClass = getGTClass;
|
|
9
9
|
exports.getLocaleProperties = getLocaleProperties;
|
|
@@ -21,10 +21,11 @@ var GTProvider_1 = __importDefault(require("./provider/GTProvider"));
|
|
|
21
21
|
exports.GTProvider = GTProvider_1.default;
|
|
22
22
|
var _Tx_1 = __importDefault(require("./server-dir/runtime/_Tx"));
|
|
23
23
|
exports.Tx = _Tx_1.default;
|
|
24
|
-
var getGT_1 = require("./server-dir/buildtime/getGT");
|
|
25
|
-
Object.defineProperty(exports, "getGT", { enumerable: true, get: function () { return getGT_1.getGT; } });
|
|
26
24
|
var getLocaleDirection_1 = require("./request/getLocaleDirection");
|
|
27
25
|
Object.defineProperty(exports, "getLocaleDirection", { enumerable: true, get: function () { return getLocaleDirection_1.getLocaleDirection; } });
|
|
26
|
+
var getTranslationFunction_1 = require("./server-dir/buildtime/getTranslationFunction");
|
|
27
|
+
Object.defineProperty(exports, "getMessages", { enumerable: true, get: function () { return getTranslationFunction_1.getMessages; } });
|
|
28
|
+
Object.defineProperty(exports, "getGT", { enumerable: true, get: function () { return getTranslationFunction_1.getGT; } });
|
|
28
29
|
function getDefaultLocale() {
|
|
29
30
|
return (0, getI18NConfig_1.default)().getDefaultLocale();
|
|
30
31
|
}
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;AAcA,4CAEC;AAED,gCAEC;AAED,kDAEC;AAED,gCAEC;AA5BD,+DAAyC;AAgCvC,YAhCK,WAAC,CAgCL;AA/BH,+DAAyC;AAmCvC,aAnCK,YAAE,CAmCL;AAlCJ,iDAAgD;AAoC9C,0FApCO,qBAAS,OAoCP;AAnCX,6EAAuD;AACvD,0EAAyE;AA8BvE,gGA9BO,iCAAe,OA8BP;AA7BjB,qEAA+C;AA0B7C,qBA1BK,oBAAU,CA0BL;AAzBZ,iEAA0C;AA+BxC,aA/BK,aAAE,CA+BL;AA7BJ,mEAAkE;AA+BhE,mGA/BO,uCAAkB,OA+BP;AA9BpB,wFAGuD;AAuBrD,4FAzBA,oCAAW,OAyBA;AAFX,sFAtBA,8BAAK,OAsBA;AAnBP,SAAgB,gBAAgB;IAC9B,OAAO,IAAA,uBAAa,GAAE,CAAC,gBAAgB,EAAE,CAAC;AAC5C,CAAC;AAED,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gt-next",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.1",
|
|
4
4
|
"description": "A Next.js library for automatic internationalization.",
|
|
5
5
|
"main": "dist/index.server.js",
|
|
6
6
|
"peerDependencies": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@generaltranslation/supported-locales": "^2.0.13",
|
|
17
17
|
"generaltranslation": "^7.4.1",
|
|
18
|
-
"gt-react": "^10.
|
|
18
|
+
"gt-react": "^10.4.1"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"patch": "npm version patch",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { InlineTranslationOptions, _Messages } from 'gt-react/internal';
|
|
2
|
-
/**
|
|
3
|
-
* getGT() returns a function that translates a string, being marked as translated at build time.
|
|
4
|
-
*
|
|
5
|
-
* @returns A promise of the t() function used for translating strings
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* const t = await getGT();
|
|
9
|
-
* console.log(t('Hello, world!')); // Translates 'Hello, world!'
|
|
10
|
-
*/
|
|
11
|
-
export declare function getGT(_messages?: _Messages): Promise<(message: string, options?: InlineTranslationOptions) => string>;
|
|
12
|
-
/**
|
|
13
|
-
* useGT() returns a function that translates a string, being marked as translated at build time.
|
|
14
|
-
*
|
|
15
|
-
* @returns A promise of the t() function used for translating strings
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* const t = useGT();
|
|
19
|
-
* console.log(t('Hello, world!')); // Translates 'Hello, world!'
|
|
20
|
-
*/
|
|
21
|
-
export declare function useGT(_messages?: _Messages): (message: string, options?: InlineTranslationOptions) => string;
|
|
22
|
-
//# sourceMappingURL=getGT.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getGT.d.ts","sourceRoot":"","sources":["../../../src/server-dir/buildtime/getGT.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,wBAAwB,EAExB,SAAS,EAEV,MAAM,mBAAmB,CAAC;AAG3B;;;;;;;;GAQG;AACH,wBAAsB,KAAK,CACzB,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE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