gt-node 0.7.8 → 1.0.0-odysseus.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/AsyncConditionStore-DZKxeqET.mjs +70 -0
- package/dist/AsyncConditionStore-DZKxeqET.mjs.map +1 -0
- package/dist/AsyncConditionStore-VWuVcaxX.cjs +87 -0
- package/dist/AsyncConditionStore-VWuVcaxX.cjs.map +1 -0
- package/dist/index.cjs +9 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +12 -17
- package/dist/index.mjs.map +1 -1
- package/dist/internal.cjs +7 -7
- package/dist/internal.d.cts +20 -11
- package/dist/internal.d.mts +20 -11
- package/dist/internal.mjs +3 -3
- package/dist/types-KHAnqXc6.d.cts +13 -0
- package/dist/types-o5MTESyx.d.mts +13 -0
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +3 -3
- package/dist/AsyncConditionStore-CgVuzOnG.mjs +0 -38
- package/dist/AsyncConditionStore-CgVuzOnG.mjs.map +0 -1
- package/dist/AsyncConditionStore-hiVLxQyY.cjs +0 -55
- package/dist/AsyncConditionStore-hiVLxQyY.cjs.map +0 -1
- package/dist/types-D2TZTLXG.d.mts +0 -15
- package/dist/types-DsauAGkA.d.cts +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# gt-node
|
|
2
2
|
|
|
3
|
+
## 1.0.0-odysseus.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1677](https://github.com/generaltranslation/gt/pull/1677) [`87d6320`](https://github.com/generaltranslation/gt/commit/87d6320d271a1bf455f4e283dc1bb23893c7ba64) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Remove internal source barrel exports and update imports to reference defining files directly.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`87d6320`](https://github.com/generaltranslation/gt/commit/87d6320d271a1bf455f4e283dc1bb23893c7ba64)]:
|
|
10
|
+
- generaltranslation@9.0.0-odysseus.1
|
|
11
|
+
- gt-i18n@1.0.0-odysseus.1
|
|
12
|
+
|
|
13
|
+
## 1.0.0-odysseus.0
|
|
14
|
+
|
|
15
|
+
### Major Changes
|
|
16
|
+
|
|
17
|
+
- [#1627](https://github.com/generaltranslation/gt/pull/1627) [`bd0d788`](https://github.com/generaltranslation/gt/commit/bd0d7883601a183a31b47b36ea4ea2dca69c62d0) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Prepare Odysseus major releases for core runtime packages.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#1508](https://github.com/generaltranslation/gt/pull/1508) [`cc1499d`](https://github.com/generaltranslation/gt/commit/cc1499d12789ffd7ee3c6ca20d2eec734a1c9575) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Trigger an odysseus prerelease patch for all publishable packages.
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`cc1499d`](https://github.com/generaltranslation/gt/commit/cc1499d12789ffd7ee3c6ca20d2eec734a1c9575), [`bd0d788`](https://github.com/generaltranslation/gt/commit/bd0d7883601a183a31b47b36ea4ea2dca69c62d0)]:
|
|
24
|
+
- generaltranslation@9.0.0-odysseus.0
|
|
25
|
+
- gt-i18n@1.0.0-odysseus.0
|
|
26
|
+
|
|
3
27
|
## 0.7.8
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { createConditionStoreSingleton, getI18nConfig } from "gt-i18n/internal";
|
|
2
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
|
+
//#region src/async-i18n-cache/singleton-operations.ts
|
|
4
|
+
const { getConditionStore: getAsyncConditionStore, setConditionStore: setAsyncConditionStore } = createConditionStoreSingleton("AsyncConditionStore not initialized. Invoke initializeGT() to initialize.");
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/async-i18n-cache/AsyncConditionStore.ts
|
|
7
|
+
const OUTSIDE_SCOPE_MESSAGE = "AsyncConditionStore: getLocale() called outside of a withGT() scope.";
|
|
8
|
+
const REGION_MESSAGE = "AsyncConditionStore: getRegion() called outside of a withGT() scope.";
|
|
9
|
+
const ENABLE_I18N_MESSAGE = "AsyncConditionStore: getEnableI18n() called outside of a withGT() scope.";
|
|
10
|
+
/**
|
|
11
|
+
* Condition store implementation that uses AsyncLocalStorage.
|
|
12
|
+
*/
|
|
13
|
+
var AsyncConditionStore = class {
|
|
14
|
+
constructor({ store } = {}) {
|
|
15
|
+
this.setLocale = (_locale) => {};
|
|
16
|
+
this.setRegion = (_region) => {};
|
|
17
|
+
this.setEnableI18n = (_enableI18n) => {};
|
|
18
|
+
this.store = store ?? new AsyncLocalStorage();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* TODO: should this be a static function
|
|
22
|
+
* */
|
|
23
|
+
run(locale, callback) {
|
|
24
|
+
return this.store.run({ locale: resolveLocale(locale) }, callback);
|
|
25
|
+
}
|
|
26
|
+
getLocale() {
|
|
27
|
+
const store = this.store.getStore();
|
|
28
|
+
if (!store) {
|
|
29
|
+
if (process.env.NODE_ENV === "production") {
|
|
30
|
+
console.warn(OUTSIDE_SCOPE_MESSAGE);
|
|
31
|
+
return resolveLocale();
|
|
32
|
+
}
|
|
33
|
+
throw new Error(OUTSIDE_SCOPE_MESSAGE);
|
|
34
|
+
}
|
|
35
|
+
return resolveLocale(store.locale);
|
|
36
|
+
}
|
|
37
|
+
getRegion() {
|
|
38
|
+
const store = this.store.getStore();
|
|
39
|
+
if (!store) {
|
|
40
|
+
if (process.env.NODE_ENV === "production") {
|
|
41
|
+
console.warn(REGION_MESSAGE);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
throw new Error(REGION_MESSAGE);
|
|
45
|
+
}
|
|
46
|
+
return store.region;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* TODO: implement
|
|
50
|
+
*/
|
|
51
|
+
getEnableI18n() {
|
|
52
|
+
const store = this.store.getStore();
|
|
53
|
+
if (!store) {
|
|
54
|
+
if (process.env.NODE_ENV === "production") {
|
|
55
|
+
console.warn(ENABLE_I18N_MESSAGE);
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
throw new Error(ENABLE_I18N_MESSAGE);
|
|
59
|
+
}
|
|
60
|
+
return store.enableI18n ?? true;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
function resolveLocale(locale) {
|
|
64
|
+
const i18nConfig = getI18nConfig();
|
|
65
|
+
return i18nConfig.determineLocale(locale) || i18nConfig.getDefaultLocale();
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { getAsyncConditionStore as n, setAsyncConditionStore as r, AsyncConditionStore as t };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=AsyncConditionStore-DZKxeqET.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsyncConditionStore-DZKxeqET.mjs","names":[],"sources":["../src/async-i18n-cache/singleton-operations.ts","../src/async-i18n-cache/AsyncConditionStore.ts"],"sourcesContent":["import { createConditionStoreSingleton } from 'gt-i18n/internal';\nimport type { AsyncConditionStore } from './AsyncConditionStore';\n\nexport const {\n getConditionStore: getAsyncConditionStore,\n setConditionStore: setAsyncConditionStore,\n} = createConditionStoreSingleton<AsyncConditionStore>(\n 'AsyncConditionStore not initialized. Invoke initializeGT() to initialize.'\n);\n","import { AsyncLocalStorage } from 'node:async_hooks';\nimport type { ScopedConditionStoreInterface } from 'gt-i18n/internal/types';\nimport { getI18nConfig } from 'gt-i18n/internal';\n\ntype Store = {\n locale: string;\n region?: string;\n enableI18n?: boolean;\n};\n\nconst OUTSIDE_SCOPE_MESSAGE =\n 'AsyncConditionStore: getLocale() called outside of a withGT() scope.';\n\nconst REGION_MESSAGE =\n 'AsyncConditionStore: getRegion() called outside of a withGT() scope.';\n\nconst ENABLE_I18N_MESSAGE =\n 'AsyncConditionStore: getEnableI18n() called outside of a withGT() scope.';\n\ntype AsyncConditionStoreConstructorParams = {\n store?: AsyncLocalStorage<Store>;\n};\n\n/**\n * Condition store implementation that uses AsyncLocalStorage.\n */\nexport class AsyncConditionStore implements ScopedConditionStoreInterface {\n private store: AsyncLocalStorage<Store>;\n\n constructor({ store }: AsyncConditionStoreConstructorParams = {}) {\n this.store = store ?? new AsyncLocalStorage();\n }\n\n /**\n * TODO: should this be a static function\n * */\n run<T>(locale: string, callback: () => T): T {\n return this.store.run({ locale: resolveLocale(locale) }, callback);\n }\n\n getLocale(): string {\n const store = this.store.getStore();\n if (!store) {\n if (process.env.NODE_ENV === 'production') {\n console.warn(OUTSIDE_SCOPE_MESSAGE);\n return resolveLocale();\n }\n throw new Error(OUTSIDE_SCOPE_MESSAGE);\n }\n return resolveLocale(store.locale);\n }\n\n getRegion(): string | undefined {\n const store = this.store.getStore();\n if (!store) {\n if (process.env.NODE_ENV === 'production') {\n console.warn(REGION_MESSAGE);\n return undefined;\n }\n throw new Error(REGION_MESSAGE);\n }\n return store.region;\n }\n\n /**\n * TODO: implement\n */\n getEnableI18n(): boolean {\n const store = this.store.getStore();\n if (!store) {\n if (process.env.NODE_ENV === 'production') {\n console.warn(ENABLE_I18N_MESSAGE);\n return true;\n }\n throw new Error(ENABLE_I18N_MESSAGE);\n }\n return store.enableI18n ?? true;\n }\n\n setLocale = (_locale: string): void => {};\n\n setRegion = (_region: string | undefined): void => {};\n\n setEnableI18n = (_enableI18n: boolean): void => {};\n}\n\nfunction resolveLocale(locale?: string): string {\n const i18nConfig = getI18nConfig();\n return i18nConfig.determineLocale(locale) || i18nConfig.getDefaultLocale();\n}\n"],"mappings":";;;AAGA,MAAa,EACX,mBAAmB,wBACnB,mBAAmB,2BACjB,8BACF,4EACD;;;ACED,MAAM,wBACJ;AAEF,MAAM,iBACJ;AAEF,MAAM,sBACJ;;;;AASF,IAAa,sBAAb,MAA0E;CAGxE,YAAY,EAAE,UAAgD,EAAE,EAAE;oBAkDrD,YAA0B;oBAE1B,YAAsC;wBAElC,gBAA+B;AArD9C,OAAK,QAAQ,SAAS,IAAI,mBAAmB;;;;;CAM/C,IAAO,QAAgB,UAAsB;AAC3C,SAAO,KAAK,MAAM,IAAI,EAAE,QAAQ,cAAc,OAAO,EAAE,EAAE,SAAS;;CAGpE,YAAoB;EAClB,MAAM,QAAQ,KAAK,MAAM,UAAU;AACnC,MAAI,CAAC,OAAO;AACV,OAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,YAAQ,KAAK,sBAAsB;AACnC,WAAO,eAAe;;AAExB,SAAM,IAAI,MAAM,sBAAsB;;AAExC,SAAO,cAAc,MAAM,OAAO;;CAGpC,YAAgC;EAC9B,MAAM,QAAQ,KAAK,MAAM,UAAU;AACnC,MAAI,CAAC,OAAO;AACV,OAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,YAAQ,KAAK,eAAe;AAC5B;;AAEF,SAAM,IAAI,MAAM,eAAe;;AAEjC,SAAO,MAAM;;;;;CAMf,gBAAyB;EACvB,MAAM,QAAQ,KAAK,MAAM,UAAU;AACnC,MAAI,CAAC,OAAO;AACV,OAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,YAAQ,KAAK,oBAAoB;AACjC,WAAO;;AAET,SAAM,IAAI,MAAM,oBAAoB;;AAEtC,SAAO,MAAM,cAAc;;;AAU/B,SAAS,cAAc,QAAyB;CAC9C,MAAM,aAAa,eAAe;AAClC,QAAO,WAAW,gBAAgB,OAAO,IAAI,WAAW,kBAAkB"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
let gt_i18n_internal = require("gt-i18n/internal");
|
|
2
|
+
let node_async_hooks = require("node:async_hooks");
|
|
3
|
+
//#region src/async-i18n-cache/singleton-operations.ts
|
|
4
|
+
const { getConditionStore: getAsyncConditionStore, setConditionStore: setAsyncConditionStore } = (0, gt_i18n_internal.createConditionStoreSingleton)("AsyncConditionStore not initialized. Invoke initializeGT() to initialize.");
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/async-i18n-cache/AsyncConditionStore.ts
|
|
7
|
+
const OUTSIDE_SCOPE_MESSAGE = "AsyncConditionStore: getLocale() called outside of a withGT() scope.";
|
|
8
|
+
const REGION_MESSAGE = "AsyncConditionStore: getRegion() called outside of a withGT() scope.";
|
|
9
|
+
const ENABLE_I18N_MESSAGE = "AsyncConditionStore: getEnableI18n() called outside of a withGT() scope.";
|
|
10
|
+
/**
|
|
11
|
+
* Condition store implementation that uses AsyncLocalStorage.
|
|
12
|
+
*/
|
|
13
|
+
var AsyncConditionStore = class {
|
|
14
|
+
constructor({ store } = {}) {
|
|
15
|
+
this.setLocale = (_locale) => {};
|
|
16
|
+
this.setRegion = (_region) => {};
|
|
17
|
+
this.setEnableI18n = (_enableI18n) => {};
|
|
18
|
+
this.store = store ?? new node_async_hooks.AsyncLocalStorage();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* TODO: should this be a static function
|
|
22
|
+
* */
|
|
23
|
+
run(locale, callback) {
|
|
24
|
+
return this.store.run({ locale: resolveLocale(locale) }, callback);
|
|
25
|
+
}
|
|
26
|
+
getLocale() {
|
|
27
|
+
const store = this.store.getStore();
|
|
28
|
+
if (!store) {
|
|
29
|
+
if (process.env.NODE_ENV === "production") {
|
|
30
|
+
console.warn(OUTSIDE_SCOPE_MESSAGE);
|
|
31
|
+
return resolveLocale();
|
|
32
|
+
}
|
|
33
|
+
throw new Error(OUTSIDE_SCOPE_MESSAGE);
|
|
34
|
+
}
|
|
35
|
+
return resolveLocale(store.locale);
|
|
36
|
+
}
|
|
37
|
+
getRegion() {
|
|
38
|
+
const store = this.store.getStore();
|
|
39
|
+
if (!store) {
|
|
40
|
+
if (process.env.NODE_ENV === "production") {
|
|
41
|
+
console.warn(REGION_MESSAGE);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
throw new Error(REGION_MESSAGE);
|
|
45
|
+
}
|
|
46
|
+
return store.region;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* TODO: implement
|
|
50
|
+
*/
|
|
51
|
+
getEnableI18n() {
|
|
52
|
+
const store = this.store.getStore();
|
|
53
|
+
if (!store) {
|
|
54
|
+
if (process.env.NODE_ENV === "production") {
|
|
55
|
+
console.warn(ENABLE_I18N_MESSAGE);
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
throw new Error(ENABLE_I18N_MESSAGE);
|
|
59
|
+
}
|
|
60
|
+
return store.enableI18n ?? true;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
function resolveLocale(locale) {
|
|
64
|
+
const i18nConfig = (0, gt_i18n_internal.getI18nConfig)();
|
|
65
|
+
return i18nConfig.determineLocale(locale) || i18nConfig.getDefaultLocale();
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
Object.defineProperty(exports, "AsyncConditionStore", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function() {
|
|
71
|
+
return AsyncConditionStore;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(exports, "getAsyncConditionStore", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function() {
|
|
77
|
+
return getAsyncConditionStore;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(exports, "setAsyncConditionStore", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function() {
|
|
83
|
+
return setAsyncConditionStore;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
//# sourceMappingURL=AsyncConditionStore-VWuVcaxX.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsyncConditionStore-VWuVcaxX.cjs","names":["AsyncLocalStorage"],"sources":["../src/async-i18n-cache/singleton-operations.ts","../src/async-i18n-cache/AsyncConditionStore.ts"],"sourcesContent":["import { createConditionStoreSingleton } from 'gt-i18n/internal';\nimport type { AsyncConditionStore } from './AsyncConditionStore';\n\nexport const {\n getConditionStore: getAsyncConditionStore,\n setConditionStore: setAsyncConditionStore,\n} = createConditionStoreSingleton<AsyncConditionStore>(\n 'AsyncConditionStore not initialized. Invoke initializeGT() to initialize.'\n);\n","import { AsyncLocalStorage } from 'node:async_hooks';\nimport type { ScopedConditionStoreInterface } from 'gt-i18n/internal/types';\nimport { getI18nConfig } from 'gt-i18n/internal';\n\ntype Store = {\n locale: string;\n region?: string;\n enableI18n?: boolean;\n};\n\nconst OUTSIDE_SCOPE_MESSAGE =\n 'AsyncConditionStore: getLocale() called outside of a withGT() scope.';\n\nconst REGION_MESSAGE =\n 'AsyncConditionStore: getRegion() called outside of a withGT() scope.';\n\nconst ENABLE_I18N_MESSAGE =\n 'AsyncConditionStore: getEnableI18n() called outside of a withGT() scope.';\n\ntype AsyncConditionStoreConstructorParams = {\n store?: AsyncLocalStorage<Store>;\n};\n\n/**\n * Condition store implementation that uses AsyncLocalStorage.\n */\nexport class AsyncConditionStore implements ScopedConditionStoreInterface {\n private store: AsyncLocalStorage<Store>;\n\n constructor({ store }: AsyncConditionStoreConstructorParams = {}) {\n this.store = store ?? new AsyncLocalStorage();\n }\n\n /**\n * TODO: should this be a static function\n * */\n run<T>(locale: string, callback: () => T): T {\n return this.store.run({ locale: resolveLocale(locale) }, callback);\n }\n\n getLocale(): string {\n const store = this.store.getStore();\n if (!store) {\n if (process.env.NODE_ENV === 'production') {\n console.warn(OUTSIDE_SCOPE_MESSAGE);\n return resolveLocale();\n }\n throw new Error(OUTSIDE_SCOPE_MESSAGE);\n }\n return resolveLocale(store.locale);\n }\n\n getRegion(): string | undefined {\n const store = this.store.getStore();\n if (!store) {\n if (process.env.NODE_ENV === 'production') {\n console.warn(REGION_MESSAGE);\n return undefined;\n }\n throw new Error(REGION_MESSAGE);\n }\n return store.region;\n }\n\n /**\n * TODO: implement\n */\n getEnableI18n(): boolean {\n const store = this.store.getStore();\n if (!store) {\n if (process.env.NODE_ENV === 'production') {\n console.warn(ENABLE_I18N_MESSAGE);\n return true;\n }\n throw new Error(ENABLE_I18N_MESSAGE);\n }\n return store.enableI18n ?? true;\n }\n\n setLocale = (_locale: string): void => {};\n\n setRegion = (_region: string | undefined): void => {};\n\n setEnableI18n = (_enableI18n: boolean): void => {};\n}\n\nfunction resolveLocale(locale?: string): string {\n const i18nConfig = getI18nConfig();\n return i18nConfig.determineLocale(locale) || i18nConfig.getDefaultLocale();\n}\n"],"mappings":";;;AAGA,MAAa,EACX,mBAAmB,wBACnB,mBAAmB,4BAAA,GAAA,iBAAA,+BAEnB,4EACD;;;ACED,MAAM,wBACJ;AAEF,MAAM,iBACJ;AAEF,MAAM,sBACJ;;;;AASF,IAAa,sBAAb,MAA0E;CAGxE,YAAY,EAAE,UAAgD,EAAE,EAAE;oBAkDrD,YAA0B;oBAE1B,YAAsC;wBAElC,gBAA+B;AArD9C,OAAK,QAAQ,SAAS,IAAIA,iBAAAA,mBAAmB;;;;;CAM/C,IAAO,QAAgB,UAAsB;AAC3C,SAAO,KAAK,MAAM,IAAI,EAAE,QAAQ,cAAc,OAAO,EAAE,EAAE,SAAS;;CAGpE,YAAoB;EAClB,MAAM,QAAQ,KAAK,MAAM,UAAU;AACnC,MAAI,CAAC,OAAO;AACV,OAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,YAAQ,KAAK,sBAAsB;AACnC,WAAO,eAAe;;AAExB,SAAM,IAAI,MAAM,sBAAsB;;AAExC,SAAO,cAAc,MAAM,OAAO;;CAGpC,YAAgC;EAC9B,MAAM,QAAQ,KAAK,MAAM,UAAU;AACnC,MAAI,CAAC,OAAO;AACV,OAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,YAAQ,KAAK,eAAe;AAC5B;;AAEF,SAAM,IAAI,MAAM,eAAe;;AAEjC,SAAO,MAAM;;;;;CAMf,gBAAyB;EACvB,MAAM,QAAQ,KAAK,MAAM,UAAU;AACnC,MAAI,CAAC,OAAO;AACV,OAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,YAAQ,KAAK,oBAAoB;AACjC,WAAO;;AAET,SAAM,IAAI,MAAM,oBAAoB;;AAEtC,SAAO,MAAM,cAAc;;;AAU/B,SAAS,cAAc,QAAyB;CAC9C,MAAM,cAAA,GAAA,iBAAA,gBAA4B;AAClC,QAAO,WAAW,gBAAgB,OAAO,IAAI,WAAW,kBAAkB"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_AsyncConditionStore = require("./AsyncConditionStore-
|
|
2
|
+
const require_AsyncConditionStore = require("./AsyncConditionStore-VWuVcaxX.cjs");
|
|
3
3
|
let gt_i18n_internal = require("gt-i18n/internal");
|
|
4
4
|
let gt_i18n = require("gt-i18n");
|
|
5
5
|
//#region src/setup/initializeGT.ts
|
|
@@ -9,13 +9,11 @@ let gt_i18n = require("gt-i18n");
|
|
|
9
9
|
* TODO: auto detect if can find gt.config.json files
|
|
10
10
|
*/
|
|
11
11
|
function initializeGT(params) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
(0, gt_i18n_internal.setI18nManager)(i18nManager);
|
|
12
|
+
(0, gt_i18n_internal.setupGTServicesEnabled)(params);
|
|
13
|
+
(0, gt_i18n_internal.initializeI18nConfig)(params);
|
|
14
|
+
const i18nCache = new gt_i18n_internal.I18nCache(params);
|
|
15
|
+
const conditionStore = new require_AsyncConditionStore.AsyncConditionStore();
|
|
16
|
+
(0, gt_i18n_internal.setI18nCache)(i18nCache);
|
|
19
17
|
require_AsyncConditionStore.setAsyncConditionStore(conditionStore);
|
|
20
18
|
}
|
|
21
19
|
//#endregion
|
|
@@ -66,22 +64,13 @@ function parseAcceptLanguage(header) {
|
|
|
66
64
|
* });
|
|
67
65
|
*/
|
|
68
66
|
function getRequestLocale(request) {
|
|
69
|
-
const
|
|
70
|
-
const defaultLocale = i18nManager.getDefaultLocale();
|
|
71
|
-
const gtInstance = i18nManager.getGTClass();
|
|
67
|
+
const i18nConfig = (0, gt_i18n_internal.getI18nConfig)();
|
|
72
68
|
const acceptLanguage = request.headers["accept-language"];
|
|
73
69
|
const headerValue = Array.isArray(acceptLanguage) ? acceptLanguage[0] : acceptLanguage;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return gtInstance.determineLocale(preferredLocales) || defaultLocale;
|
|
70
|
+
const preferredLocales = headerValue ? parseAcceptLanguage(headerValue) : [];
|
|
71
|
+
return i18nConfig.determineLocale(preferredLocales) || i18nConfig.getDefaultLocale();
|
|
77
72
|
}
|
|
78
73
|
//#endregion
|
|
79
|
-
Object.defineProperty(exports, "declareStatic", {
|
|
80
|
-
enumerable: true,
|
|
81
|
-
get: function() {
|
|
82
|
-
return gt_i18n.declareStatic;
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
74
|
Object.defineProperty(exports, "declareVar", {
|
|
86
75
|
enumerable: true,
|
|
87
76
|
get: function() {
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["I18nCache","AsyncConditionStore","getAsyncConditionStore"],"sources":["../src/setup/initializeGT.ts","../src/setup/withGT.ts","../src/helpers/getRequestLocale.ts"],"sourcesContent":["import { setAsyncConditionStore } from '../async-i18n-cache/singleton-operations';\nimport type { InitializeGTParams } from './types';\nimport {\n I18nCache,\n initializeI18nConfig,\n setupGTServicesEnabled,\n setI18nCache,\n} from 'gt-i18n/internal';\nimport { AsyncConditionStore } from '../async-i18n-cache/AsyncConditionStore';\n\n/**\n * Configure GT for node runtime. This must be called to setup GT for node runtime.\n * @param {InitializeGTParams} config - The configuration for the GT instance\n * TODO: auto detect if can find gt.config.json files\n */\nexport function initializeGT(params: InitializeGTParams): void {\n setupGTServicesEnabled(params);\n initializeI18nConfig(params);\n\n const i18nCache = new I18nCache<string>(params);\n const conditionStore = new AsyncConditionStore();\n\n setI18nCache(i18nCache);\n setAsyncConditionStore(conditionStore);\n}\n","import { getAsyncConditionStore } from '../async-i18n-cache/singleton-operations';\n\n/**\n * This function wraps entry points to provide GT context\n */\nexport function withGT<T>(locale: string, fn: () => T): T {\n return getAsyncConditionStore().run<T>(locale, fn);\n}\n","import { getI18nConfig } from 'gt-i18n/internal';\n\n/**\n * A request object like interface\n * @interface RequestLike\n * @property {Record<string, string | string[] | undefined>} headers - The request headers\n */\ninterface RequestLike {\n headers: Record<string, string | string[] | undefined>;\n}\n\n/**\n * Parse the Accept-Language header into an array of locales\n * @param header - The Accept-Language header\n * @returns An array of locales\n *\n * @example\n * const locales = parseAcceptLanguage('fr-FR,fr;q=0.9,en;q=0.8');\n * console.log(locales); // ['fr-FR', 'fr', 'en']\n */\nfunction parseAcceptLanguage(header: string): string[] {\n return header\n .split(',')\n .map((entry) => {\n const [locale, quality] = entry.trim().split(';');\n const qPart = quality?.split('=')[1];\n const q = qPart !== undefined ? parseFloat(qPart) : 1;\n return {\n locale: locale.trim(),\n quality: isNaN(q) ? 1 : q,\n };\n })\n .sort((a, b) => b.quality - a.quality)\n .map((entry) => entry.locale);\n}\n\n/**\n * Resolve the preferred locale from the request Accept-Language header, fallback to the default locale if no match is found\n * @param request - The request object\n * @returns The preferred locale\n *\n * @example\n * const locale = getRequestLocale({ headers: { 'accept-language': 'fr-FR,fr;q=0.9,en;q=0.8' } });\n * console.log(locale); // 'fr'\n *\n * @example\n * app.get('/', (req, res) => {\n * const locale = getRequestLocale(req);\n * withGT(locale, () => {\n * res.send(`Locale: ${locale}`);\n * });\n * });\n */\nexport function getRequestLocale(request: RequestLike): string {\n // Setup\n const i18nConfig = getI18nConfig();\n\n // Get the accept-language header\n const acceptLanguage = request.headers['accept-language'];\n const headerValue = Array.isArray(acceptLanguage)\n ? acceptLanguage[0]\n : acceptLanguage;\n\n // Parse the accept-language header\n const preferredLocales = headerValue ? parseAcceptLanguage(headerValue) : [];\n return (\n i18nConfig.determineLocale(preferredLocales) ||\n i18nConfig.getDefaultLocale()\n );\n}\n"],"mappings":";;;;;;;;;;AAeA,SAAgB,aAAa,QAAkC;AAC7D,EAAA,GAAA,iBAAA,wBAAuB,OAAO;AAC9B,EAAA,GAAA,iBAAA,sBAAqB,OAAO;CAE5B,MAAM,YAAY,IAAIA,iBAAAA,UAAkB,OAAO;CAC/C,MAAM,iBAAiB,IAAIC,4BAAAA,qBAAqB;AAEhD,EAAA,GAAA,iBAAA,cAAa,UAAU;AACvB,6BAAA,uBAAuB,eAAe;;;;;;;AClBxC,SAAgB,OAAU,QAAgB,IAAgB;AACxD,QAAOC,4BAAAA,wBAAwB,CAAC,IAAO,QAAQ,GAAG;;;;;;;;;;;;;ACcpD,SAAS,oBAAoB,QAA0B;AACrD,QAAO,OACJ,MAAM,IAAI,CACV,KAAK,UAAU;EACd,MAAM,CAAC,QAAQ,WAAW,MAAM,MAAM,CAAC,MAAM,IAAI;EACjD,MAAM,QAAQ,SAAS,MAAM,IAAI,CAAC;EAClC,MAAM,IAAI,UAAU,KAAA,IAAY,WAAW,MAAM,GAAG;AACpD,SAAO;GACL,QAAQ,OAAO,MAAM;GACrB,SAAS,MAAM,EAAE,GAAG,IAAI;GACzB;GACD,CACD,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,QAAQ,CACrC,KAAK,UAAU,MAAM,OAAO;;;;;;;;;;;;;;;;;;;AAoBjC,SAAgB,iBAAiB,SAA8B;CAE7D,MAAM,cAAA,GAAA,iBAAA,gBAA4B;CAGlC,MAAM,iBAAiB,QAAQ,QAAQ;CACvC,MAAM,cAAc,MAAM,QAAQ,eAAe,GAC7C,eAAe,KACf;CAGJ,MAAM,mBAAmB,cAAc,oBAAoB,YAAY,GAAG,EAAE;AAC5E,QACE,WAAW,gBAAgB,iBAAiB,IAC5C,WAAW,kBAAkB"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as InitializeGTParams } from "./types-
|
|
2
|
-
import {
|
|
1
|
+
import { n as InitializeGTParams } from "./types-KHAnqXc6.cjs";
|
|
2
|
+
import { declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocale, getLocaleProperties, getLocales, getVersionId, msg } from "gt-i18n";
|
|
3
3
|
import { getGT, getMessages, getTranslations, tx } from "gt-i18n/internal";
|
|
4
4
|
|
|
5
5
|
//#region src/setup/initializeGT.d.ts
|
|
@@ -44,5 +44,5 @@ interface RequestLike {
|
|
|
44
44
|
*/
|
|
45
45
|
declare function getRequestLocale(request: RequestLike): string;
|
|
46
46
|
//#endregion
|
|
47
|
-
export {
|
|
47
|
+
export { declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getGT, getLocale, getLocaleProperties, getLocales, getMessages, getRequestLocale, getTranslations, getVersionId, initializeGT, msg, tx, withGT };
|
|
48
48
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as InitializeGTParams } from "./types-
|
|
1
|
+
import { n as InitializeGTParams } from "./types-o5MTESyx.mjs";
|
|
2
2
|
import { getGT, getMessages, getTranslations, tx } from "gt-i18n/internal";
|
|
3
|
-
import {
|
|
3
|
+
import { declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocale, getLocaleProperties, getLocales, getVersionId, msg } from "gt-i18n";
|
|
4
4
|
|
|
5
5
|
//#region src/setup/initializeGT.d.ts
|
|
6
6
|
/**
|
|
@@ -44,5 +44,5 @@ interface RequestLike {
|
|
|
44
44
|
*/
|
|
45
45
|
declare function getRequestLocale(request: RequestLike): string;
|
|
46
46
|
//#endregion
|
|
47
|
-
export {
|
|
47
|
+
export { declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getGT, getLocale, getLocaleProperties, getLocales, getMessages, getRequestLocale, getTranslations, getVersionId, initializeGT, msg, tx, withGT };
|
|
48
48
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as getAsyncConditionStore, r as setAsyncConditionStore, t as AsyncConditionStore } from "./AsyncConditionStore-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { n as getAsyncConditionStore, r as setAsyncConditionStore, t as AsyncConditionStore } from "./AsyncConditionStore-DZKxeqET.mjs";
|
|
2
|
+
import { I18nCache, getGT, getI18nConfig, getMessages, getTranslations, initializeI18nConfig, setI18nCache, setupGTServicesEnabled, tx } from "gt-i18n/internal";
|
|
3
|
+
import { declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocale, getLocaleProperties, getLocales, getVersionId, msg } from "gt-i18n";
|
|
4
4
|
//#region src/setup/initializeGT.ts
|
|
5
5
|
/**
|
|
6
6
|
* Configure GT for node runtime. This must be called to setup GT for node runtime.
|
|
@@ -8,13 +8,11 @@ import { declareStatic, declareVar, decodeMsg, decodeOptions, decodeVars, derive
|
|
|
8
8
|
* TODO: auto detect if can find gt.config.json files
|
|
9
9
|
*/
|
|
10
10
|
function initializeGT(params) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
17
|
-
setI18nManager(i18nManager);
|
|
11
|
+
setupGTServicesEnabled(params);
|
|
12
|
+
initializeI18nConfig(params);
|
|
13
|
+
const i18nCache = new I18nCache(params);
|
|
14
|
+
const conditionStore = new AsyncConditionStore();
|
|
15
|
+
setI18nCache(i18nCache);
|
|
18
16
|
setAsyncConditionStore(conditionStore);
|
|
19
17
|
}
|
|
20
18
|
//#endregion
|
|
@@ -65,16 +63,13 @@ function parseAcceptLanguage(header) {
|
|
|
65
63
|
* });
|
|
66
64
|
*/
|
|
67
65
|
function getRequestLocale(request) {
|
|
68
|
-
const
|
|
69
|
-
const defaultLocale = i18nManager.getDefaultLocale();
|
|
70
|
-
const gtInstance = i18nManager.getGTClass();
|
|
66
|
+
const i18nConfig = getI18nConfig();
|
|
71
67
|
const acceptLanguage = request.headers["accept-language"];
|
|
72
68
|
const headerValue = Array.isArray(acceptLanguage) ? acceptLanguage[0] : acceptLanguage;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return gtInstance.determineLocale(preferredLocales) || defaultLocale;
|
|
69
|
+
const preferredLocales = headerValue ? parseAcceptLanguage(headerValue) : [];
|
|
70
|
+
return i18nConfig.determineLocale(preferredLocales) || i18nConfig.getDefaultLocale();
|
|
76
71
|
}
|
|
77
72
|
//#endregion
|
|
78
|
-
export {
|
|
73
|
+
export { declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getGT, getLocale, getLocaleProperties, getLocales, getMessages, getRequestLocale, getTranslations, getVersionId, initializeGT, msg, tx, withGT };
|
|
79
74
|
|
|
80
75
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/setup/initializeGT.ts","../src/setup/withGT.ts","../src/helpers/getRequestLocale.ts"],"sourcesContent":["import { setAsyncConditionStore } from '../async-i18n-
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/setup/initializeGT.ts","../src/setup/withGT.ts","../src/helpers/getRequestLocale.ts"],"sourcesContent":["import { setAsyncConditionStore } from '../async-i18n-cache/singleton-operations';\nimport type { InitializeGTParams } from './types';\nimport {\n I18nCache,\n initializeI18nConfig,\n setupGTServicesEnabled,\n setI18nCache,\n} from 'gt-i18n/internal';\nimport { AsyncConditionStore } from '../async-i18n-cache/AsyncConditionStore';\n\n/**\n * Configure GT for node runtime. This must be called to setup GT for node runtime.\n * @param {InitializeGTParams} config - The configuration for the GT instance\n * TODO: auto detect if can find gt.config.json files\n */\nexport function initializeGT(params: InitializeGTParams): void {\n setupGTServicesEnabled(params);\n initializeI18nConfig(params);\n\n const i18nCache = new I18nCache<string>(params);\n const conditionStore = new AsyncConditionStore();\n\n setI18nCache(i18nCache);\n setAsyncConditionStore(conditionStore);\n}\n","import { getAsyncConditionStore } from '../async-i18n-cache/singleton-operations';\n\n/**\n * This function wraps entry points to provide GT context\n */\nexport function withGT<T>(locale: string, fn: () => T): T {\n return getAsyncConditionStore().run<T>(locale, fn);\n}\n","import { getI18nConfig } from 'gt-i18n/internal';\n\n/**\n * A request object like interface\n * @interface RequestLike\n * @property {Record<string, string | string[] | undefined>} headers - The request headers\n */\ninterface RequestLike {\n headers: Record<string, string | string[] | undefined>;\n}\n\n/**\n * Parse the Accept-Language header into an array of locales\n * @param header - The Accept-Language header\n * @returns An array of locales\n *\n * @example\n * const locales = parseAcceptLanguage('fr-FR,fr;q=0.9,en;q=0.8');\n * console.log(locales); // ['fr-FR', 'fr', 'en']\n */\nfunction parseAcceptLanguage(header: string): string[] {\n return header\n .split(',')\n .map((entry) => {\n const [locale, quality] = entry.trim().split(';');\n const qPart = quality?.split('=')[1];\n const q = qPart !== undefined ? parseFloat(qPart) : 1;\n return {\n locale: locale.trim(),\n quality: isNaN(q) ? 1 : q,\n };\n })\n .sort((a, b) => b.quality - a.quality)\n .map((entry) => entry.locale);\n}\n\n/**\n * Resolve the preferred locale from the request Accept-Language header, fallback to the default locale if no match is found\n * @param request - The request object\n * @returns The preferred locale\n *\n * @example\n * const locale = getRequestLocale({ headers: { 'accept-language': 'fr-FR,fr;q=0.9,en;q=0.8' } });\n * console.log(locale); // 'fr'\n *\n * @example\n * app.get('/', (req, res) => {\n * const locale = getRequestLocale(req);\n * withGT(locale, () => {\n * res.send(`Locale: ${locale}`);\n * });\n * });\n */\nexport function getRequestLocale(request: RequestLike): string {\n // Setup\n const i18nConfig = getI18nConfig();\n\n // Get the accept-language header\n const acceptLanguage = request.headers['accept-language'];\n const headerValue = Array.isArray(acceptLanguage)\n ? acceptLanguage[0]\n : acceptLanguage;\n\n // Parse the accept-language header\n const preferredLocales = headerValue ? parseAcceptLanguage(headerValue) : [];\n return (\n i18nConfig.determineLocale(preferredLocales) ||\n i18nConfig.getDefaultLocale()\n );\n}\n"],"mappings":";;;;;;;;;AAeA,SAAgB,aAAa,QAAkC;AAC7D,wBAAuB,OAAO;AAC9B,sBAAqB,OAAO;CAE5B,MAAM,YAAY,IAAI,UAAkB,OAAO;CAC/C,MAAM,iBAAiB,IAAI,qBAAqB;AAEhD,cAAa,UAAU;AACvB,wBAAuB,eAAe;;;;;;;AClBxC,SAAgB,OAAU,QAAgB,IAAgB;AACxD,QAAO,wBAAwB,CAAC,IAAO,QAAQ,GAAG;;;;;;;;;;;;;ACcpD,SAAS,oBAAoB,QAA0B;AACrD,QAAO,OACJ,MAAM,IAAI,CACV,KAAK,UAAU;EACd,MAAM,CAAC,QAAQ,WAAW,MAAM,MAAM,CAAC,MAAM,IAAI;EACjD,MAAM,QAAQ,SAAS,MAAM,IAAI,CAAC;EAClC,MAAM,IAAI,UAAU,KAAA,IAAY,WAAW,MAAM,GAAG;AACpD,SAAO;GACL,QAAQ,OAAO,MAAM;GACrB,SAAS,MAAM,EAAE,GAAG,IAAI;GACzB;GACD,CACD,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,QAAQ,CACrC,KAAK,UAAU,MAAM,OAAO;;;;;;;;;;;;;;;;;;;AAoBjC,SAAgB,iBAAiB,SAA8B;CAE7D,MAAM,aAAa,eAAe;CAGlC,MAAM,iBAAiB,QAAQ,QAAQ;CACvC,MAAM,cAAc,MAAM,QAAQ,eAAe,GAC7C,eAAe,KACf;CAGJ,MAAM,mBAAmB,cAAc,oBAAoB,YAAY,GAAG,EAAE;AAC5E,QACE,WAAW,gBAAgB,iBAAiB,IAC5C,WAAW,kBAAkB"}
|
package/dist/internal.cjs
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_AsyncConditionStore = require("./AsyncConditionStore-
|
|
2
|
+
const require_AsyncConditionStore = require("./AsyncConditionStore-VWuVcaxX.cjs");
|
|
3
3
|
let gt_i18n_internal = require("gt-i18n/internal");
|
|
4
4
|
exports.AsyncConditionStore = require_AsyncConditionStore.AsyncConditionStore;
|
|
5
|
-
Object.defineProperty(exports, "
|
|
5
|
+
Object.defineProperty(exports, "I18nCache", {
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: function() {
|
|
8
|
-
return gt_i18n_internal.
|
|
8
|
+
return gt_i18n_internal.I18nCache;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
exports.getAsyncConditionStore = require_AsyncConditionStore.getAsyncConditionStore;
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "getI18nCache", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function() {
|
|
15
|
-
return gt_i18n_internal.
|
|
15
|
+
return gt_i18n_internal.getI18nCache;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
exports.setAsyncConditionStore = require_AsyncConditionStore.setAsyncConditionStore;
|
|
19
|
-
Object.defineProperty(exports, "
|
|
19
|
+
Object.defineProperty(exports, "setI18nCache", {
|
|
20
20
|
enumerable: true,
|
|
21
21
|
get: function() {
|
|
22
|
-
return gt_i18n_internal.
|
|
22
|
+
return gt_i18n_internal.setI18nCache;
|
|
23
23
|
}
|
|
24
24
|
});
|
package/dist/internal.d.cts
CHANGED
|
@@ -1,32 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ScopedConditionStoreInterface } from "gt-i18n/internal/types";
|
|
2
|
+
import { I18nCache, getI18nCache, setI18nCache } from "gt-i18n/internal";
|
|
3
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
4
|
|
|
5
|
-
//#region src/async-i18n-
|
|
5
|
+
//#region src/async-i18n-cache/AsyncConditionStore.d.ts
|
|
6
6
|
type Store = {
|
|
7
7
|
locale: string;
|
|
8
|
+
region?: string;
|
|
9
|
+
enableI18n?: boolean;
|
|
8
10
|
};
|
|
9
|
-
type AsyncConditionStoreConstructorParams =
|
|
11
|
+
type AsyncConditionStoreConstructorParams = {
|
|
10
12
|
store?: AsyncLocalStorage<Store>;
|
|
11
13
|
};
|
|
12
14
|
/**
|
|
13
15
|
* Condition store implementation that uses AsyncLocalStorage.
|
|
14
16
|
*/
|
|
15
|
-
declare class AsyncConditionStore implements
|
|
17
|
+
declare class AsyncConditionStore implements ScopedConditionStoreInterface {
|
|
16
18
|
private store;
|
|
17
|
-
private resolveLocale;
|
|
18
19
|
constructor({
|
|
19
|
-
defaultLocale,
|
|
20
|
-
locales,
|
|
21
|
-
customMapping,
|
|
22
20
|
store
|
|
23
21
|
}?: AsyncConditionStoreConstructorParams);
|
|
22
|
+
/**
|
|
23
|
+
* TODO: should this be a static function
|
|
24
|
+
* */
|
|
24
25
|
run<T>(locale: string, callback: () => T): T;
|
|
25
26
|
getLocale(): string;
|
|
27
|
+
getRegion(): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* TODO: implement
|
|
30
|
+
*/
|
|
31
|
+
getEnableI18n(): boolean;
|
|
32
|
+
setLocale: (_locale: string) => void;
|
|
33
|
+
setRegion: (_region: string | undefined) => void;
|
|
34
|
+
setEnableI18n: (_enableI18n: boolean) => void;
|
|
26
35
|
}
|
|
27
36
|
//#endregion
|
|
28
|
-
//#region src/async-i18n-
|
|
37
|
+
//#region src/async-i18n-cache/singleton-operations.d.ts
|
|
29
38
|
declare const getAsyncConditionStore: () => AsyncConditionStore, setAsyncConditionStore: (nextConditionStore: AsyncConditionStore) => void;
|
|
30
39
|
//#endregion
|
|
31
|
-
export { AsyncConditionStore,
|
|
40
|
+
export { AsyncConditionStore, I18nCache, getAsyncConditionStore, getI18nCache, setAsyncConditionStore, setI18nCache };
|
|
32
41
|
//# sourceMappingURL=internal.d.cts.map
|
package/dist/internal.d.mts
CHANGED
|
@@ -1,32 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I18nCache, getI18nCache, setI18nCache } from "gt-i18n/internal";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
|
-
import {
|
|
3
|
+
import { ScopedConditionStoreInterface } from "gt-i18n/internal/types";
|
|
4
4
|
|
|
5
|
-
//#region src/async-i18n-
|
|
5
|
+
//#region src/async-i18n-cache/AsyncConditionStore.d.ts
|
|
6
6
|
type Store = {
|
|
7
7
|
locale: string;
|
|
8
|
+
region?: string;
|
|
9
|
+
enableI18n?: boolean;
|
|
8
10
|
};
|
|
9
|
-
type AsyncConditionStoreConstructorParams =
|
|
11
|
+
type AsyncConditionStoreConstructorParams = {
|
|
10
12
|
store?: AsyncLocalStorage<Store>;
|
|
11
13
|
};
|
|
12
14
|
/**
|
|
13
15
|
* Condition store implementation that uses AsyncLocalStorage.
|
|
14
16
|
*/
|
|
15
|
-
declare class AsyncConditionStore implements
|
|
17
|
+
declare class AsyncConditionStore implements ScopedConditionStoreInterface {
|
|
16
18
|
private store;
|
|
17
|
-
private resolveLocale;
|
|
18
19
|
constructor({
|
|
19
|
-
defaultLocale,
|
|
20
|
-
locales,
|
|
21
|
-
customMapping,
|
|
22
20
|
store
|
|
23
21
|
}?: AsyncConditionStoreConstructorParams);
|
|
22
|
+
/**
|
|
23
|
+
* TODO: should this be a static function
|
|
24
|
+
* */
|
|
24
25
|
run<T>(locale: string, callback: () => T): T;
|
|
25
26
|
getLocale(): string;
|
|
27
|
+
getRegion(): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* TODO: implement
|
|
30
|
+
*/
|
|
31
|
+
getEnableI18n(): boolean;
|
|
32
|
+
setLocale: (_locale: string) => void;
|
|
33
|
+
setRegion: (_region: string | undefined) => void;
|
|
34
|
+
setEnableI18n: (_enableI18n: boolean) => void;
|
|
26
35
|
}
|
|
27
36
|
//#endregion
|
|
28
|
-
//#region src/async-i18n-
|
|
37
|
+
//#region src/async-i18n-cache/singleton-operations.d.ts
|
|
29
38
|
declare const getAsyncConditionStore: () => AsyncConditionStore, setAsyncConditionStore: (nextConditionStore: AsyncConditionStore) => void;
|
|
30
39
|
//#endregion
|
|
31
|
-
export { AsyncConditionStore,
|
|
40
|
+
export { AsyncConditionStore, I18nCache, getAsyncConditionStore, getI18nCache, setAsyncConditionStore, setI18nCache };
|
|
32
41
|
//# sourceMappingURL=internal.d.mts.map
|
package/dist/internal.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as getAsyncConditionStore, r as setAsyncConditionStore, t as AsyncConditionStore } from "./AsyncConditionStore-
|
|
2
|
-
import {
|
|
3
|
-
export { AsyncConditionStore,
|
|
1
|
+
import { n as getAsyncConditionStore, r as setAsyncConditionStore, t as AsyncConditionStore } from "./AsyncConditionStore-DZKxeqET.mjs";
|
|
2
|
+
import { I18nCache, getI18nCache, setI18nCache } from "gt-i18n/internal";
|
|
3
|
+
export { AsyncConditionStore, I18nCache, getAsyncConditionStore, getI18nCache, setAsyncConditionStore, setI18nCache };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GTConfig, GTServicesEnabledParams, I18nCacheConstructorParams, I18nConfigParams, TranslationsLoader } from "gt-i18n/internal/types";
|
|
2
|
+
|
|
3
|
+
//#region src/setup/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for the initializing GT
|
|
6
|
+
* @param {string} params.defaultLocale - The default locale to use
|
|
7
|
+
* @param {string[]} params.locales - The locales to support
|
|
8
|
+
* @param {object} params.loadTranslations - The custom translation loader to use
|
|
9
|
+
*/
|
|
10
|
+
type InitializeGTParams = I18nConfigParams & GTServicesEnabledParams & I18nCacheConstructorParams<string>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { InitializeGTParams as n, TranslationsLoader as r, GTConfig as t };
|
|
13
|
+
//# sourceMappingURL=types-KHAnqXc6.d.cts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GTConfig, GTServicesEnabledParams, I18nCacheConstructorParams, I18nConfigParams, TranslationsLoader } from "gt-i18n/internal/types";
|
|
2
|
+
|
|
3
|
+
//#region src/setup/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for the initializing GT
|
|
6
|
+
* @param {string} params.defaultLocale - The default locale to use
|
|
7
|
+
* @param {string[]} params.locales - The locales to support
|
|
8
|
+
* @param {object} params.loadTranslations - The custom translation loader to use
|
|
9
|
+
*/
|
|
10
|
+
type InitializeGTParams = I18nConfigParams & GTServicesEnabledParams & I18nCacheConstructorParams<string>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { InitializeGTParams as n, TranslationsLoader as r, GTConfig as t };
|
|
13
|
+
//# sourceMappingURL=types-o5MTESyx.d.mts.map
|
package/dist/types.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as InitializeGTParams, r as TranslationsLoader, t as GTConfig } from "./types-
|
|
1
|
+
import { n as InitializeGTParams, r as TranslationsLoader, t as GTConfig } from "./types-KHAnqXc6.cjs";
|
|
2
2
|
import { DictionaryTranslationOptions, GTFunctionType, InlineTranslationOptions, MFunctionType, RuntimeTranslationOptions, TFunctionType } from "gt-i18n/types";
|
|
3
3
|
export { type DictionaryTranslationOptions, GTConfig, type GTFunctionType, InitializeGTParams, type InlineTranslationOptions, type MFunctionType, type RuntimeTranslationOptions, type TFunctionType, TranslationsLoader };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as InitializeGTParams, r as TranslationsLoader, t as GTConfig } from "./types-
|
|
1
|
+
import { n as InitializeGTParams, r as TranslationsLoader, t as GTConfig } from "./types-o5MTESyx.mjs";
|
|
2
2
|
import { DictionaryTranslationOptions, GTFunctionType, InlineTranslationOptions, MFunctionType, RuntimeTranslationOptions, TFunctionType } from "gt-i18n/types";
|
|
3
3
|
export { type DictionaryTranslationOptions, GTConfig, type GTFunctionType, InitializeGTParams, type InlineTranslationOptions, type MFunctionType, type RuntimeTranslationOptions, type TFunctionType, TranslationsLoader };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gt-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-odysseus.1",
|
|
4
4
|
"description": "Node.js utilities for General Translation",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"definition": "dist/index.d.cts"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"gt-i18n": "0.
|
|
48
|
-
"generaltranslation": "
|
|
47
|
+
"gt-i18n": "1.0.0-odysseus.1",
|
|
48
|
+
"generaltranslation": "9.0.0-odysseus.1"
|
|
49
49
|
},
|
|
50
50
|
"exports": {
|
|
51
51
|
".": {
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { createConditionStoreSingleton, createLocaleResolver } from "gt-i18n/internal";
|
|
2
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
|
-
//#region src/async-i18n-manager/singleton-operations.ts
|
|
4
|
-
const { getConditionStore: getAsyncConditionStore, setConditionStore: setAsyncConditionStore } = createConditionStoreSingleton("AsyncConditionStore not initialized. Invoke initializeGT() to initialize.");
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/async-i18n-manager/AsyncConditionStore.ts
|
|
7
|
-
const OUTSIDE_SCOPE_MESSAGE = "AsyncConditionStore: getLocale() called outside of a withGT() scope.";
|
|
8
|
-
/**
|
|
9
|
-
* Condition store implementation that uses AsyncLocalStorage.
|
|
10
|
-
*/
|
|
11
|
-
var AsyncConditionStore = class {
|
|
12
|
-
constructor({ defaultLocale, locales, customMapping, store } = {}) {
|
|
13
|
-
this.store = store ?? new AsyncLocalStorage();
|
|
14
|
-
this.resolveLocale = createLocaleResolver({
|
|
15
|
-
defaultLocale,
|
|
16
|
-
locales,
|
|
17
|
-
customMapping
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
run(locale, callback) {
|
|
21
|
-
return this.store.run({ locale: this.resolveLocale(locale) }, callback);
|
|
22
|
-
}
|
|
23
|
-
getLocale() {
|
|
24
|
-
const store = this.store.getStore();
|
|
25
|
-
if (!store) {
|
|
26
|
-
if (process.env.NODE_ENV === "production") {
|
|
27
|
-
console.warn(OUTSIDE_SCOPE_MESSAGE);
|
|
28
|
-
return this.resolveLocale();
|
|
29
|
-
}
|
|
30
|
-
throw new Error(OUTSIDE_SCOPE_MESSAGE);
|
|
31
|
-
}
|
|
32
|
-
return this.resolveLocale(store.locale);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
//#endregion
|
|
36
|
-
export { getAsyncConditionStore as n, setAsyncConditionStore as r, AsyncConditionStore as t };
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=AsyncConditionStore-CgVuzOnG.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncConditionStore-CgVuzOnG.mjs","names":[],"sources":["../src/async-i18n-manager/singleton-operations.ts","../src/async-i18n-manager/AsyncConditionStore.ts"],"sourcesContent":["import { createConditionStoreSingleton } from 'gt-i18n/internal';\nimport type { AsyncConditionStore } from './AsyncConditionStore';\n\nexport const {\n getConditionStore: getAsyncConditionStore,\n setConditionStore: setAsyncConditionStore,\n} = createConditionStoreSingleton<AsyncConditionStore>(\n 'AsyncConditionStore not initialized. Invoke initializeGT() to initialize.'\n);\n","import { AsyncLocalStorage } from 'node:async_hooks';\nimport { createLocaleResolver } from 'gt-i18n/internal';\nimport type {\n LocaleCandidates,\n ConditionStoreConfig,\n ScopedConditionStore,\n} from 'gt-i18n/internal/types';\n\ntype Store = {\n locale: string;\n};\n\nconst OUTSIDE_SCOPE_MESSAGE =\n 'AsyncConditionStore: getLocale() called outside of a withGT() scope.';\n\ntype AsyncConditionStoreConstructorParams = ConditionStoreConfig & {\n store?: AsyncLocalStorage<Store>;\n};\n\n/**\n * Condition store implementation that uses AsyncLocalStorage.\n */\nexport class AsyncConditionStore implements ScopedConditionStore {\n private store: AsyncLocalStorage<Store>;\n private resolveLocale: (candidates?: LocaleCandidates) => string;\n\n constructor({\n defaultLocale,\n locales,\n customMapping,\n store,\n }: AsyncConditionStoreConstructorParams = {}) {\n this.store = store ?? new AsyncLocalStorage();\n this.resolveLocale = createLocaleResolver({\n defaultLocale,\n locales,\n customMapping,\n });\n }\n\n run<T>(locale: string, callback: () => T): T {\n return this.store.run({ locale: this.resolveLocale(locale) }, callback);\n }\n\n getLocale(): string {\n const store = this.store.getStore();\n if (!store) {\n if (process.env.NODE_ENV === 'production') {\n console.warn(OUTSIDE_SCOPE_MESSAGE);\n return this.resolveLocale();\n }\n throw new Error(OUTSIDE_SCOPE_MESSAGE);\n }\n return this.resolveLocale(store.locale);\n }\n}\n"],"mappings":";;;AAGA,MAAa,EACX,mBAAmB,wBACnB,mBAAmB,2BACjB,8BACF,4EACD;;;ACID,MAAM,wBACJ;;;;AASF,IAAa,sBAAb,MAAiE;CAI/D,YAAY,EACV,eACA,SACA,eACA,UACwC,EAAE,EAAE;AAC5C,OAAK,QAAQ,SAAS,IAAI,mBAAmB;AAC7C,OAAK,gBAAgB,qBAAqB;GACxC;GACA;GACA;GACD,CAAC;;CAGJ,IAAO,QAAgB,UAAsB;AAC3C,SAAO,KAAK,MAAM,IAAI,EAAE,QAAQ,KAAK,cAAc,OAAO,EAAE,EAAE,SAAS;;CAGzE,YAAoB;EAClB,MAAM,QAAQ,KAAK,MAAM,UAAU;AACnC,MAAI,CAAC,OAAO;AACV,OAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,YAAQ,KAAK,sBAAsB;AACnC,WAAO,KAAK,eAAe;;AAE7B,SAAM,IAAI,MAAM,sBAAsB;;AAExC,SAAO,KAAK,cAAc,MAAM,OAAO"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
let gt_i18n_internal = require("gt-i18n/internal");
|
|
2
|
-
let node_async_hooks = require("node:async_hooks");
|
|
3
|
-
//#region src/async-i18n-manager/singleton-operations.ts
|
|
4
|
-
const { getConditionStore: getAsyncConditionStore, setConditionStore: setAsyncConditionStore } = (0, gt_i18n_internal.createConditionStoreSingleton)("AsyncConditionStore not initialized. Invoke initializeGT() to initialize.");
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/async-i18n-manager/AsyncConditionStore.ts
|
|
7
|
-
const OUTSIDE_SCOPE_MESSAGE = "AsyncConditionStore: getLocale() called outside of a withGT() scope.";
|
|
8
|
-
/**
|
|
9
|
-
* Condition store implementation that uses AsyncLocalStorage.
|
|
10
|
-
*/
|
|
11
|
-
var AsyncConditionStore = class {
|
|
12
|
-
constructor({ defaultLocale, locales, customMapping, store } = {}) {
|
|
13
|
-
this.store = store ?? new node_async_hooks.AsyncLocalStorage();
|
|
14
|
-
this.resolveLocale = (0, gt_i18n_internal.createLocaleResolver)({
|
|
15
|
-
defaultLocale,
|
|
16
|
-
locales,
|
|
17
|
-
customMapping
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
run(locale, callback) {
|
|
21
|
-
return this.store.run({ locale: this.resolveLocale(locale) }, callback);
|
|
22
|
-
}
|
|
23
|
-
getLocale() {
|
|
24
|
-
const store = this.store.getStore();
|
|
25
|
-
if (!store) {
|
|
26
|
-
if (process.env.NODE_ENV === "production") {
|
|
27
|
-
console.warn(OUTSIDE_SCOPE_MESSAGE);
|
|
28
|
-
return this.resolveLocale();
|
|
29
|
-
}
|
|
30
|
-
throw new Error(OUTSIDE_SCOPE_MESSAGE);
|
|
31
|
-
}
|
|
32
|
-
return this.resolveLocale(store.locale);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
//#endregion
|
|
36
|
-
Object.defineProperty(exports, "AsyncConditionStore", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function() {
|
|
39
|
-
return AsyncConditionStore;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "getAsyncConditionStore", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function() {
|
|
45
|
-
return getAsyncConditionStore;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "setAsyncConditionStore", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function() {
|
|
51
|
-
return setAsyncConditionStore;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
//# sourceMappingURL=AsyncConditionStore-hiVLxQyY.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncConditionStore-hiVLxQyY.cjs","names":["AsyncLocalStorage"],"sources":["../src/async-i18n-manager/singleton-operations.ts","../src/async-i18n-manager/AsyncConditionStore.ts"],"sourcesContent":["import { createConditionStoreSingleton } from 'gt-i18n/internal';\nimport type { AsyncConditionStore } from './AsyncConditionStore';\n\nexport const {\n getConditionStore: getAsyncConditionStore,\n setConditionStore: setAsyncConditionStore,\n} = createConditionStoreSingleton<AsyncConditionStore>(\n 'AsyncConditionStore not initialized. Invoke initializeGT() to initialize.'\n);\n","import { AsyncLocalStorage } from 'node:async_hooks';\nimport { createLocaleResolver } from 'gt-i18n/internal';\nimport type {\n LocaleCandidates,\n ConditionStoreConfig,\n ScopedConditionStore,\n} from 'gt-i18n/internal/types';\n\ntype Store = {\n locale: string;\n};\n\nconst OUTSIDE_SCOPE_MESSAGE =\n 'AsyncConditionStore: getLocale() called outside of a withGT() scope.';\n\ntype AsyncConditionStoreConstructorParams = ConditionStoreConfig & {\n store?: AsyncLocalStorage<Store>;\n};\n\n/**\n * Condition store implementation that uses AsyncLocalStorage.\n */\nexport class AsyncConditionStore implements ScopedConditionStore {\n private store: AsyncLocalStorage<Store>;\n private resolveLocale: (candidates?: LocaleCandidates) => string;\n\n constructor({\n defaultLocale,\n locales,\n customMapping,\n store,\n }: AsyncConditionStoreConstructorParams = {}) {\n this.store = store ?? new AsyncLocalStorage();\n this.resolveLocale = createLocaleResolver({\n defaultLocale,\n locales,\n customMapping,\n });\n }\n\n run<T>(locale: string, callback: () => T): T {\n return this.store.run({ locale: this.resolveLocale(locale) }, callback);\n }\n\n getLocale(): string {\n const store = this.store.getStore();\n if (!store) {\n if (process.env.NODE_ENV === 'production') {\n console.warn(OUTSIDE_SCOPE_MESSAGE);\n return this.resolveLocale();\n }\n throw new Error(OUTSIDE_SCOPE_MESSAGE);\n }\n return this.resolveLocale(store.locale);\n }\n}\n"],"mappings":";;;AAGA,MAAa,EACX,mBAAmB,wBACnB,mBAAmB,4BAAA,GAAA,iBAAA,+BAEnB,4EACD;;;ACID,MAAM,wBACJ;;;;AASF,IAAa,sBAAb,MAAiE;CAI/D,YAAY,EACV,eACA,SACA,eACA,UACwC,EAAE,EAAE;AAC5C,OAAK,QAAQ,SAAS,IAAIA,iBAAAA,mBAAmB;AAC7C,OAAK,iBAAA,GAAA,iBAAA,sBAAqC;GACxC;GACA;GACA;GACD,CAAC;;CAGJ,IAAO,QAAgB,UAAsB;AAC3C,SAAO,KAAK,MAAM,IAAI,EAAE,QAAQ,KAAK,cAAc,OAAO,EAAE,EAAE,SAAS;;CAGzE,YAAoB;EAClB,MAAM,QAAQ,KAAK,MAAM,UAAU;AACnC,MAAI,CAAC,OAAO;AACV,OAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,YAAQ,KAAK,sBAAsB;AACnC,WAAO,KAAK,eAAe;;AAE7B,SAAM,IAAI,MAAM,sBAAsB;;AAExC,SAAO,KAAK,cAAc,MAAM,OAAO"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { DictionaryConfig, GTConfig, GTConfig as GTConfig$1, TranslationsLoader, TranslationsLoader as TranslationsLoader$1 } from "gt-i18n/internal/types";
|
|
2
|
-
|
|
3
|
-
//#region src/setup/types.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Parameters for the initializing GT
|
|
6
|
-
* @param {string} params.defaultLocale - The default locale to use
|
|
7
|
-
* @param {string[]} params.locales - The locales to support
|
|
8
|
-
* @param {object} params.loadTranslations - The custom translation loader to use
|
|
9
|
-
*/
|
|
10
|
-
type InitializeGTParams = DictionaryConfig & GTConfig & {
|
|
11
|
-
loadTranslations?: TranslationsLoader;
|
|
12
|
-
};
|
|
13
|
-
//#endregion
|
|
14
|
-
export { InitializeGTParams as n, TranslationsLoader$1 as r, GTConfig$1 as t };
|
|
15
|
-
//# sourceMappingURL=types-D2TZTLXG.d.mts.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { DictionaryConfig, GTConfig, GTConfig as GTConfig$1, TranslationsLoader, TranslationsLoader as TranslationsLoader$1 } from "gt-i18n/internal/types";
|
|
2
|
-
|
|
3
|
-
//#region src/setup/types.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Parameters for the initializing GT
|
|
6
|
-
* @param {string} params.defaultLocale - The default locale to use
|
|
7
|
-
* @param {string[]} params.locales - The locales to support
|
|
8
|
-
* @param {object} params.loadTranslations - The custom translation loader to use
|
|
9
|
-
*/
|
|
10
|
-
type InitializeGTParams = DictionaryConfig & GTConfig & {
|
|
11
|
-
loadTranslations?: TranslationsLoader;
|
|
12
|
-
};
|
|
13
|
-
//#endregion
|
|
14
|
-
export { InitializeGTParams as n, TranslationsLoader$1 as r, GTConfig$1 as t };
|
|
15
|
-
//# sourceMappingURL=types-DsauAGkA.d.cts.map
|