gt-next 6.2.5 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -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 -1
- package/dist/index.server.d.ts.map +1 -1
- package/dist/index.server.js +7 -1
- 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/getMessages.d.ts +34 -0
- package/dist/server-dir/buildtime/getMessages.d.ts.map +1 -0
- package/dist/server-dir/buildtime/getMessages.js +307 -0
- package/dist/server-dir/buildtime/getMessages.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 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +3 -1
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# gt-next
|
|
2
2
|
|
|
3
|
+
## 6.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`5950592`](https://github.com/generaltranslation/gt/commit/5950592ca44197915216ec5c8e26f9714cb4f55c)]:
|
|
12
|
+
- gt-react@10.4.0
|
|
13
|
+
|
|
3
14
|
## 6.2.5
|
|
4
15
|
|
|
5
16
|
### 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,yBAAyB,GAAI,IAAI,MAAM,EAAE,gBAAgB,MAAM,WACsJ,CAAC;AAEnO,eAAO,MAAM,kCAAkC,6KAA6K,CAAC;AAE7N,eAAO,MAAM,2BAA2B,GAAI,IAAI,MAAM,EAAE,cAAc,MAAM,WAC2G,CAAC;AAExL,eAAO,MAAM,uBAAuB,8NAA8N,CAAC;AAEnQ,eAAO,MAAM,mCAAmC,+MAA+M,CAAC;AAEhQ,eAAO,MAAM,qCAAqC,mNAAmN,CAAC;AAEtQ,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,WAK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,yBAAyB,GAAI,IAAI,MAAM,WACQ,CAAC;AAE7D,eAAO,MAAM,mCAAmC,GAAI,IAAI,MAAM,WACH,CAAC;AAE5D,eAAO,MAAM,8CAA8C,GAAI,IAAI,MAAM,WACF,CAAC;AAExE,eAAO,MAAM,+BAA+B,GAAI,SAAS,MAAM,EAAE,WAMhD,CAAC;AAElB,eAAO,MAAM,4BAA4B,GACvC,cAAc,MAAM,EACpB,cAAc,MAAM,WAE2L,CAAC;AAElN,eAAO,MAAM,oBAAoB,qMAAqM,CAAC;AAEvO,eAAO,MAAM,YAAY,QAIoE,CAAC;AAE9F,eAAO,MAAM,iBAAiB,QAGqF,CAAC;AAEpH,eAAO,MAAM,+BAA+B,GAAI,8BAI7C;IACD,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,WAK8E,CAAC;AAEhF,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.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;IAAnB,uBAAA,EAAA,WAAmB;IAC7D,OAAA,sHAA8G,MAAM,gDAA4C;AAAhK,CAAgK,CAAC;AADtJ,QAAA,2BAA2B,+BAC2H;AAE5J,IAAM,gCAAgC,GAAG,UAAC,KAAY;IAC3D,OAAA,yDAAkD,KAAK,CAAC,OAAO,CAAE;AAAjE,CAAiE,CAAC;AADvD,QAAA,gCAAgC,oCACuB;AAE7D,IAAM,4BAA4B,GAAG,UAC1C,MAAc,EACd,EAAW,EACX,YAAmB;IAAnB,6BAAA,EAAA,mBAAmB;IAEnB,OAAA,4CAAqC,YAAY,gBAAK,MAAM,gBAC1D,EAAE,CAAC,CAAC,CAAC,qBAAa,EAAE,OAAG,CAAC,CAAC,CAAC,EAAE,mCACE;AAFhC,CAEgC,CAAC;AAPtB,QAAA,4BAA4B,gCAON;AAE5B,IAAM,gCAAgC,GAAG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;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
|
@@ -11,12 +11,14 @@ import { useGT } from './server-dir/buildtime/getGT';
|
|
|
11
11
|
import { useTranslations } from './server-dir/buildtime/getTranslations';
|
|
12
12
|
import { useLocale } from './request/getLocale';
|
|
13
13
|
import { useLocaleDirection } from './request/getLocaleDirection';
|
|
14
|
+
import { msg, decodeMsg, decodeOptions } from 'gt-react/internal';
|
|
14
15
|
import { DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions } from 'gt-react';
|
|
15
16
|
import { GT } from 'generaltranslation';
|
|
17
|
+
import { useMessages } from './server-dir/buildtime/getMessages';
|
|
16
18
|
export { LocaleSelector, RegionSelector } from './index.client';
|
|
17
19
|
export declare function useGTClass(): GT;
|
|
18
20
|
export declare function useLocaleProperties(locale: string): import("generaltranslation/dist/locales/getLocaleProperties").LocaleProperties;
|
|
19
21
|
export declare function useLocales(): string[];
|
|
20
22
|
export declare function useDefaultLocale(): string;
|
|
21
|
-
export { GTProvider, T, Tx, Var, Num, Currency, DateTime, Branch, Plural, useGT, useTranslations, useLocale, useLocaleDirection, DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions, };
|
|
23
|
+
export { GTProvider, T, Tx, Var, Num, Currency, DateTime, Branch, Plural, useGT, useTranslations, useMessages, useLocale, useLocaleDirection, DictionaryTranslationOptions, InlineTranslationOptions, RuntimeTranslationOptions, msg, decodeMsg, decodeOptions, };
|
|
22
24
|
//# 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,KAAK,EAAE,MAAM,8B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AAc,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;
|
|
@@ -35,6 +35,12 @@ Object.defineProperty(exports, "useLocale", { enumerable: true, get: function ()
|
|
|
35
35
|
var getLocaleDirection_1 = require("./request/getLocaleDirection");
|
|
36
36
|
Object.defineProperty(exports, "useLocaleDirection", { enumerable: true, get: function () { return getLocaleDirection_1.useLocaleDirection; } });
|
|
37
37
|
var getI18NConfig_1 = __importDefault(require("./config-dir/getI18NConfig"));
|
|
38
|
+
var internal_1 = require("gt-react/internal");
|
|
39
|
+
Object.defineProperty(exports, "msg", { enumerable: true, get: function () { return internal_1.msg; } });
|
|
40
|
+
Object.defineProperty(exports, "decodeMsg", { enumerable: true, get: function () { return internal_1.decodeMsg; } });
|
|
41
|
+
Object.defineProperty(exports, "decodeOptions", { enumerable: true, get: function () { return internal_1.decodeOptions; } });
|
|
42
|
+
var getMessages_1 = require("./server-dir/buildtime/getMessages");
|
|
43
|
+
Object.defineProperty(exports, "useMessages", { enumerable: true, get: function () { return getMessages_1.useMessages; } });
|
|
38
44
|
var index_client_1 = require("./index.client");
|
|
39
45
|
Object.defineProperty(exports, "LocaleSelector", { enumerable: true, get: function () { return index_client_1.LocaleSelector; } });
|
|
40
46
|
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":";;;;;;AAyBA,gCAEC;AAED,kDAEC;AAED,gCAEC;AAED,4CAEC;AAvCD,wDAAkC;AA6ChC,cA7CK,aAAG,CA6CL;AA5CL,wDAAkC;AA6ChC,cA7CK,aAAG,CA6CL;AA5CL,kEAA4C;AA6C1C,mBA7CK,kBAAQ,CA6CL;AA5CV,kEAA4C;AA6C1C,mBA7CK,kBAAQ,CA6CL;AA5CV,+DAAyC;AAuCvC,YAvCK,WAAC,CAuCL;AAtCH,6DAAuC;AA4CrC,iBA5CK,gBAAM,CA4CL;AA3CR,6DAAuC;AA4CrC,iBA5CK,gBAAM,CA4CL;AA3CR,qEAA+C;AAmC7C,qBAnCK,oBAAU,CAmCL;AAlCZ,mCAA8B;AAoC5B,mFApCO,WAAE,OAoCP;AAnCJ,sDAAqD;AA0CnD,sFA1CO,aAAK,OA0CP;AAzCP,0EAAyE;AA0CvE,gGA1CO,iCAAe,OA0CP;AAzCjB,iDAAgD;AA2C9C,0FA3CO,qBAAS,OA2CP;AA1CX,mEAAkE;AA2ChE,mGA3CO,uCAAkB,OA2CP;AA1CpB,6EAAuD;AACvD,8CAAkE;AA6ChE,oFA7CO,cAAG,OA6CP;AACH,0FA9CY,oBAAS,OA8CZ;AACT,8FA/CuB,wBAAa,OA+CvB;AAxCf,kEAAiE;AAgC/D,4FAhCO,yBAAW,OAgCP;AA9Bb,+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,EACrB,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,MAAM,IAAI,OAAO,EACjB,MAAM,IAAI,OAAO,EACjB,cAAc,IAAI,eAAe,EACjC,cAAc,IAAI,eAAe,EACjC,kBAAkB,IAAI,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.types.d.ts","sourceRoot":"","sources":["../src/index.types.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAC1C,OAAO,EACL,KAAK,IAAI,MAAM,EACf,eAAe,IAAI,gBAAgB,EACnC,SAAS,IAAI,UAAU,EACvB,UAAU,IAAI,WAAW,EACzB,gBAAgB,IAAI,iBAAiB,EACrC,UAAU,IAAI,WAAW,EACzB,mBAAmB,IAAI,oBAAoB,EAC3C,QAAQ,IAAI,SAAS,EACrB,QAAQ,IAAI,SAAS,EACrB,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,MAAM,IAAI,OAAO,EACjB,MAAM,IAAI,OAAO,EACjB,cAAc,IAAI,eAAe,EACjC,cAAc,IAAI,eAAe,EACjC,kBAAkB,IAAI,mBAAmB,EACzC,WAAW,IAAI,YAAY,EAC5B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,4BAA4B,EAC5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O,MAAM,UAAU,EAAE,OAAO,WAE/B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,OAAO,oBAExC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAAO,mBAEvC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,cAAc,EAAE,OAAO,eAEnC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,EAAE,OAAO,YAEhC,CAAC;AAEF,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,GAC1B,CAAC;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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AAC;AAFW,QAAA,WAAW,eAEtB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { InlineTranslationOptions, _Messages } from 'gt-react/internal';
|
|
2
|
+
/**
|
|
3
|
+
* Gets the message decoding and translation function `m` provided by `<GTProvider>`.
|
|
4
|
+
*
|
|
5
|
+
* @returns {Function} A translation function that accepts an encoded message, decodes it, and returns the translated value.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const encodedMessage = msg("Hello, world")
|
|
9
|
+
* const m = await getMessages();
|
|
10
|
+
* m(encodedMessage) // returns "Hello, world" translated
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const encodedMessage = msg("My name is {name}", { name: "Brian" });
|
|
14
|
+
* const m = await getMessages();
|
|
15
|
+
* m(encodedMessage) // returns "My name is Brian" translated
|
|
16
|
+
*/
|
|
17
|
+
export declare function getMessages(_messages?: _Messages): Promise<(message: string, options?: InlineTranslationOptions) => string>;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the message decoding and translation function `m` provided by `<GTProvider>`.
|
|
20
|
+
*
|
|
21
|
+
* @returns {Function} A translation function that accepts an encoded message, decodes it, and returns the translated value.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const encodedMessage = msg("Hello, world")
|
|
25
|
+
* const m = useMessages();
|
|
26
|
+
* m(encodedMessage) // returns "Hello, world" translated
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const encodedMessage = msg("My name is {name}", { name: "Brian" });
|
|
30
|
+
* const m = useMessages();
|
|
31
|
+
* m(encodedMessage) // returns "My name is Brian" translated
|
|
32
|
+
*/
|
|
33
|
+
export declare function useMessages(_messages?: _Messages): (message: string, options?: InlineTranslationOptions) => string;
|
|
34
|
+
//# sourceMappingURL=getMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMessages.d.ts","sourceRoot":"","sources":["../../../src/server-dir/buildtime/getMessages.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,wBAAwB,EAExB,SAAS,EAIV,MAAM,mBAAmB,CAAC;AAG3B;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,WAAW,CAC/B,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB,KAAK,MAAM,CAAC,CAqP1E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,SAAS,CAAC,EAAE,SAAS,aAtQ5B,MAAM,YAAY,wBAAwB,KAAK,MAAM,CAwQzE"}
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
50
|
+
var t = {};
|
|
51
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
52
|
+
t[p] = s[p];
|
|
53
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
54
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
55
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
56
|
+
t[p[i]] = s[p[i]];
|
|
57
|
+
}
|
|
58
|
+
return t;
|
|
59
|
+
};
|
|
60
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
61
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
62
|
+
};
|
|
63
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
|
+
exports.getMessages = getMessages;
|
|
65
|
+
exports.useMessages = useMessages;
|
|
66
|
+
var getI18NConfig_1 = __importDefault(require("../../config-dir/getI18NConfig"));
|
|
67
|
+
var server_1 = require("../../server");
|
|
68
|
+
var id_1 = require("generaltranslation/id");
|
|
69
|
+
var createErrors_1 = require("../../errors/createErrors");
|
|
70
|
+
var internal_1 = require("gt-react/internal");
|
|
71
|
+
var use_1 = __importDefault(require("../../utils/use"));
|
|
72
|
+
/**
|
|
73
|
+
* Gets the message decoding and translation function `m` provided by `<GTProvider>`.
|
|
74
|
+
*
|
|
75
|
+
* @returns {Function} A translation function that accepts an encoded message, decodes it, and returns the translated value.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* const encodedMessage = msg("Hello, world")
|
|
79
|
+
* const m = await getMessages();
|
|
80
|
+
* m(encodedMessage) // returns "Hello, world" translated
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* const encodedMessage = msg("My name is {name}", { name: "Brian" });
|
|
84
|
+
* const m = await getMessages();
|
|
85
|
+
* m(encodedMessage) // returns "My name is Brian" translated
|
|
86
|
+
*/
|
|
87
|
+
function getMessages(_messages) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
89
|
+
// --------- HELPER FUNCTIONS ------- //
|
|
90
|
+
function initializeT(message, options) {
|
|
91
|
+
if (options === void 0) { options = {}; }
|
|
92
|
+
if (!message || typeof message !== 'string')
|
|
93
|
+
return null;
|
|
94
|
+
var id = options.$id, context = options.$context, _hash = options.$_hash, variables = __rest(options, ["$id", "$context", "$_hash"]);
|
|
95
|
+
// Update renderContent to use actual variables
|
|
96
|
+
var renderMessage = function (msg, locales) {
|
|
97
|
+
return gt.formatMessage(msg, {
|
|
98
|
+
locales: locales,
|
|
99
|
+
variables: variables,
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
// Calculate hash
|
|
103
|
+
var calculateHash = function () {
|
|
104
|
+
return (0, id_1.hashSource)(__assign(__assign(__assign({ source: message }, (context && { context: context })), (id && { id: id })), { dataFormat: 'ICU' }));
|
|
105
|
+
};
|
|
106
|
+
return {
|
|
107
|
+
id: id,
|
|
108
|
+
context: context,
|
|
109
|
+
_hash: _hash,
|
|
110
|
+
variables: variables,
|
|
111
|
+
calculateHash: calculateHash,
|
|
112
|
+
renderMessage: renderMessage,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function getTranslationData(calculateHash, id, _hash) {
|
|
116
|
+
var translationEntry;
|
|
117
|
+
var hash = ''; // empty string because 1) it has to be a string but 2) we don't always need to calculate it
|
|
118
|
+
if (id) {
|
|
119
|
+
translationEntry = translations === null || translations === void 0 ? void 0 : translations[id];
|
|
120
|
+
}
|
|
121
|
+
if (_hash && (translations === null || translations === void 0 ? void 0 : translations[_hash])) {
|
|
122
|
+
hash = _hash;
|
|
123
|
+
translationEntry = translations === null || translations === void 0 ? void 0 : translations[_hash];
|
|
124
|
+
}
|
|
125
|
+
// Use calculated hash to index
|
|
126
|
+
if (!translationEntry) {
|
|
127
|
+
hash = calculateHash();
|
|
128
|
+
translationEntry = translations === null || translations === void 0 ? void 0 : translations[hash];
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
translationEntry: translationEntry,
|
|
132
|
+
hash: hash,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
var I18NConfig, locale, defaultLocale, translationRequired, gt, translations, _a, preloadedTranslations, preload, m;
|
|
136
|
+
var _this = this;
|
|
137
|
+
return __generator(this, function (_b) {
|
|
138
|
+
switch (_b.label) {
|
|
139
|
+
case 0:
|
|
140
|
+
I18NConfig = (0, getI18NConfig_1.default)();
|
|
141
|
+
return [4 /*yield*/, (0, server_1.getLocale)()];
|
|
142
|
+
case 1:
|
|
143
|
+
locale = _b.sent();
|
|
144
|
+
defaultLocale = I18NConfig.getDefaultLocale();
|
|
145
|
+
translationRequired = I18NConfig.requiresTranslation(locale)[0];
|
|
146
|
+
gt = I18NConfig.getGTClass();
|
|
147
|
+
if (!translationRequired) return [3 /*break*/, 3];
|
|
148
|
+
return [4 /*yield*/, I18NConfig.getCachedTranslations(locale)];
|
|
149
|
+
case 2:
|
|
150
|
+
_a = _b.sent();
|
|
151
|
+
return [3 /*break*/, 4];
|
|
152
|
+
case 3:
|
|
153
|
+
_a = undefined;
|
|
154
|
+
_b.label = 4;
|
|
155
|
+
case 4:
|
|
156
|
+
translations = _a;
|
|
157
|
+
if (!(internal_1.reactHasUse &&
|
|
158
|
+
_messages &&
|
|
159
|
+
I18NConfig.isDevelopmentApiEnabled() &&
|
|
160
|
+
translationRequired)) return [3 /*break*/, 6];
|
|
161
|
+
preloadedTranslations = {};
|
|
162
|
+
preload = function (_a) { return __awaiter(_this, void 0, void 0, function () {
|
|
163
|
+
var init, id, context, _hash, calculateHash, _b, translationEntry, hash, _c, _d, error_1;
|
|
164
|
+
var message = _a.message, options = __rest(_a, ["message"]);
|
|
165
|
+
return __generator(this, function (_e) {
|
|
166
|
+
switch (_e.label) {
|
|
167
|
+
case 0:
|
|
168
|
+
// Early return if possible
|
|
169
|
+
if (!message)
|
|
170
|
+
return [2 /*return*/];
|
|
171
|
+
init = initializeT(message, options);
|
|
172
|
+
if (!init)
|
|
173
|
+
return [2 /*return*/];
|
|
174
|
+
id = init.id, context = init.context, _hash = init._hash, calculateHash = init.calculateHash;
|
|
175
|
+
_b = getTranslationData(calculateHash, id, _hash), translationEntry = _b.translationEntry, hash = _b.hash;
|
|
176
|
+
// Return if no translation needed
|
|
177
|
+
if (translationEntry)
|
|
178
|
+
return [2 /*return*/];
|
|
179
|
+
_e.label = 1;
|
|
180
|
+
case 1:
|
|
181
|
+
_e.trys.push([1, 3, , 4]);
|
|
182
|
+
_c = preloadedTranslations;
|
|
183
|
+
_d = hash;
|
|
184
|
+
return [4 /*yield*/, I18NConfig.translateIcu({
|
|
185
|
+
source: message,
|
|
186
|
+
targetLocale: locale,
|
|
187
|
+
options: __assign(__assign(__assign({}, (context && { context: context })), (id && { id: id })), { hash: hash }),
|
|
188
|
+
})];
|
|
189
|
+
case 2:
|
|
190
|
+
_c[_d] =
|
|
191
|
+
(_e.sent());
|
|
192
|
+
return [3 /*break*/, 4];
|
|
193
|
+
case 3:
|
|
194
|
+
error_1 = _e.sent();
|
|
195
|
+
console.warn(error_1);
|
|
196
|
+
return [3 /*break*/, 4];
|
|
197
|
+
case 4: return [2 /*return*/];
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}); };
|
|
201
|
+
return [4 /*yield*/, Promise.all(_messages.map(preload))];
|
|
202
|
+
case 5:
|
|
203
|
+
_b.sent();
|
|
204
|
+
_b.label = 6;
|
|
205
|
+
case 6:
|
|
206
|
+
m = function (encodedMsg, options) {
|
|
207
|
+
if (options === void 0) { options = {}; }
|
|
208
|
+
// Decode message and return if it's invalid
|
|
209
|
+
var decodedOptions = (0, internal_1.decodeOptions)(encodedMsg);
|
|
210
|
+
if (!decodedOptions || !decodedOptions.$_hash || !decodedOptions.$_source) {
|
|
211
|
+
return encodedMsg;
|
|
212
|
+
}
|
|
213
|
+
var $_hash = decodedOptions.$_hash, $_source = decodedOptions.$_source, $context = decodedOptions.$context, $hash = decodedOptions.$hash, $id = decodedOptions.$id, decodedVariables = __rest(decodedOptions, ["$_hash", "$_source", "$context", "$hash", "$id"]);
|
|
214
|
+
var renderMessage = function (msg, locales) {
|
|
215
|
+
return gt.formatMessage(msg, {
|
|
216
|
+
locales: locales,
|
|
217
|
+
variables: __assign(__assign({}, decodedVariables), options),
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
// Return if default locale
|
|
221
|
+
if (!translationRequired)
|
|
222
|
+
return renderMessage($_source, [defaultLocale]);
|
|
223
|
+
// Check translation entry
|
|
224
|
+
var translationEntry = translations === null || translations === void 0 ? void 0 : translations[decodedOptions.$_hash];
|
|
225
|
+
// Check translations
|
|
226
|
+
if (translationEntry === null) {
|
|
227
|
+
return renderMessage($_source, [defaultLocale]);
|
|
228
|
+
}
|
|
229
|
+
// If a translation already exists
|
|
230
|
+
if (translationEntry) {
|
|
231
|
+
try {
|
|
232
|
+
return renderMessage(translationEntry, [
|
|
233
|
+
locale,
|
|
234
|
+
defaultLocale,
|
|
235
|
+
]);
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
console.error((0, createErrors_1.createStringRenderError)($_source, (0, internal_1.decodeMsg)(encodedMsg)), 'Error: ', error);
|
|
239
|
+
return renderMessage($_source, [defaultLocale]);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (!I18NConfig.isDevelopmentApiEnabled()) {
|
|
243
|
+
console.warn((0, createErrors_1.createStringTranslationError)($_source, (0, internal_1.decodeMsg)(encodedMsg), 'm'));
|
|
244
|
+
return renderMessage($_source, [defaultLocale]);
|
|
245
|
+
}
|
|
246
|
+
if (typeof (preloadedTranslations === null || preloadedTranslations === void 0 ? void 0 : preloadedTranslations[$_hash]) !== 'undefined') {
|
|
247
|
+
if (preloadedTranslations === null || preloadedTranslations === void 0 ? void 0 : preloadedTranslations[$_hash]) {
|
|
248
|
+
try {
|
|
249
|
+
return renderMessage(preloadedTranslations === null || preloadedTranslations === void 0 ? void 0 : preloadedTranslations[$_hash], [
|
|
250
|
+
locale,
|
|
251
|
+
defaultLocale,
|
|
252
|
+
]);
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
console.error((0, createErrors_1.createStringRenderError)($_source, (0, internal_1.decodeMsg)(encodedMsg)), 'Error: ', error);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return renderMessage($_source, [defaultLocale]);
|
|
259
|
+
}
|
|
260
|
+
// Translate on demand
|
|
261
|
+
try {
|
|
262
|
+
I18NConfig.translateIcu({
|
|
263
|
+
source: $_source,
|
|
264
|
+
targetLocale: locale,
|
|
265
|
+
options: __assign(__assign({}, ($context && { context: $context })), { hash: $_hash }),
|
|
266
|
+
}).then(function (result) {
|
|
267
|
+
// Log the translation result for debugging purposes
|
|
268
|
+
// eslint-disable-next-line no-console
|
|
269
|
+
console.warn((0, createErrors_1.createTranslationLoadingWarning)({
|
|
270
|
+
source: renderMessage($_source, [defaultLocale]),
|
|
271
|
+
translation: renderMessage(result, [
|
|
272
|
+
locale,
|
|
273
|
+
defaultLocale,
|
|
274
|
+
]),
|
|
275
|
+
}));
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
console.warn(error);
|
|
280
|
+
}
|
|
281
|
+
// Default is returning source, rather than returning a loading state
|
|
282
|
+
return renderMessage($_source, [defaultLocale]);
|
|
283
|
+
};
|
|
284
|
+
return [2 /*return*/, m];
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Gets the message decoding and translation function `m` provided by `<GTProvider>`.
|
|
291
|
+
*
|
|
292
|
+
* @returns {Function} A translation function that accepts an encoded message, decodes it, and returns the translated value.
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* const encodedMessage = msg("Hello, world")
|
|
296
|
+
* const m = useMessages();
|
|
297
|
+
* m(encodedMessage) // returns "Hello, world" translated
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* const encodedMessage = msg("My name is {name}", { name: "Brian" });
|
|
301
|
+
* const m = useMessages();
|
|
302
|
+
* m(encodedMessage) // returns "My name is Brian" translated
|
|
303
|
+
*/
|
|
304
|
+
function useMessages(_messages) {
|
|
305
|
+
return (0, use_1.default)(getMessages(_messages));
|
|
306
|
+
}
|
|
307
|
+
//# sourceMappingURL=getMessages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMessages.js","sourceRoot":"","sources":["../../../src/server-dir/buildtime/getMessages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,kCAuPC;AAiBD,kCAEC;AA3SD,iFAA2D;AAC3D,uCAAyC;AACzC,4CAAmD;AACnD,0DAImC;AACnC,8CAO2B;AAC3B,wDAAkC;AAElC;;;;;;;;;;;;;;GAcG;AACH,SAAsB,WAAW,CAC/B,SAAqB;;QAarB,wCAAwC;QAExC,SAAS,WAAW,CAClB,OAAe,EACf,OAIM;YAJN,wBAAA,EAAA,YAIM;YAEN,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAC;YAEjD,IAAK,EAAE,GAAqD,OAAO,IAA5D,EAAY,OAAO,GAAkC,OAAO,SAAzC,EAAU,KAAK,GAAmB,OAAO,OAA1B,EAAK,SAAS,UAAK,OAAO,EAArE,6BAA2D,CAAF,CAAa;YAE5E,+CAA+C;YAC/C,IAAM,aAAa,GAAG,UAAC,GAAW,EAAE,OAAiB;gBACnD,OAAO,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE;oBAC3B,OAAO,SAAA;oBACP,SAAS,WAAA;iBACV,CAAC,CAAC;YACL,CAAC,CAAC;YAEF,iBAAiB;YACjB,IAAM,aAAa,GAAG;gBACpB,OAAA,IAAA,eAAU,+BACR,MAAM,EAAE,OAAO,IACZ,CAAC,O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AAA,oBAAS,EAAC,UAAU,CAAC,CAAC,EACxD,SAAS,EACT,KAAK,CACN,CAAC;gCACJ,CAAC;4BACH,CAAC;4BACD,OAAO,aAAa,CAAC,QAAQ,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;wBAClD,CAAC;wBAED,sBAAsB;wBACtB,IAAI,CAAC;4BACH,UAAU,CAAC,YAAY,CAAC;gCACtB,MAAM,EAAE,QAAQ;gCAChB,YAAY,EAAE,MAAM;gCACpB,OAAO,wBACF,CAAC,QAAQ,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,KACtC,IAAI,EAAE,MAAM,GACb;6BACF,CAAC,CAAC,IAAI,CAAC,UAAC,MAAM;gCACb,oDAAoD;gCACpD,sCAAsC;gCACtC,OAAO,CAAC,IAAI,CACV,IAAA,8CAA+B,EAAC;oCAC9B,MAAM,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,aAAa,CAAC,CAAC;oCAChD,WAAW,EAAE,aAAa,CAAC,MAAgB,EAAE;wCAC3C,MAAM;wCACN,aAAa;qCACd,CAAC;iCACH,CAAC,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,QAAQ,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;oBAClD,CAAC,CAAC;oBAEF,sBAAO,CAAC,EAAC;;;;CACV;AAED;;;;;;;;;;;;;;GAcG;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":";;;;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AAC,CAAC,CAAC;wBAC/C,CAAC;wBAED,IAAI,CAAC;4BACH,sBAAsB;4BACtB,UAAU,CAAC,YAAY,CAAC;gCACtB,MAAM,EAAE,KAAK;gCACb,YAAY,EAAE,MAAM;gCACpB,OAAO,wBACF,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ,KAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,KACzD,EAAE,IAAA,EACF,IAAI,MAAA,GACL;6BACF,CAAC,CAAC,IAAI,CAAC,UAAC,MAAM;gCACb,oDAAoD;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
|
@@ -7,9 +7,10 @@ import Tx from './server-dir/runtime/_Tx';
|
|
|
7
7
|
import { getGT } from './server-dir/buildtime/getGT';
|
|
8
8
|
import { LocaleProperties } from 'generaltranslation/types';
|
|
9
9
|
import { getLocaleDirection } from './request/getLocaleDirection';
|
|
10
|
+
import { getMessages } from './server-dir/buildtime/getMessages';
|
|
10
11
|
export declare function getDefaultLocale(): string;
|
|
11
12
|
export declare function getGTClass(): import("generaltranslation").GT;
|
|
12
13
|
export declare function getLocaleProperties(locale: string): LocaleProperties;
|
|
13
14
|
export declare function getLocales(): string[];
|
|
14
|
-
export { GTProvider, T, getGT, tx, Tx, getLocale,
|
|
15
|
+
export { GTProvider, T, getGT, getTranslations, getMessages, tx, Tx, getLocale, getLocaleDirection, };
|
|
15
16
|
//# 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,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;
|
|
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,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEjE,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;
|
|
@@ -25,6 +25,8 @@ var getGT_1 = require("./server-dir/buildtime/getGT");
|
|
|
25
25
|
Object.defineProperty(exports, "getGT", { enumerable: true, get: function () { return getGT_1.getGT; } });
|
|
26
26
|
var getLocaleDirection_1 = require("./request/getLocaleDirection");
|
|
27
27
|
Object.defineProperty(exports, "getLocaleDirection", { enumerable: true, get: function () { return getLocaleDirection_1.getLocaleDirection; } });
|
|
28
|
+
var getMessages_1 = require("./server-dir/buildtime/getMessages");
|
|
29
|
+
Object.defineProperty(exports, "getMessages", { enumerable: true, get: function () { return getMessages_1.getMessages; } });
|
|
28
30
|
function getDefaultLocale() {
|
|
29
31
|
return (0, getI18NConfig_1.default)().getDefaultLocale();
|
|
30
32
|
}
|
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":";;;;;;AAYA,4CAEC;AAED,gCAEC;AAED,kDAEC;AAED,gCAEC;AA1BD,+DAAyC;AA8BvC,YA9BK,WAAC,CA8BL;AA7BH,+DAAyC;AAiCvC,aAjCK,YAAE,CAiCL;AAhCJ,iDAAgD;AAkC9C,0FAlCO,qBAAS,OAkCP;AAjCX,6EAAuD;AACvD,0EAAyE;AA4BvE,gGA5BO,iCAAe,OA4BP;AA3BjB,qEAA+C;AAwB7C,qBAxBK,oBAAU,CAwBL;AAvBZ,iEAA0C;AA6BxC,aA7BK,aAAE,CA6BL;AA5BJ,sDAAqD;AAwBnD,sFAxBO,aAAK,OAwBP;AAtBP,mEAAkE;AA4BhE,mGA5BO,uCAAkB,OA4BP;AA3BpB,kEAAiE;AAuB/D,4FAvBO,yBAAW,OAuBP;AArBb,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.0",
|
|
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.0"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"patch": "npm version patch",
|