gt-next 5.2.37 → 5.2.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/branches/Plural.d.ts +4 -4
- package/dist/branches/Plural.d.ts.map +1 -1
- package/dist/branches/Plural.js +7 -48
- package/dist/branches/Plural.js.map +1 -1
- package/dist/index.client.d.ts +2 -2
- package/dist/index.client.d.ts.map +1 -1
- package/dist/index.client.js +1 -3
- package/dist/index.client.js.map +1 -1
- package/dist/index.server.d.ts +9 -2
- package/dist/index.server.d.ts.map +1 -1
- package/dist/index.server.js +25 -11
- package/dist/index.server.js.map +1 -1
- package/dist/index.types.d.ts +16 -35
- package/dist/index.types.d.ts.map +1 -1
- package/dist/index.types.js +16 -41
- package/dist/index.types.js.map +1 -1
- package/dist/provider/GTProvider.js +2 -2
- package/dist/provider/GTProvider.js.map +1 -1
- package/dist/request/getLocale.d.ts +2 -1
- package/dist/request/getLocale.d.ts.map +1 -1
- package/dist/request/getLocale.js +6 -1
- package/dist/request/getLocale.js.map +1 -1
- package/dist/server-dir/buildtime/T.js +2 -2
- package/dist/server-dir/buildtime/T.js.map +1 -1
- package/dist/server-dir/buildtime/getGT.d.ts +11 -1
- package/dist/server-dir/buildtime/getGT.d.ts.map +1 -1
- package/dist/server-dir/buildtime/getGT.js +16 -9
- package/dist/server-dir/buildtime/getGT.js.map +1 -1
- package/dist/server-dir/buildtime/getTranslations.d.ts +16 -2
- package/dist/server-dir/buildtime/getTranslations.d.ts.map +1 -1
- package/dist/server-dir/buildtime/getTranslations.js +22 -4
- package/dist/server-dir/buildtime/getTranslations.js.map +1 -1
- package/dist/server-dir/runtime/_Tx.js +2 -2
- package/dist/server-dir/runtime/_Tx.js.map +1 -1
- package/dist/server-dir/runtime/tx.js +2 -2
- package/dist/server-dir/runtime/tx.js.map +1 -1
- package/dist/server.d.ts +4 -3
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +11 -7
- package/dist/server.js.map +1 -1
- package/dist/utils/use.d.ts +4 -0
- package/dist/utils/use.d.ts.map +1 -0
- package/dist/utils/use.js +73 -0
- package/dist/utils/use.js.map +1 -0
- package/dist/variables/Currency.d.ts +3 -3
- package/dist/variables/Currency.d.ts.map +1 -1
- package/dist/variables/Currency.js +12 -57
- package/dist/variables/Currency.js.map +1 -1
- package/dist/variables/DateTime.d.ts +3 -3
- package/dist/variables/DateTime.d.ts.map +1 -1
- package/dist/variables/DateTime.js +24 -69
- package/dist/variables/DateTime.js.map +1 -1
- package/dist/variables/Num.d.ts +2 -2
- package/dist/variables/Num.d.ts.map +1 -1
- package/dist/variables/Num.js +12 -57
- package/dist/variables/Num.js.map +1 -1
- package/package.json +2 -2
|
@@ -39,9 +39,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.
|
|
42
|
+
exports.getLocale = getLocale;
|
|
43
|
+
exports.useLocale = useLocale;
|
|
43
44
|
var getI18NConfig_1 = __importDefault(require("../config-dir/getI18NConfig"));
|
|
44
45
|
var getNextLocale_1 = require("../next/getNextLocale");
|
|
46
|
+
var use_1 = __importDefault(require("../utils/use"));
|
|
45
47
|
var getLocaleFunction;
|
|
46
48
|
/**
|
|
47
49
|
* Gets the user's current locale.
|
|
@@ -96,4 +98,7 @@ function getLocale() {
|
|
|
96
98
|
});
|
|
97
99
|
});
|
|
98
100
|
}
|
|
101
|
+
function useLocale() {
|
|
102
|
+
return (0, use_1.default)(getLocale());
|
|
103
|
+
}
|
|
99
104
|
//# sourceMappingURL=getLocale.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLocale.js","sourceRoot":"","sources":["../../src/request/getLocale.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getLocale.js","sourceRoot":"","sources":["../../src/request/getLocale.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,8BAwBC;AAED,8BAEC;AA3CD,8EAAwD;AACxD,uDAAsD;AACtD,qDAA+B;AAE/B,IAAI,iBAAwC,CAAC;AAE7C;;;;;;;;GAQG;AACH,SAAsB,SAAS;;;;;;;yBACzB,iBAAiB,EAAjB,wBAAiB;oBAAS,qBAAM,iBAAiB,EAAE,EAAA;wBAAhC,sBAAO,SAAyB,EAAC;;yBAEpD,CAAA,OAAO,CAAC,GAAG,CAAC,6CAA6C,KAAK,MAAM,CAAA,EAApE,wBAAoE;;;;oBAE9D,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;oBAClD,eAAe,GACnB,CAAA,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,OAAO,KAAI,mBAAmB,CAAC,SAAS,CAAC;oBACjD,qBAAM,eAAe,EAAE,EAAA;;oBAAhC,MAAM,GAAG,SAAuB;oBACtC,iBAAiB,GAAG,eAAe,CAAC;oBACpC,sBAAO,MAAM,EAAC;;;;;oBAKZ,UAAU,GAAG,IAAA,uBAAa,GAAE,CAAC;oBACnC,iBAAiB,GAAG;;;;wCACN,qBAAM,IAAA,6BAAa,EAC7B,UAAU,CAAC,gBAAgB,EAAE,EAC7B,UAAU,CAAC,UAAU,EAAE,CACxB,EAAA;;oCAHK,GAAG,GAAG,SAGX;oCACD,sBAAO,GAAG,EAAC;;;yBACZ,CAAC;oBACK,qBAAM,iBAAiB,EAAE,EAAA;wBAAhC,sBAAO,SAAyB,EAAC;;;;CAClC;AAED,SAAgB,SAAS;IACvB,OAAO,IAAA,aAAG,EAAC,SAAS,EAAE,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -52,7 +52,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
54
54
|
var getI18NConfig_1 = __importDefault(require("../../config-dir/getI18NConfig"));
|
|
55
|
-
var getLocale_1 =
|
|
55
|
+
var getLocale_1 = require("../../request/getLocale");
|
|
56
56
|
var react_1 = require("react");
|
|
57
57
|
var internal_1 = require("gt-react/internal");
|
|
58
58
|
var renderVariable_1 = __importDefault(require("../variables/renderVariable"));
|
|
@@ -106,7 +106,7 @@ function T(_a) {
|
|
|
106
106
|
switch (_d.label) {
|
|
107
107
|
case 0:
|
|
108
108
|
I18NConfig = (0, getI18NConfig_1.default)();
|
|
109
|
-
return [4 /*yield*/, (0, getLocale_1.
|
|
109
|
+
return [4 /*yield*/, (0, getLocale_1.getLocale)()];
|
|
110
110
|
case 1:
|
|
111
111
|
locale = _d.sent();
|
|
112
112
|
defaultLocale = I18NConfig.getDefaultLocale();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"T.js","sourceRoot":"","sources":["../../../src/server-dir/buildtime/T.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iFAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"T.js","sourceRoot":"","sources":["../../../src/server-dir/buildtime/T.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iFAA2D;AAC3D,qDAAoD;AACpD,+BAAiC;AACjC,8CAO2B;AAC3B,+EAAyD;AAEzD,4CAAwD;AAExD,SAAe,QAAQ;wDAAC,EAA2C;YAAzC,QAAQ,cAAA;;;wBACzB,qBAAM,QAAQ,EAAA;wBAArB,sBAAO,SAAc,EAAC;;;;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,SAAe,CAAC;wDAAC,EAQhB;;;YAPC,QAAQ,cAAA,EACR,EAAE,QAAA,EACF,OAAO,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AM;4CACpB,OAAO,0CACF,CAAC,EAAE,IAAI,EAAE,EAAE,IAAA,EAAE,CAAC,KACjB,IAAI,MAAA,KACD,CAAC,OAAO,IAAI,EAAE,OAAO,SAAA,EAAE,CAAC,GACxB,CAAC,cAAc,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE,CAAC,CACnE;yCACF,CAAC,EAAA;;oCAVI,MAAM,GAAG,SAUb;oCACF,sBAAO,iBAAiB,CAAC,MAAM,CAAC,EAAC;;;oCAEjC,sBAAO,aAAa,EAAE,EAAC;;;;yBAE1B,CAAC,EAAE,CAAC;oBAKL,IAAI,cAAc,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;wBACxC,eAAe,GAAG,aAAa,EAAE,CAAC;oBACpC,CAAC;yBAAM,IAAI,cAAc,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;wBAChD,eAAe,GAAG,IAAA,yBAAc,GAAE,CAAC;oBACrC,CAAC;yBAAM,CAAC;wBACN,eAAe,GAAG,0BAA0B;4BAC1C,CAAC,CAAC,aAAa,EAAE;4BACjB,CAAC,CAAC,IAAA,yBAAc,GAAE,CAAC;oBACvB,CAAC;oBAED,sBAAO,CACL,uBAAC,gBAAQ,IAAc,QAAQ,EAAE,eAAe,YAC9C,uBAAC,QAAQ,IAAC,QAAQ,EAAE,kBAAkB,GAAI,IAD7B,MAAM,CAEV,CACZ,EAAC;;;;CACH;AAED,CAAC,CAAC,gBAAgB,GAAG,kBAAkB,CAAC;AAExC,kBAAe,CAAC,CAAC"}
|
|
@@ -8,5 +8,15 @@ import { InlineTranslationOptions } from 'gt-react/internal';
|
|
|
8
8
|
* const t = await getGT();
|
|
9
9
|
* console.log(t('Hello, world!')); // Translates 'Hello, world!'
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export declare function getGT(): Promise<(string: 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(): (string: string, options?: InlineTranslationOptions) => string;
|
|
12
22
|
//# sourceMappingURL=getGT.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getGT.d.ts","sourceRoot":"","sources":["../../../src/server-dir/buildtime/getGT.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"getGT.d.ts","sourceRoot":"","sources":["../../../src/server-dir/buildtime/getGT.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAG7D;;;;;;;;GAQG;AACH,wBAAsB,KAAK,IAAI,OAAO,CACpC,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB,KAAK,MAAM,CAC/D,CAkHA;AAED;;;;;;;;GAQG;AACH,wBAAgB,KAAK,aA9HV,MAAM,YAAY,wBAAwB,KAAK,MAAM,CAgI/D"}
|
|
@@ -50,12 +50,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.
|
|
53
|
+
exports.getGT = getGT;
|
|
54
|
+
exports.useGT = useGT;
|
|
54
55
|
var generaltranslation_1 = require("generaltranslation");
|
|
55
56
|
var getI18NConfig_1 = __importDefault(require("../../config-dir/getI18NConfig"));
|
|
56
57
|
var server_1 = require("../../server");
|
|
57
58
|
var id_1 = require("generaltranslation/id");
|
|
58
59
|
var createErrors_1 = require("../../errors/createErrors");
|
|
60
|
+
var use_1 = __importDefault(require("../../utils/use"));
|
|
59
61
|
/**
|
|
60
62
|
* getGT() returns a function that translates a string, being marked as translated at build time.
|
|
61
63
|
*
|
|
@@ -140,16 +142,9 @@ function getGT() {
|
|
|
140
142
|
source: source,
|
|
141
143
|
targetLocale: locale,
|
|
142
144
|
options: __assign(__assign(__assign({}, ((options === null || options === void 0 ? void 0 : options.context) && { context: options === null || options === void 0 ? void 0 : options.context })), ((options === null || options === void 0 ? void 0 : options.id) && { id: options === null || options === void 0 ? void 0 : options.id })), { hash: hash }),
|
|
143
|
-
}).catch(function () { }); //
|
|
145
|
+
}).catch(function () { }); // No need for error logging, error logged in I18NConfig
|
|
144
146
|
// Loading translation warning
|
|
145
147
|
console.warn(createErrors_1.translationLoadingWarning);
|
|
146
|
-
// Loading behavior
|
|
147
|
-
if (renderSettings.method === 'replace') {
|
|
148
|
-
return renderContent(source, [defaultLocale]);
|
|
149
|
-
}
|
|
150
|
-
else if (renderSettings.method === 'skeleton') {
|
|
151
|
-
return '';
|
|
152
|
-
}
|
|
153
148
|
// Default is returning source, rather than returning a loading state
|
|
154
149
|
return renderContent(source, [defaultLocale]);
|
|
155
150
|
};
|
|
@@ -158,4 +153,16 @@ function getGT() {
|
|
|
158
153
|
});
|
|
159
154
|
});
|
|
160
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* useGT() returns a function that translates a string, being marked as translated at build time.
|
|
158
|
+
*
|
|
159
|
+
* @returns A promise of the t() function used for translating strings
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* const t = useGT();
|
|
163
|
+
* console.log(t('Hello, world!')); // Translates 'Hello, world!'
|
|
164
|
+
*/
|
|
165
|
+
function useGT() {
|
|
166
|
+
return (0, use_1.default)(getGT());
|
|
167
|
+
}
|
|
161
168
|
//# sourceMappingURL=getGT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getGT.js","sourceRoot":"","sources":["../../../src/server-dir/buildtime/getGT.ts"],"names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AAM,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;oBAChD,CAAC,CAAC;oBAEF,sBAAO,CAAC,EAAC;;;;CACV;AAED;;;;;;;;GAQG;AACH,SAAgB,KAAK;IACnB,OAAO,IAAA,aAAG,EAAC,KAAK,EAAE,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DictionaryTranslationOptions } from 'gt-react/internal';
|
|
2
2
|
/**
|
|
3
|
-
* Returns the dictionary access function
|
|
3
|
+
* Returns the dictionary access function t(), which is used to translate an item from the dictionary.
|
|
4
4
|
*
|
|
5
5
|
* @param {string} [id] - Optional prefix to prepend to the translation keys.
|
|
6
6
|
* @returns {Function} A translation function that accepts a key string and returns the translated value.
|
|
@@ -12,5 +12,19 @@ import { DictionaryTranslationOptions } from 'gt-react/internal';
|
|
|
12
12
|
* const t = await getTranslations();
|
|
13
13
|
* console.log(t('hello')); // Translates item 'hello'
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export declare function getTranslations(id?: string): Promise<(id: string, options?: DictionaryTranslationOptions) => string>;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the dictionary access function t(), which is used to translate an item from the dictionary.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} [id] - Optional prefix to prepend to the translation keys.
|
|
20
|
+
* @returns {Function} A translation function that accepts a key string and returns the translated value.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const t = useTranslations('user');
|
|
24
|
+
* console.log(t('name')); // Translates item 'user.name'
|
|
25
|
+
*
|
|
26
|
+
* const t = useTranslations();
|
|
27
|
+
* console.log(t('hello')); // Translates item 'hello'
|
|
28
|
+
*/
|
|
29
|
+
export declare function useTranslations(id?: string): (id: string, options?: DictionaryTranslationOptions) => string;
|
|
16
30
|
//# sourceMappingURL=getTranslations.d.ts.map
|
|
@@ -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;AAkB3B;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,EAAE,CAAC,EAAE,MAAM,GACV,OAAO,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,4BAA4B,KAAK,MAAM,CAAC,CA4JzE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,EAAE,CAAC,EAAE,MAAM,QA3K3B,MAAM,YAAY,4BAA4B,KAAK,MAAM,CA6KxE"}
|
|
@@ -50,16 +50,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.
|
|
53
|
+
exports.getTranslations = getTranslations;
|
|
54
|
+
exports.useTranslations = useTranslations;
|
|
54
55
|
var internal_1 = require("gt-react/internal");
|
|
55
56
|
var getDictionary_1 = __importDefault(require("../../dictionary/getDictionary"));
|
|
56
57
|
var createErrors_1 = require("../../errors/createErrors");
|
|
57
58
|
var getI18NConfig_1 = __importDefault(require("../../config-dir/getI18NConfig"));
|
|
58
|
-
var getLocale_1 =
|
|
59
|
+
var getLocale_1 = require("../../request/getLocale");
|
|
59
60
|
var generaltranslation_1 = require("generaltranslation");
|
|
60
61
|
var id_1 = require("generaltranslation/id");
|
|
62
|
+
var use_1 = __importDefault(require("../../utils/use"));
|
|
61
63
|
/**
|
|
62
|
-
* Returns the dictionary access function
|
|
64
|
+
* Returns the dictionary access function t(), which is used to translate an item from the dictionary.
|
|
63
65
|
*
|
|
64
66
|
* @param {string} [id] - Optional prefix to prepend to the translation keys.
|
|
65
67
|
* @returns {Function} A translation function that accepts a key string and returns the translated value.
|
|
@@ -84,7 +86,7 @@ function getTranslations(id) {
|
|
|
84
86
|
case 1:
|
|
85
87
|
dictionary = (_c.sent()) || {};
|
|
86
88
|
I18NConfig = (0, getI18NConfig_1.default)();
|
|
87
|
-
return [4 /*yield*/, (0, getLocale_1.
|
|
89
|
+
return [4 /*yield*/, (0, getLocale_1.getLocale)()];
|
|
88
90
|
case 2:
|
|
89
91
|
locale = _c.sent();
|
|
90
92
|
defaultLocale = I18NConfig.getDefaultLocale();
|
|
@@ -185,4 +187,20 @@ function getTranslations(id) {
|
|
|
185
187
|
});
|
|
186
188
|
});
|
|
187
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* Returns the dictionary access function t(), which is used to translate an item from the dictionary.
|
|
192
|
+
*
|
|
193
|
+
* @param {string} [id] - Optional prefix to prepend to the translation keys.
|
|
194
|
+
* @returns {Function} A translation function that accepts a key string and returns the translated value.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* const t = useTranslations('user');
|
|
198
|
+
* console.log(t('name')); // Translates item 'user.name'
|
|
199
|
+
*
|
|
200
|
+
* const t = useTranslations();
|
|
201
|
+
* console.log(t('hello')); // Translates item 'hello'
|
|
202
|
+
*/
|
|
203
|
+
function useTranslations(id) {
|
|
204
|
+
return (0, use_1.default)(getTranslations(id));
|
|
205
|
+
}
|
|
188
206
|
//# sourceMappingURL=getTranslations.js.map
|
|
@@ -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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AAU,CAAC,gBAAgB,CAAC;4BAC1B,MAAM,QAAA;4BACN,YAAY,EAAE,MAAM;4BACpB,OAAO,wBACF,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,KAAI,EAAE,OAAO,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,EAAE,CAAC,KACxD,EAAE,IAAA,EACF,IAAI,MAAA,GACL;yBACF,CAAC,CAAC,KAAK,CAAC,cAAO,CAAC,CAAC,CAAC,CAAC,6BAA6B;wBAEjD,8BAA8B;wBAC9B,OAAO,CAAC,IAAI,CAAC,wCAAyB,CAAC,CAAC;wBAExC,mBAAmB;wBACnB,IAAI,cAAc,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;4BACxC,OAAO,aAAa,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;wBAChD,CAAC;6BAAM,IAAI,cAAc,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;4BAChD,OAAO,EAAE,CAAC;wBACZ,CAAC;wBAED,qEAAqE;wBACrE,OAAO,aAAa,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;oBAChD,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"}
|
|
@@ -52,7 +52,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
54
54
|
var getI18NConfig_1 = __importDefault(require("../../config-dir/getI18NConfig"));
|
|
55
|
-
var getLocale_1 =
|
|
55
|
+
var getLocale_1 = require("../../request/getLocale");
|
|
56
56
|
var react_1 = require("react");
|
|
57
57
|
var internal_1 = require("gt-react/internal");
|
|
58
58
|
var renderVariable_1 = __importDefault(require("../variables/renderVariable"));
|
|
@@ -80,7 +80,7 @@ function Tx(_a) {
|
|
|
80
80
|
I18NConfig = (0, getI18NConfig_1.default)();
|
|
81
81
|
_c = locale;
|
|
82
82
|
if (_c) return [3 /*break*/, 2];
|
|
83
|
-
return [4 /*yield*/, (0, getLocale_1.
|
|
83
|
+
return [4 /*yield*/, (0, getLocale_1.getLocale)()];
|
|
84
84
|
case 1:
|
|
85
85
|
_c = (locale = _f.sent());
|
|
86
86
|
_f.label = 2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_Tx.js","sourceRoot":"","sources":["../../../src/server-dir/runtime/_Tx.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iFAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"_Tx.js","sourceRoot":"","sources":["../../../src/server-dir/runtime/_Tx.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iFAA2D;AAC3D,qDAAoD;AACpD,+BAAiC;AACjC,8CAO2B;AAC3B,+EAAyD;AAEzD,4CAAwD;AAGxD,SAAe,QAAQ;wDAAC,EAA2C;YAAzC,QAAQ,cAAA;;;wBACzB,qBAAM,QAAQ,EAAA;wBAArB,sBAAO,SAAc,EAAC;;;;CACvB;AAED,SAAe,EAAE;wDAAC,EAA0C;;;;YAAxC,QAAQ,cAAA,EAAE,EAAE,QAAA,EAAE,OAAO,aAAA,EAAE,MAAM,YAAA;;;;oBAGzC,UAAU,GAAG,IAAA,uBAAa,GAAE,CAAC;oBACnC,KAAA,MAAM,CAAA;4BAAN,wBAAM;oBAAK,qBAAM,IAAA,qBAAS,GAAE,EAAA;;0BAA5B,MAAM,GAAK,SAAiB;;;oBAA5B,GAA6B;oBACvB,aAAa,GAAG,UAAU,CAAC,gBAA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AAC;oBACvB,CAAC;oBAED,sBAAO,CACL,uBAAC,gBAAQ,IAAc,QAAQ,EAAE,eAAe,YAC9C,uBAAC,QAAQ,IAAC,QAAQ,EAAE,kBAAkB,GAAI,IAD7B,MAAM,CAEV,CACZ,EAAC;;;;CACH;AAED,EAAE,CAAC,gBAAgB,GAAG,kBAAkB,CAAC;AAEzC,kBAAe,EAAE,CAAC"}
|
|
@@ -53,7 +53,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
53
53
|
exports.default = tx;
|
|
54
54
|
var generaltranslation_1 = require("generaltranslation");
|
|
55
55
|
var getI18NConfig_1 = __importDefault(require("../../config-dir/getI18NConfig"));
|
|
56
|
-
var getLocale_1 =
|
|
56
|
+
var getLocale_1 = require("../../request/getLocale");
|
|
57
57
|
var createErrors_1 = require("../../errors/createErrors");
|
|
58
58
|
var id_1 = require("generaltranslation/id");
|
|
59
59
|
/**
|
|
@@ -101,7 +101,7 @@ function tx(string_1) {
|
|
|
101
101
|
I18NConfig = (0, getI18NConfig_1.default)();
|
|
102
102
|
_a = options.locale;
|
|
103
103
|
if (_a) return [3 /*break*/, 2];
|
|
104
|
-
return [4 /*yield*/, (0, getLocale_1.
|
|
104
|
+
return [4 /*yield*/, (0, getLocale_1.getLocale)()];
|
|
105
105
|
case 1:
|
|
106
106
|
_a = (_c.sent());
|
|
107
107
|
_c.label = 2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx.js","sourceRoot":"","sources":["../../../src/server-dir/runtime/tx.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,qBA8DC;AAxGD,yDAG4B;AAC5B,iFAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"tx.js","sourceRoot":"","sources":["../../../src/server-dir/runtime/tx.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,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AAO,CAAC,EAAE,EAAE,CAAC,KACtC,UAAU,EAAE,KAAK,IACjB,CAAC;oBAIG,kBAAkB,GAAG,UAAU,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;oBACpE,IAAI,CAAA,MAAA,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAG,IAAI,CAAC,0CAAE,KAAK,MAAK,SAAS,EAAE,CAAC;wBACpD,sBAAO,aAAa,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE;gCACpD,MAAM;gCACN,aAAa;6BACd,CAAC,EAAC;oBACL,CAAC;;;;oBAMgB,qBAAM,UAAU,CAAC,gBAAgB,CAAC;4BAC/C,MAAM,QAAA;4BACN,YAAY,EAAE,MAAM;4BACpB,OAAO,wBAAO,OAAO,KAAE,IAAI,MAAA,GAAE;yBAC9B,CAAC,EAAA;;oBAJI,MAAM,GAAG,SAIb;oBACF,sBAAO,aAAa,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,EAAC;;;oBAEtD,OAAO,CAAC,KAAK,CAAC,IAAA,2CAA4B,EAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,OAAK,CAAC,CAAC;oBACvE,sBAAO,aAAa,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,CAAC,EAAC;;;;;CAEjD"}
|
package/dist/server.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import T from './server-dir/buildtime/T';
|
|
2
2
|
import tx from './server-dir/runtime/tx';
|
|
3
|
-
import getLocale from './request/getLocale';
|
|
4
|
-
import getTranslations from './server-dir/buildtime/getTranslations';
|
|
3
|
+
import { getLocale } from './request/getLocale';
|
|
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';
|
|
7
|
+
import { getGT } from './server-dir/buildtime/getGT';
|
|
8
8
|
import { LocaleProperties } from 'generaltranslation/types';
|
|
9
9
|
export declare function getDefaultLocale(): string;
|
|
10
10
|
export declare function getGTClass(): import("generaltranslation").GT;
|
|
11
11
|
export declare function getLocaleProperties(locale: string): LocaleProperties;
|
|
12
|
+
export declare function getLocales(): string[];
|
|
12
13
|
export { GTProvider, T, getGT, tx, Tx, getLocale, // getDefaultLocale
|
|
13
14
|
getTranslations,
|
|
14
15
|
/**
|
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,SAAS,MAAM,qBAAqB,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;AAE5D,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,EAAE,EACF,SAAS,EAAE,mBAAmB;AAC9B,eAAe;AACf;;GAEG;AACH,eAAe,IAAI,OAAO,GAC3B,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -7,22 +7,23 @@ exports.getDict = exports.getTranslations = exports.getLocale = exports.Tx = exp
|
|
|
7
7
|
exports.getDefaultLocale = getDefaultLocale;
|
|
8
8
|
exports.getGTClass = getGTClass;
|
|
9
9
|
exports.getLocaleProperties = getLocaleProperties;
|
|
10
|
+
exports.getLocales = getLocales;
|
|
10
11
|
var T_1 = __importDefault(require("./server-dir/buildtime/T"));
|
|
11
12
|
exports.T = T_1.default;
|
|
12
13
|
var tx_1 = __importDefault(require("./server-dir/runtime/tx"));
|
|
13
14
|
exports.tx = tx_1.default;
|
|
14
|
-
var getLocale_1 =
|
|
15
|
-
exports
|
|
15
|
+
var getLocale_1 = require("./request/getLocale");
|
|
16
|
+
Object.defineProperty(exports, "getLocale", { enumerable: true, get: function () { return getLocale_1.getLocale; } });
|
|
16
17
|
var getI18NConfig_1 = __importDefault(require("./config-dir/getI18NConfig"));
|
|
17
|
-
var getTranslations_1 =
|
|
18
|
-
exports
|
|
19
|
-
exports
|
|
18
|
+
var getTranslations_1 = require("./server-dir/buildtime/getTranslations");
|
|
19
|
+
Object.defineProperty(exports, "getTranslations", { enumerable: true, get: function () { return getTranslations_1.getTranslations; } });
|
|
20
|
+
Object.defineProperty(exports, "getDict", { enumerable: true, get: function () { return getTranslations_1.getTranslations; } });
|
|
20
21
|
var GTProvider_1 = __importDefault(require("./provider/GTProvider"));
|
|
21
22
|
exports.GTProvider = GTProvider_1.default;
|
|
22
23
|
var _Tx_1 = __importDefault(require("./server-dir/runtime/_Tx"));
|
|
23
24
|
exports.Tx = _Tx_1.default;
|
|
24
|
-
var getGT_1 =
|
|
25
|
-
exports
|
|
25
|
+
var getGT_1 = require("./server-dir/buildtime/getGT");
|
|
26
|
+
Object.defineProperty(exports, "getGT", { enumerable: true, get: function () { return getGT_1.getGT; } });
|
|
26
27
|
function getDefaultLocale() {
|
|
27
28
|
return (0, getI18NConfig_1.default)().getDefaultLocale();
|
|
28
29
|
}
|
|
@@ -32,4 +33,7 @@ function getGTClass() {
|
|
|
32
33
|
function getLocaleProperties(locale) {
|
|
33
34
|
return getGTClass().getLocaleProperties(locale);
|
|
34
35
|
}
|
|
36
|
+
function getLocales() {
|
|
37
|
+
return (0, getI18NConfig_1.default)().getLocales();
|
|
38
|
+
}
|
|
35
39
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;AAUA,4CAEC;AAED,gCAEC;AAED,kDAEC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;AAUA,4CAEC;AAED,gCAEC;AAED,kDAEC;AAED,gCAEC;AAxBD,+DAAyC;AA4BvC,YA5BK,WAAC,CA4BL;AA3BH,+DAAyC;AA6BvC,aA7BK,YAAE,CA6BL;AA5BJ,iDAAgD;AA8B9C,0FA9BO,qBAAS,OA8BP;AA7BX,6EAAuD;AACvD,0EAAyE;AA6BvE,gGA7BO,iCAAe,OA6BP;AAII,wFAjCZ,iCAAe,OAiCI;AAhC5B,qEAA+C;AAsB7C,qBAtBK,oBAAU,CAsBL;AArBZ,iEAA0C;AAyBxC,aAzBK,aAAE,CAyBL;AAxBJ,sDAAqD;AAsBnD,sFAtBO,aAAK,OAsBP;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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../src/utils/use.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;wBAYO,OAAO,KAAK,CAAC,GAAG;AAAtD,wBAAuD"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// The code in this file is taken from https://github.com/amannn/next-intl/blob/main/packages/next-intl/src/shared/use.tsx
|
|
3
|
+
// And is therefore MIT licensed
|
|
4
|
+
// Thank you Jan Amann!
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
/*
|
|
40
|
+
MIT License
|
|
41
|
+
|
|
42
|
+
Copyright (c) 2024 Jan Amann
|
|
43
|
+
|
|
44
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
45
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
46
|
+
in the Software without restriction, including without limitation the rights
|
|
47
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
48
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
49
|
+
furnished to do so, subject to the following conditions:
|
|
50
|
+
|
|
51
|
+
The above copyright notice and this permission notice shall be included in all
|
|
52
|
+
copies or substantial portions of the Software.
|
|
53
|
+
|
|
54
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
55
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
56
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
57
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
58
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
59
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
60
|
+
SOFTWARE.
|
|
61
|
+
*/
|
|
62
|
+
var react = __importStar(require("react"));
|
|
63
|
+
// Original comments included for reference:
|
|
64
|
+
// @ts-expect-error -- Ooof, Next.js doesn't make this easy.
|
|
65
|
+
// `use` is only available in React 19 canary, but we can
|
|
66
|
+
// use it in Next.js already as Next.js "vendors" a fixed
|
|
67
|
+
// version of React. However, if we'd simply put `use` in
|
|
68
|
+
// ESM code, then the build doesn't work since React does
|
|
69
|
+
// not export `use` officially. Therefore, we have to use
|
|
70
|
+
// something that is not statically analyzable. Once React
|
|
71
|
+
// 19 is out, we can remove this in the next major version.
|
|
72
|
+
exports.default = react['use'.trim()];
|
|
73
|
+
//# sourceMappingURL=use.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.js","sourceRoot":"","sources":["../../src/utils/use.ts"],"names":[],"mappings":";AAAA,0HAA0H;AAC1H,gCAAgC;AAChC,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEvB;;;;;;;;;;;;;;;;;;;;;;EAsBE;AAEF,2CAA+B;AAE/B,4CAA4C;AAE5C,4DAA4D;AAC5D,yDAAyD;AACzD,yDAAyD;AACzD,yDAAyD;AACzD,yDAAyD;AACzD,yDAAyD;AACzD,0DAA0D;AAC1D,2DAA2D;AAC3D,kBAAe,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAqB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
declare function Currency({ children, currency,
|
|
2
|
-
children?:
|
|
1
|
+
declare function Currency({ children, currency, locales, options, }: {
|
|
2
|
+
children?: React.ReactNode;
|
|
3
3
|
currency?: string;
|
|
4
4
|
name?: string;
|
|
5
5
|
options?: Intl.NumberFormatOptions;
|
|
6
6
|
locales?: string[];
|
|
7
|
-
}):
|
|
7
|
+
}): React.JSX.Element;
|
|
8
8
|
declare namespace Currency {
|
|
9
9
|
var gtTransformation: string;
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Currency.d.ts","sourceRoot":"","sources":["../../src/variables/Currency.tsx"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"Currency.d.ts","sourceRoot":"","sources":["../../src/variables/Currency.tsx"],"names":[],"mappings":"AAIA,iBAAS,QAAQ,CAAC,EAChB,QAAQ,EACR,QAAgB,EAChB,OAAO,EACP,OAAY,GACb,EAAE;IACD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAgBpB;kBA3BQ,QAAQ;;;AA+BjB,eAAe,QAAQ,CAAC"}
|
|
@@ -10,42 +10,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
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
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
15
|
};
|
|
@@ -53,28 +17,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
53
17
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
54
18
|
var generaltranslation_1 = require("generaltranslation");
|
|
55
19
|
var getI18NConfig_1 = __importDefault(require("../config-dir/getI18NConfig"));
|
|
56
|
-
var getLocale_1 =
|
|
20
|
+
var getLocale_1 = require("../request/getLocale");
|
|
57
21
|
function Currency(_a) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
case 2:
|
|
70
|
-
renderedValue = typeof children === 'string' ? parseFloat(children) : children;
|
|
71
|
-
formattedValue = typeof renderedValue === 'number'
|
|
72
|
-
? (0, generaltranslation_1.formatCurrency)(renderedValue, currency, __assign({ locales: locales }, options))
|
|
73
|
-
: renderedValue;
|
|
74
|
-
return [2 /*return*/, (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: formattedValue })];
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
});
|
|
22
|
+
var children = _a.children, _b = _a.currency, currency = _b === void 0 ? 'USD' : _b, locales = _a.locales, _c = _a.options, options = _c === void 0 ? {} : _c;
|
|
23
|
+
if (!locales) {
|
|
24
|
+
locales = [(0, getLocale_1.useLocale)(), (0, getI18NConfig_1.default)().getDefaultLocale()];
|
|
25
|
+
}
|
|
26
|
+
// Determine the value to be formatted
|
|
27
|
+
var renderedValue = typeof children === 'string' ? parseFloat(children) : children;
|
|
28
|
+
// Format the number as currency according to the locale
|
|
29
|
+
var formattedValue = typeof renderedValue === 'number'
|
|
30
|
+
? (0, generaltranslation_1.formatCurrency)(renderedValue, currency, __assign({ locales: locales }, options))
|
|
31
|
+
: renderedValue;
|
|
32
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: formattedValue });
|
|
78
33
|
}
|
|
79
34
|
Currency.gtTransformation = 'variable-currency';
|
|
80
35
|
exports.default = Currency;
|