gt-i18n 1.0.5 → 1.0.7
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 +18 -0
- package/dist/{WritableConditionStore-Y7klxD29.d.mts → WritableConditionStore-8482OsuJ.d.mts} +4 -53
- package/dist/{WritableConditionStore-7OwoOSxr.d.cts → WritableConditionStore-DG-jgrei.d.cts} +3 -53
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/internal-types.d.cts +1 -1
- package/dist/internal-types.d.mts +1 -1
- package/dist/internal.cjs +6 -2
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.mts +1 -1
- package/dist/internal.mjs +6 -2
- package/dist/internal.mjs.map +1 -1
- package/dist/{versionId-CT-IBMV6.cjs → versionId-D617MMZw.cjs} +3 -3
- package/dist/versionId-D617MMZw.cjs.map +1 -0
- package/dist/{versionId-JokehdDv.mjs → versionId-DEb3k2mY.mjs} +3 -3
- package/dist/versionId-DEb3k2mY.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/versionId-CT-IBMV6.cjs.map +0 -1
- package/dist/versionId-JokehdDv.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# gt-i18n
|
|
2
2
|
|
|
3
|
+
## 1.0.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1916](https://github.com/generaltranslation/gt/pull/1916) [`c658e7e`](https://github.com/generaltranslation/gt/commit/c658e7e1f6929965e3752a6828e3658dd8c527a8) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Unify `gt.config.json` types so complete config objects can be spread into compiler plugins and runtime initializers while file settings remain optional.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`c658e7e`](https://github.com/generaltranslation/gt/commit/c658e7e1f6929965e3752a6828e3658dd8c527a8)]:
|
|
10
|
+
- generaltranslation@9.0.3
|
|
11
|
+
|
|
12
|
+
## 1.0.6
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#1901](https://github.com/generaltranslation/gt/pull/1901) [`8836fbd`](https://github.com/generaltranslation/gt/commit/8836fbda088b5192b2eaa8e2109a724256458bc2) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Forward the top-level `modelProvider` configuration to runtime translation requests while allowing explicit runtime metadata to override it.
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`5d93858`](https://github.com/generaltranslation/gt/commit/5d9385872eb041af0991fc273d5eddd7a032e584), [`5721267`](https://github.com/generaltranslation/gt/commit/57212672a595c8c8578366636767bcbfe8ab6e57), [`8b9b440`](https://github.com/generaltranslation/gt/commit/8b9b4404b703b552b9aa327dc0ae85fce584c97c)]:
|
|
19
|
+
- generaltranslation@9.0.2
|
|
20
|
+
|
|
3
21
|
## 1.0.5
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/{WritableConditionStore-Y7klxD29.d.mts → WritableConditionStore-8482OsuJ.d.mts}
RENAMED
|
@@ -3,58 +3,8 @@ import { RuntimeTranslateManyOptions } from "generaltranslation/internal";
|
|
|
3
3
|
import { LocaleConfig } from "@generaltranslation/format";
|
|
4
4
|
import { GTRuntime } from "generaltranslation/runtime";
|
|
5
5
|
import { CustomMapping } from "@generaltranslation/format/types";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* TODO: this disagrees with the type in react-core/src/types-dir/config.ts, we need to move this
|
|
9
|
-
* General Config:
|
|
10
|
-
* @param defaultLocale - The default locale to use
|
|
11
|
-
* @param locales - The locales to support
|
|
12
|
-
* @param customMapping - The custom mapping to use (for aliasing locale codes and other properties)
|
|
13
|
-
* @param enableI18n - Whether to enable i18n
|
|
14
|
-
*
|
|
15
|
-
* Remote Store/Cache Config:
|
|
16
|
-
* @param projectId - The project id
|
|
17
|
-
* @param devApiKey - The dev api key
|
|
18
|
-
* @param _versionId - The version id
|
|
19
|
-
* @param _branchId - The branch id
|
|
20
|
-
* @param cacheUrl - The cache url
|
|
21
|
-
* @param runtimeUrl - The runtime url
|
|
22
|
-
* @param timeout - The timeout
|
|
23
|
-
* @param modelProvider - The model provider
|
|
24
|
-
*/
|
|
25
|
-
type GTConfig = {
|
|
26
|
-
defaultLocale?: string;
|
|
27
|
-
locales?: string[];
|
|
28
|
-
customMapping?: CustomMapping;
|
|
29
|
-
enableI18n?: boolean;
|
|
30
|
-
projectId?: string;
|
|
31
|
-
devApiKey?: string;
|
|
32
|
-
apiKey?: string;
|
|
33
|
-
_versionId?: string;
|
|
34
|
-
_branchId?: string;
|
|
35
|
-
cacheUrl?: string | null;
|
|
36
|
-
cacheExpiryTime?: number;
|
|
37
|
-
runtimeUrl?: string | null;
|
|
38
|
-
modelProvider?: string;
|
|
39
|
-
_disableDevHotReload?: boolean;
|
|
40
|
-
files?: {
|
|
41
|
-
gt?: {
|
|
42
|
-
output?: string;
|
|
43
|
-
parsingFlags?: {
|
|
44
|
-
/**
|
|
45
|
-
* Dev hot reload config, gt-react browser runtime only.
|
|
46
|
-
* - `true` enables strings hot reload (jsx handled at runtime via Suspense)
|
|
47
|
-
* - `{ strings?: boolean; jsx?: boolean }` enables selectively
|
|
48
|
-
*/
|
|
49
|
-
devHotReload?: boolean | {
|
|
50
|
-
strings?: boolean;
|
|
51
|
-
jsx?: boolean;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
//#endregion
|
|
6
|
+
import { GTConfig } from "generaltranslation/types";
|
|
7
|
+
|
|
58
8
|
//#region src/i18n-cache/translations-manager/TranslationsCache.d.ts
|
|
59
9
|
type TranslationBatchConfig = {
|
|
60
10
|
maxConcurrentRequests?: number;
|
|
@@ -106,6 +56,7 @@ type I18nCacheConfig = {
|
|
|
106
56
|
devApiKey?: string;
|
|
107
57
|
apiKey?: string;
|
|
108
58
|
runtimeUrl?: string | null;
|
|
59
|
+
modelProvider?: string;
|
|
109
60
|
/**
|
|
110
61
|
* Locale cache TTL in milliseconds. Undefined uses the default TTL, null
|
|
111
62
|
* disables expiry, and a number sets an explicit TTL.
|
|
@@ -235,4 +186,4 @@ declare class WritableConditionStore extends ReadonlyConditionStore implements W
|
|
|
235
186
|
}
|
|
236
187
|
//#endregion
|
|
237
188
|
export { Hash as _, I18nConfig as a, AsyncReadonlyConditionStoreInterface as c, I18nCacheConstructorParams as d, LocaleResolverConfig as f, TranslationsLoader as g, WritableConditionStoreInterface as h, ReadonlyConditionStoreParams as i, DictionaryConfig as l, ScopedConditionStoreInterface as m, WritableConditionStoreParams as n, I18nConfigParams as o, ReadonlyConditionStoreInterface as p, ReadonlyConditionStore as r, LocaleCandidates as s, WritableConditionStore as t, I18nCacheConfig as u, Locale as v, GTConfig as y };
|
|
238
|
-
//# sourceMappingURL=WritableConditionStore-
|
|
189
|
+
//# sourceMappingURL=WritableConditionStore-8482OsuJ.d.mts.map
|
package/dist/{WritableConditionStore-7OwoOSxr.d.cts → WritableConditionStore-DG-jgrei.d.cts}
RENAMED
|
@@ -1,61 +1,10 @@
|
|
|
1
1
|
import { n as Dictionary, t as DictionaryLoader } from "./DictionaryCache-DjAdDNiM.cjs";
|
|
2
2
|
import { CustomMapping } from "@generaltranslation/format/types";
|
|
3
3
|
import { RuntimeTranslateManyOptions } from "generaltranslation/internal";
|
|
4
|
+
import { GTConfig } from "generaltranslation/types";
|
|
4
5
|
import { LocaleConfig } from "@generaltranslation/format";
|
|
5
6
|
import { GTRuntime } from "generaltranslation/runtime";
|
|
6
7
|
|
|
7
|
-
//#region src/config/types.d.ts
|
|
8
|
-
/**
|
|
9
|
-
* TODO: this disagrees with the type in react-core/src/types-dir/config.ts, we need to move this
|
|
10
|
-
* General Config:
|
|
11
|
-
* @param defaultLocale - The default locale to use
|
|
12
|
-
* @param locales - The locales to support
|
|
13
|
-
* @param customMapping - The custom mapping to use (for aliasing locale codes and other properties)
|
|
14
|
-
* @param enableI18n - Whether to enable i18n
|
|
15
|
-
*
|
|
16
|
-
* Remote Store/Cache Config:
|
|
17
|
-
* @param projectId - The project id
|
|
18
|
-
* @param devApiKey - The dev api key
|
|
19
|
-
* @param _versionId - The version id
|
|
20
|
-
* @param _branchId - The branch id
|
|
21
|
-
* @param cacheUrl - The cache url
|
|
22
|
-
* @param runtimeUrl - The runtime url
|
|
23
|
-
* @param timeout - The timeout
|
|
24
|
-
* @param modelProvider - The model provider
|
|
25
|
-
*/
|
|
26
|
-
type GTConfig = {
|
|
27
|
-
defaultLocale?: string;
|
|
28
|
-
locales?: string[];
|
|
29
|
-
customMapping?: CustomMapping;
|
|
30
|
-
enableI18n?: boolean;
|
|
31
|
-
projectId?: string;
|
|
32
|
-
devApiKey?: string;
|
|
33
|
-
apiKey?: string;
|
|
34
|
-
_versionId?: string;
|
|
35
|
-
_branchId?: string;
|
|
36
|
-
cacheUrl?: string | null;
|
|
37
|
-
cacheExpiryTime?: number;
|
|
38
|
-
runtimeUrl?: string | null;
|
|
39
|
-
modelProvider?: string;
|
|
40
|
-
_disableDevHotReload?: boolean;
|
|
41
|
-
files?: {
|
|
42
|
-
gt?: {
|
|
43
|
-
output?: string;
|
|
44
|
-
parsingFlags?: {
|
|
45
|
-
/**
|
|
46
|
-
* Dev hot reload config, gt-react browser runtime only.
|
|
47
|
-
* - `true` enables strings hot reload (jsx handled at runtime via Suspense)
|
|
48
|
-
* - `{ strings?: boolean; jsx?: boolean }` enables selectively
|
|
49
|
-
*/
|
|
50
|
-
devHotReload?: boolean | {
|
|
51
|
-
strings?: boolean;
|
|
52
|
-
jsx?: boolean;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
//#endregion
|
|
59
8
|
//#region src/i18n-cache/translations-manager/TranslationsCache.d.ts
|
|
60
9
|
type TranslationBatchConfig = {
|
|
61
10
|
maxConcurrentRequests?: number;
|
|
@@ -107,6 +56,7 @@ type I18nCacheConfig = {
|
|
|
107
56
|
devApiKey?: string;
|
|
108
57
|
apiKey?: string;
|
|
109
58
|
runtimeUrl?: string | null;
|
|
59
|
+
modelProvider?: string;
|
|
110
60
|
/**
|
|
111
61
|
* Locale cache TTL in milliseconds. Undefined uses the default TTL, null
|
|
112
62
|
* disables expiry, and a number sets an explicit TTL.
|
|
@@ -236,4 +186,4 @@ declare class WritableConditionStore extends ReadonlyConditionStore implements W
|
|
|
236
186
|
}
|
|
237
187
|
//#endregion
|
|
238
188
|
export { Hash as _, I18nConfig as a, AsyncReadonlyConditionStoreInterface as c, I18nCacheConstructorParams as d, LocaleResolverConfig as f, TranslationsLoader as g, WritableConditionStoreInterface as h, ReadonlyConditionStoreParams as i, DictionaryConfig as l, ScopedConditionStoreInterface as m, WritableConditionStoreParams as n, I18nConfigParams as o, ReadonlyConditionStoreInterface as p, ReadonlyConditionStore as r, LocaleCandidates as s, WritableConditionStore as t, I18nCacheConfig as u, Locale as v, GTConfig as y };
|
|
239
|
-
//# sourceMappingURL=WritableConditionStore-
|
|
189
|
+
//# sourceMappingURL=WritableConditionStore-DG-jgrei.d.cts.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_versionId = require("./versionId-
|
|
2
|
+
const require_versionId = require("./versionId-D617MMZw.cjs");
|
|
3
3
|
let generaltranslation_internal = require("generaltranslation/internal");
|
|
4
4
|
let _generaltranslation_format = require("@generaltranslation/format");
|
|
5
5
|
let generaltranslation = require("generaltranslation");
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as logger_default, S as extractVariables, _ as resolveStringContentWithFallback, a as getDefaultLocale, b as interpolateIcuMessage, c as getLocales, d as getWritableConditionStore, g as resolveStringContent, i as hashMessage, l as getRegion, n as isEncodedTranslationOptions, o as getLocale, r as decodeOptions, s as getLocaleProperties, t as getVersionId, u as resolveCanonicalLocale, x as createInterpolationFailureMessage } from "./versionId-
|
|
1
|
+
import { D as logger_default, S as extractVariables, _ as resolveStringContentWithFallback, a as getDefaultLocale, b as interpolateIcuMessage, c as getLocales, d as getWritableConditionStore, g as resolveStringContent, i as hashMessage, l as getRegion, n as isEncodedTranslationOptions, o as getLocale, r as decodeOptions, s as getLocaleProperties, t as getVersionId, u as resolveCanonicalLocale, x as createInterpolationFailureMessage } from "./versionId-DEb3k2mY.mjs";
|
|
2
2
|
import { VAR_IDENTIFIER, encode, libraryDefaultLocale } from "generaltranslation/internal";
|
|
3
3
|
import { formatMessage } from "@generaltranslation/format";
|
|
4
4
|
import { declareVar, decodeVars, derive } from "generaltranslation";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as JsxTranslationOptions, c as NormalizedLookupOptions, d as TranslationOptions, f as TranslationVariables, i as GTTranslationOptions, l as RuntimeTranslationOptions, n as DictionaryLookupOptions, o as LookupOptions, r as EncodedTranslationOptions, s as LookupOptionsFor, t as DictionaryEntryOptions, u as TranslationMetadata } from "./options-BXeFwN0R.cjs";
|
|
2
|
-
import { _ as Hash, c as AsyncReadonlyConditionStoreInterface, d as I18nCacheConstructorParams, f as LocaleResolverConfig, g as TranslationsLoader, h as WritableConditionStoreInterface, i as ReadonlyConditionStoreParams, l as DictionaryConfig, m as ScopedConditionStoreInterface, n as WritableConditionStoreParams, o as I18nConfigParams, p as ReadonlyConditionStoreInterface, s as LocaleCandidates, u as I18nCacheConfig, v as Locale, y as GTConfig } from "./WritableConditionStore-
|
|
2
|
+
import { _ as Hash, c as AsyncReadonlyConditionStoreInterface, d as I18nCacheConstructorParams, f as LocaleResolverConfig, g as TranslationsLoader, h as WritableConditionStoreInterface, i as ReadonlyConditionStoreParams, l as DictionaryConfig, m as ScopedConditionStoreInterface, n as WritableConditionStoreParams, o as I18nConfigParams, p as ReadonlyConditionStoreInterface, s as LocaleCandidates, u as I18nCacheConfig, v as Locale, y as GTConfig } from "./WritableConditionStore-DG-jgrei.cjs";
|
|
3
3
|
import { a as DictionaryLeaf, c as DictionaryValue, i as DictionaryKey, n as Dictionary, o as DictionaryObject, r as DictionaryEntry, s as DictionaryPath, t as DictionaryLoader } from "./DictionaryCache-DjAdDNiM.cjs";
|
|
4
4
|
export { type AsyncReadonlyConditionStoreInterface, type Dictionary, type DictionaryConfig, type DictionaryEntry, DictionaryEntryOptions, type DictionaryKey, type DictionaryLeaf, type DictionaryLoader, DictionaryLookupOptions, type DictionaryObject, type DictionaryPath, type DictionaryValue, EncodedTranslationOptions, type GTConfig, GTTranslationOptions, type Hash, type I18nCacheConfig, type I18nCacheConstructorParams, type I18nConfigParams, JsxTranslationOptions, type Locale, type LocaleCandidates, type LocaleResolverConfig, LookupOptions, LookupOptionsFor, NormalizedLookupOptions, type ReadonlyConditionStoreInterface, type ReadonlyConditionStoreParams, RuntimeTranslationOptions, type ScopedConditionStoreInterface, TranslationMetadata, TranslationOptions, TranslationVariables, type TranslationsLoader, type WritableConditionStoreInterface, type WritableConditionStoreParams };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as JsxTranslationOptions, c as NormalizedLookupOptions, d as TranslationOptions, f as TranslationVariables, i as GTTranslationOptions, l as RuntimeTranslationOptions, n as DictionaryLookupOptions, o as LookupOptions, r as EncodedTranslationOptions, s as LookupOptionsFor, t as DictionaryEntryOptions, u as TranslationMetadata } from "./options-DDUyXaLT.mjs";
|
|
2
|
-
import { _ as Hash, c as AsyncReadonlyConditionStoreInterface, d as I18nCacheConstructorParams, f as LocaleResolverConfig, g as TranslationsLoader, h as WritableConditionStoreInterface, i as ReadonlyConditionStoreParams, l as DictionaryConfig, m as ScopedConditionStoreInterface, n as WritableConditionStoreParams, o as I18nConfigParams, p as ReadonlyConditionStoreInterface, s as LocaleCandidates, u as I18nCacheConfig, v as Locale, y as GTConfig } from "./WritableConditionStore-
|
|
2
|
+
import { _ as Hash, c as AsyncReadonlyConditionStoreInterface, d as I18nCacheConstructorParams, f as LocaleResolverConfig, g as TranslationsLoader, h as WritableConditionStoreInterface, i as ReadonlyConditionStoreParams, l as DictionaryConfig, m as ScopedConditionStoreInterface, n as WritableConditionStoreParams, o as I18nConfigParams, p as ReadonlyConditionStoreInterface, s as LocaleCandidates, u as I18nCacheConfig, v as Locale, y as GTConfig } from "./WritableConditionStore-8482OsuJ.mjs";
|
|
3
3
|
import { a as DictionaryLeaf, c as DictionaryValue, i as DictionaryKey, n as Dictionary, o as DictionaryObject, r as DictionaryEntry, s as DictionaryPath, t as DictionaryLoader } from "./DictionaryCache-B7oTBs5W.mjs";
|
|
4
4
|
export { type AsyncReadonlyConditionStoreInterface, type Dictionary, type DictionaryConfig, type DictionaryEntry, DictionaryEntryOptions, type DictionaryKey, type DictionaryLeaf, type DictionaryLoader, DictionaryLookupOptions, type DictionaryObject, type DictionaryPath, type DictionaryValue, EncodedTranslationOptions, type GTConfig, GTTranslationOptions, type Hash, type I18nCacheConfig, type I18nCacheConstructorParams, type I18nConfigParams, JsxTranslationOptions, type Locale, type LocaleCandidates, type LocaleResolverConfig, LookupOptions, LookupOptionsFor, NormalizedLookupOptions, type ReadonlyConditionStoreInterface, type ReadonlyConditionStoreParams, RuntimeTranslationOptions, type ScopedConditionStoreInterface, TranslationMetadata, TranslationOptions, TranslationVariables, type TranslationsLoader, type WritableConditionStoreInterface, type WritableConditionStoreParams };
|
package/dist/internal.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_versionId = require("./versionId-
|
|
2
|
+
const require_versionId = require("./versionId-D617MMZw.cjs");
|
|
3
3
|
let generaltranslation_internal = require("generaltranslation/internal");
|
|
4
4
|
let _generaltranslation_format = require("@generaltranslation/format");
|
|
5
5
|
//#region src/translation-functions/internal/getGT.ts
|
|
@@ -851,6 +851,7 @@ var I18nCache = class {
|
|
|
851
851
|
devApiKey: params.devApiKey,
|
|
852
852
|
apiKey: params.apiKey,
|
|
853
853
|
runtimeUrl: params.runtimeUrl,
|
|
854
|
+
modelProvider: params.modelProvider,
|
|
854
855
|
cacheExpiryTime: params.cacheExpiryTime,
|
|
855
856
|
batchConfig: params.batchConfig,
|
|
856
857
|
runtimeTranslation: params.runtimeTranslation,
|
|
@@ -867,7 +868,10 @@ var I18nCache = class {
|
|
|
867
868
|
}
|
|
868
869
|
});
|
|
869
870
|
const loadDictionary = params.loadDictionary ?? (() => Promise.resolve({}));
|
|
870
|
-
this.createTranslateMany = createTranslateManyFactory(require_versionId.getI18nConfig().getGTClass(), this.config.runtimeTranslation?.timeout ?? DEFAULT_TRANSLATION_TIMEOUT,
|
|
871
|
+
this.createTranslateMany = createTranslateManyFactory(require_versionId.getI18nConfig().getGTClass(), this.config.runtimeTranslation?.timeout ?? DEFAULT_TRANSLATION_TIMEOUT, {
|
|
872
|
+
...this.config.modelProvider && { modelProvider: this.config.modelProvider },
|
|
873
|
+
...this.config.runtimeTranslation?.metadata
|
|
874
|
+
});
|
|
871
875
|
const ttl = this.config.cacheExpiryTime;
|
|
872
876
|
this.translations = new ResourceCache({
|
|
873
877
|
ttl,
|