generaltranslation 8.2.7 → 8.2.8
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 +6 -0
- package/dist/id.d.cts +1 -1
- package/dist/id.d.mts +1 -1
- package/dist/index.cjs +191 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -4
- package/dist/index.d.mts +66 -4
- package/dist/index.mjs +191 -55
- package/dist/index.mjs.map +1 -1
- package/dist/{internal-CTeI8uLd.mjs → internal-B3QbyI_5.mjs} +48 -2
- package/dist/internal-B3QbyI_5.mjs.map +1 -0
- package/dist/{internal-PCKq4YMW.cjs → internal-DIHQF9gs.cjs} +59 -1
- package/dist/internal-DIHQF9gs.cjs.map +1 -0
- package/dist/internal.cjs +3 -1
- package/dist/internal.d.cts +23 -2
- package/dist/internal.d.mts +23 -2
- package/dist/internal.mjs +2 -2
- package/dist/{types-D2fTTTvZ.d.cts → types-BJdoI1d1.d.cts} +6 -2
- package/dist/{types-fUW4_Ole.d.mts → types-DazaDJbs.d.mts} +6 -2
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +1 -1
- package/dist/internal-CTeI8uLd.mjs.map +0 -1
- package/dist/internal-PCKq4YMW.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as FileReference, A as BranchDataResult, B as FileUpload, C as ProcessMovesOptions, D as FileDataQuery, Dt as StringFormat, F as DownloadFileOptions, H as UploadFilesResponse, I as PublishFileEntry, J as DownloadFileBatchOptions, L as PublishFilesResult, M as TranslationError, Mt as CustomMapping, N as TranslationResult, O as FileDataResult, T as GetOrphanedFilesResult, U as CreateTagOptions, V as UploadFilesOptions, W as CreateTagResult, X as DownloadFileBatchResult, Y as DownloadFileBatchRequest, _ as AwaitJobsResult, at as CheckFileTranslationsOptions, et as FileReferenceIds, g as AwaitJobsOptions, h as SubmitUserEditDiffsPayload, j as TranslateManyResult, jt as LocaleProperties, k as BranchQuery, mt as TranslateOptions, n as FormatVariables, ot as FileQuery, pt as TranslateManyEntry, rt as EnqueueFilesResult, st as FileQueryResult, w as ProcessMovesResponse, x as MoveMapping, y as CheckJobStatusResult } from "./types-
|
|
1
|
+
import { $ as FileReference, A as BranchDataResult, B as FileUpload, C as ProcessMovesOptions, D as FileDataQuery, Dt as StringFormat, F as DownloadFileOptions, H as UploadFilesResponse, I as PublishFileEntry, J as DownloadFileBatchOptions, L as PublishFilesResult, M as TranslationError, Mt as CustomMapping, N as TranslationResult, O as FileDataResult, T as GetOrphanedFilesResult, U as CreateTagOptions, V as UploadFilesOptions, W as CreateTagResult, X as DownloadFileBatchResult, Y as DownloadFileBatchRequest, _ as AwaitJobsResult, at as CheckFileTranslationsOptions, et as FileReferenceIds, g as AwaitJobsOptions, h as SubmitUserEditDiffsPayload, j as TranslateManyResult, jt as LocaleProperties, k as BranchQuery, mt as TranslateOptions, n as FormatVariables, ot as FileQuery, pt as TranslateManyEntry, rt as EnqueueFilesResult, st as FileQueryResult, w as ProcessMovesResponse, x as MoveMapping, y as CheckJobStatusResult } from "./types-BJdoI1d1.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/translate/setupProject.d.ts
|
|
4
4
|
type SetupProjectResult = {
|
|
@@ -71,6 +71,66 @@ interface CutoffFormatOptions extends TerminatorOptions {
|
|
|
71
71
|
style?: CutoffFormatStyle;
|
|
72
72
|
}
|
|
73
73
|
//#endregion
|
|
74
|
+
//#region src/LocaleConfig.d.ts
|
|
75
|
+
type LocaleConfigConstructorParams = {
|
|
76
|
+
defaultLocale?: string;
|
|
77
|
+
locales?: string[];
|
|
78
|
+
customMapping?: CustomMapping;
|
|
79
|
+
};
|
|
80
|
+
type LocalesOption = {
|
|
81
|
+
locales?: string | string[];
|
|
82
|
+
};
|
|
83
|
+
type WithLocales<T = object> = T & LocalesOption;
|
|
84
|
+
/**
|
|
85
|
+
* LocaleConfig is a client-safe locale and formatting helper.
|
|
86
|
+
*
|
|
87
|
+
* It intentionally does not store project IDs, API keys, runtime URLs, or any
|
|
88
|
+
* translation credentials. It only stores locale metadata needed to resolve
|
|
89
|
+
* aliases, choose formatting fallbacks, and format values with Intl.
|
|
90
|
+
*/
|
|
91
|
+
declare class LocaleConfig {
|
|
92
|
+
readonly defaultLocale: string;
|
|
93
|
+
readonly locales: string[];
|
|
94
|
+
readonly customMapping?: CustomMapping;
|
|
95
|
+
constructor({
|
|
96
|
+
defaultLocale,
|
|
97
|
+
locales,
|
|
98
|
+
customMapping
|
|
99
|
+
}?: LocaleConfigConstructorParams);
|
|
100
|
+
private get translationLocales();
|
|
101
|
+
private resolveCanonicalLocaleList;
|
|
102
|
+
private resolveCanonicalLocaleArgs;
|
|
103
|
+
private toLocaleList;
|
|
104
|
+
private getFormattingLocales;
|
|
105
|
+
formatNum(value: number, targetLocale?: string, options?: WithLocales<Intl.NumberFormatOptions>): string;
|
|
106
|
+
formatDateTime(value: Date, targetLocale?: string, options?: WithLocales<Intl.DateTimeFormatOptions>): string;
|
|
107
|
+
formatCurrency(value: number, currency: string, targetLocale?: string, options?: WithLocales<Intl.NumberFormatOptions>): string;
|
|
108
|
+
formatRelativeTime(value: number, unit: Intl.RelativeTimeFormatUnit, targetLocale?: string, options?: WithLocales<Intl.RelativeTimeFormatOptions>): string;
|
|
109
|
+
formatRelativeTimeFromDate(date: Date, targetLocale?: string, options?: WithLocales<Intl.RelativeTimeFormatOptions & {
|
|
110
|
+
baseDate?: Date;
|
|
111
|
+
}>): string;
|
|
112
|
+
formatCutoff(value: string, targetLocale?: string, options?: WithLocales<CutoffFormatOptions>): string;
|
|
113
|
+
formatMessage(message: string, targetLocale?: string, options?: WithLocales<{
|
|
114
|
+
variables?: FormatVariables;
|
|
115
|
+
dataFormat?: StringFormat;
|
|
116
|
+
}>): string;
|
|
117
|
+
formatList(array: Array<string | number>, targetLocale?: string, options?: WithLocales<Intl.ListFormatOptions>): string;
|
|
118
|
+
formatListToParts<T>(array: Array<T>, targetLocale?: string, options?: WithLocales<Intl.ListFormatOptions>): (string | T)[];
|
|
119
|
+
getLocaleName(locale: string): string;
|
|
120
|
+
getLocaleEmoji(locale: string): string;
|
|
121
|
+
getLocaleProperties(locale: string): LocaleProperties;
|
|
122
|
+
requiresTranslation(targetLocale: string, sourceLocale?: string, approvedLocales?: string[] | undefined): boolean;
|
|
123
|
+
determineLocale(locales: string | string[], approvedLocales?: string[]): string | undefined;
|
|
124
|
+
getLocaleDirection(locale: string): "ltr" | "rtl";
|
|
125
|
+
isValidLocale(locale: string): boolean;
|
|
126
|
+
resolveCanonicalLocale(locale: string): string;
|
|
127
|
+
resolveAliasLocale(locale: string): string;
|
|
128
|
+
standardizeLocale(locale: string): string;
|
|
129
|
+
isSameDialect(...locales: (string | string[])[]): boolean;
|
|
130
|
+
isSameLanguage(...locales: (string | string[])[]): boolean;
|
|
131
|
+
isSupersetLocale(superLocale: string, subLocale: string): boolean;
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
74
134
|
//#region src/index.d.ts
|
|
75
135
|
/**
|
|
76
136
|
* Type representing the constructor parameters for the GT class.
|
|
@@ -123,14 +183,16 @@ declare class GT {
|
|
|
123
183
|
targetLocale?: string;
|
|
124
184
|
/** Array of supported locales */
|
|
125
185
|
locales?: string[];
|
|
126
|
-
/** Array of locales used for rendering variables */
|
|
127
|
-
_renderingLocales: string[];
|
|
128
186
|
/** Custom mapping for locale codes to their names */
|
|
129
187
|
customMapping?: CustomMapping;
|
|
130
188
|
/** Lazily derived reverse custom mapping for alias locales */
|
|
131
189
|
reverseCustomMapping?: Record<string, string>;
|
|
132
190
|
/** Lazily derived custom mapping for regions */
|
|
133
191
|
customRegionMapping?: CustomRegionMapping;
|
|
192
|
+
/** Client-safe locale and formatting helpers (backing field) */
|
|
193
|
+
private _localeConfig;
|
|
194
|
+
/** Client-safe locale and formatting helpers */
|
|
195
|
+
get localeConfig(): LocaleConfig;
|
|
134
196
|
/**
|
|
135
197
|
* Constructs an instance of the GT class.
|
|
136
198
|
*
|
|
@@ -1153,5 +1215,5 @@ declare function isSameLanguage(...locales: (string | string[])[]): boolean;
|
|
|
1153
1215
|
declare function isSupersetLocale(superLocale: string, subLocale: string): boolean;
|
|
1154
1216
|
declare const API_VERSION = "2026-03-06.v1";
|
|
1155
1217
|
//#endregion
|
|
1156
|
-
export { API_VERSION, GT, determineLocale, formatCurrency, formatCutoff, formatDateTime, formatList, formatListToParts, formatMessage, formatNum, formatRelativeTime, formatRelativeTimeFromDate, getLocaleDirection, getLocaleEmoji, getLocaleName, getLocaleProperties, getRegionProperties, isSameDialect, isSameLanguage, isSupersetLocale, isValidLocale, requiresTranslation, resolveAliasLocale, resolveCanonicalLocale, standardizeLocale };
|
|
1218
|
+
export { API_VERSION, GT, LocaleConfig, type LocaleConfigConstructorParams, determineLocale, formatCurrency, formatCutoff, formatDateTime, formatList, formatListToParts, formatMessage, formatNum, formatRelativeTime, formatRelativeTimeFromDate, getLocaleDirection, getLocaleEmoji, getLocaleName, getLocaleProperties, getRegionProperties, isSameDialect, isSameLanguage, isSupersetLocale, isValidLocale, requiresTranslation, resolveAliasLocale, resolveCanonicalLocale, standardizeLocale };
|
|
1157
1219
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as FileReference, A as BranchDataResult, B as FileUpload, C as ProcessMovesOptions, D as FileDataQuery, Dt as StringFormat, F as DownloadFileOptions, H as UploadFilesResponse, I as PublishFileEntry, J as DownloadFileBatchOptions, L as PublishFilesResult, M as TranslationError, Mt as CustomMapping, N as TranslationResult, O as FileDataResult, T as GetOrphanedFilesResult, U as CreateTagOptions, V as UploadFilesOptions, W as CreateTagResult, X as DownloadFileBatchResult, Y as DownloadFileBatchRequest, _ as AwaitJobsResult, at as CheckFileTranslationsOptions, et as FileReferenceIds, g as AwaitJobsOptions, h as SubmitUserEditDiffsPayload, j as TranslateManyResult, jt as LocaleProperties, k as BranchQuery, mt as TranslateOptions, n as FormatVariables, ot as FileQuery, pt as TranslateManyEntry, rt as EnqueueFilesResult, st as FileQueryResult, w as ProcessMovesResponse, x as MoveMapping, y as CheckJobStatusResult } from "./types-
|
|
1
|
+
import { $ as FileReference, A as BranchDataResult, B as FileUpload, C as ProcessMovesOptions, D as FileDataQuery, Dt as StringFormat, F as DownloadFileOptions, H as UploadFilesResponse, I as PublishFileEntry, J as DownloadFileBatchOptions, L as PublishFilesResult, M as TranslationError, Mt as CustomMapping, N as TranslationResult, O as FileDataResult, T as GetOrphanedFilesResult, U as CreateTagOptions, V as UploadFilesOptions, W as CreateTagResult, X as DownloadFileBatchResult, Y as DownloadFileBatchRequest, _ as AwaitJobsResult, at as CheckFileTranslationsOptions, et as FileReferenceIds, g as AwaitJobsOptions, h as SubmitUserEditDiffsPayload, j as TranslateManyResult, jt as LocaleProperties, k as BranchQuery, mt as TranslateOptions, n as FormatVariables, ot as FileQuery, pt as TranslateManyEntry, rt as EnqueueFilesResult, st as FileQueryResult, w as ProcessMovesResponse, x as MoveMapping, y as CheckJobStatusResult } from "./types-DazaDJbs.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/translate/setupProject.d.ts
|
|
4
4
|
type SetupProjectResult = {
|
|
@@ -71,6 +71,66 @@ interface CutoffFormatOptions extends TerminatorOptions {
|
|
|
71
71
|
style?: CutoffFormatStyle;
|
|
72
72
|
}
|
|
73
73
|
//#endregion
|
|
74
|
+
//#region src/LocaleConfig.d.ts
|
|
75
|
+
type LocaleConfigConstructorParams = {
|
|
76
|
+
defaultLocale?: string;
|
|
77
|
+
locales?: string[];
|
|
78
|
+
customMapping?: CustomMapping;
|
|
79
|
+
};
|
|
80
|
+
type LocalesOption = {
|
|
81
|
+
locales?: string | string[];
|
|
82
|
+
};
|
|
83
|
+
type WithLocales<T = object> = T & LocalesOption;
|
|
84
|
+
/**
|
|
85
|
+
* LocaleConfig is a client-safe locale and formatting helper.
|
|
86
|
+
*
|
|
87
|
+
* It intentionally does not store project IDs, API keys, runtime URLs, or any
|
|
88
|
+
* translation credentials. It only stores locale metadata needed to resolve
|
|
89
|
+
* aliases, choose formatting fallbacks, and format values with Intl.
|
|
90
|
+
*/
|
|
91
|
+
declare class LocaleConfig {
|
|
92
|
+
readonly defaultLocale: string;
|
|
93
|
+
readonly locales: string[];
|
|
94
|
+
readonly customMapping?: CustomMapping;
|
|
95
|
+
constructor({
|
|
96
|
+
defaultLocale,
|
|
97
|
+
locales,
|
|
98
|
+
customMapping
|
|
99
|
+
}?: LocaleConfigConstructorParams);
|
|
100
|
+
private get translationLocales();
|
|
101
|
+
private resolveCanonicalLocaleList;
|
|
102
|
+
private resolveCanonicalLocaleArgs;
|
|
103
|
+
private toLocaleList;
|
|
104
|
+
private getFormattingLocales;
|
|
105
|
+
formatNum(value: number, targetLocale?: string, options?: WithLocales<Intl.NumberFormatOptions>): string;
|
|
106
|
+
formatDateTime(value: Date, targetLocale?: string, options?: WithLocales<Intl.DateTimeFormatOptions>): string;
|
|
107
|
+
formatCurrency(value: number, currency: string, targetLocale?: string, options?: WithLocales<Intl.NumberFormatOptions>): string;
|
|
108
|
+
formatRelativeTime(value: number, unit: Intl.RelativeTimeFormatUnit, targetLocale?: string, options?: WithLocales<Intl.RelativeTimeFormatOptions>): string;
|
|
109
|
+
formatRelativeTimeFromDate(date: Date, targetLocale?: string, options?: WithLocales<Intl.RelativeTimeFormatOptions & {
|
|
110
|
+
baseDate?: Date;
|
|
111
|
+
}>): string;
|
|
112
|
+
formatCutoff(value: string, targetLocale?: string, options?: WithLocales<CutoffFormatOptions>): string;
|
|
113
|
+
formatMessage(message: string, targetLocale?: string, options?: WithLocales<{
|
|
114
|
+
variables?: FormatVariables;
|
|
115
|
+
dataFormat?: StringFormat;
|
|
116
|
+
}>): string;
|
|
117
|
+
formatList(array: Array<string | number>, targetLocale?: string, options?: WithLocales<Intl.ListFormatOptions>): string;
|
|
118
|
+
formatListToParts<T>(array: Array<T>, targetLocale?: string, options?: WithLocales<Intl.ListFormatOptions>): (string | T)[];
|
|
119
|
+
getLocaleName(locale: string): string;
|
|
120
|
+
getLocaleEmoji(locale: string): string;
|
|
121
|
+
getLocaleProperties(locale: string): LocaleProperties;
|
|
122
|
+
requiresTranslation(targetLocale: string, sourceLocale?: string, approvedLocales?: string[] | undefined): boolean;
|
|
123
|
+
determineLocale(locales: string | string[], approvedLocales?: string[]): string | undefined;
|
|
124
|
+
getLocaleDirection(locale: string): "ltr" | "rtl";
|
|
125
|
+
isValidLocale(locale: string): boolean;
|
|
126
|
+
resolveCanonicalLocale(locale: string): string;
|
|
127
|
+
resolveAliasLocale(locale: string): string;
|
|
128
|
+
standardizeLocale(locale: string): string;
|
|
129
|
+
isSameDialect(...locales: (string | string[])[]): boolean;
|
|
130
|
+
isSameLanguage(...locales: (string | string[])[]): boolean;
|
|
131
|
+
isSupersetLocale(superLocale: string, subLocale: string): boolean;
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
74
134
|
//#region src/index.d.ts
|
|
75
135
|
/**
|
|
76
136
|
* Type representing the constructor parameters for the GT class.
|
|
@@ -123,14 +183,16 @@ declare class GT {
|
|
|
123
183
|
targetLocale?: string;
|
|
124
184
|
/** Array of supported locales */
|
|
125
185
|
locales?: string[];
|
|
126
|
-
/** Array of locales used for rendering variables */
|
|
127
|
-
_renderingLocales: string[];
|
|
128
186
|
/** Custom mapping for locale codes to their names */
|
|
129
187
|
customMapping?: CustomMapping;
|
|
130
188
|
/** Lazily derived reverse custom mapping for alias locales */
|
|
131
189
|
reverseCustomMapping?: Record<string, string>;
|
|
132
190
|
/** Lazily derived custom mapping for regions */
|
|
133
191
|
customRegionMapping?: CustomRegionMapping;
|
|
192
|
+
/** Client-safe locale and formatting helpers (backing field) */
|
|
193
|
+
private _localeConfig;
|
|
194
|
+
/** Client-safe locale and formatting helpers */
|
|
195
|
+
get localeConfig(): LocaleConfig;
|
|
134
196
|
/**
|
|
135
197
|
* Constructs an instance of the GT class.
|
|
136
198
|
*
|
|
@@ -1153,5 +1215,5 @@ declare function isSameLanguage(...locales: (string | string[])[]): boolean;
|
|
|
1153
1215
|
declare function isSupersetLocale(superLocale: string, subLocale: string): boolean;
|
|
1154
1216
|
declare const API_VERSION = "2026-03-06.v1";
|
|
1155
1217
|
//#endregion
|
|
1156
|
-
export { API_VERSION, GT, determineLocale, formatCurrency, formatCutoff, formatDateTime, formatList, formatListToParts, formatMessage, formatNum, formatRelativeTime, formatRelativeTimeFromDate, getLocaleDirection, getLocaleEmoji, getLocaleName, getLocaleProperties, getRegionProperties, isSameDialect, isSameLanguage, isSupersetLocale, isValidLocale, requiresTranslation, resolveAliasLocale, resolveCanonicalLocale, standardizeLocale };
|
|
1218
|
+
export { API_VERSION, GT, LocaleConfig, type LocaleConfigConstructorParams, determineLocale, formatCurrency, formatCutoff, formatDateTime, formatList, formatListToParts, formatMessage, formatNum, formatRelativeTime, formatRelativeTimeFromDate, getLocaleDirection, getLocaleEmoji, getLocaleName, getLocaleProperties, getRegionProperties, isSameDialect, isSameLanguage, isSupersetLocale, isValidLocale, requiresTranslation, resolveAliasLocale, resolveCanonicalLocale, standardizeLocale };
|
|
1157
1219
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { B as intlCache, M as encode, V as defaultTimeout, j as decode, k as validateFileFormatTransforms } from "./internal-B3QbyI_5.mjs";
|
|
2
2
|
import { t as ApiError } from "./ApiError-Bv7vlzyQ.mjs";
|
|
3
3
|
import { n as hashSource } from "./id-CPbVYREY.mjs";
|
|
4
4
|
import IntlMessageFormat from "intl-messageformat";
|
|
@@ -1445,6 +1445,7 @@ async function processBatches(items, processor, options = {}) {
|
|
|
1445
1445
|
* @returns The result of the API call
|
|
1446
1446
|
*/
|
|
1447
1447
|
async function _enqueueFiles(files, options, config) {
|
|
1448
|
+
validateFileFormatTransforms(files);
|
|
1448
1449
|
const result = await processBatches(files, async (batch) => {
|
|
1449
1450
|
const apiResult = await apiRequest(config, "/v2/project/translations/enqueue", {
|
|
1450
1451
|
body: {
|
|
@@ -1452,7 +1453,8 @@ async function _enqueueFiles(files, options, config) {
|
|
|
1452
1453
|
branchId: f.branchId,
|
|
1453
1454
|
fileId: f.fileId,
|
|
1454
1455
|
versionId: f.versionId,
|
|
1455
|
-
fileName: f.fileName
|
|
1456
|
+
fileName: f.fileName,
|
|
1457
|
+
transformFormat: f.transformFormat
|
|
1456
1458
|
})),
|
|
1457
1459
|
targetLocales: options.targetLocales,
|
|
1458
1460
|
sourceLocale: options.sourceLocale,
|
|
@@ -1647,6 +1649,7 @@ async function _uploadSourceFiles(files, options, config) {
|
|
|
1647
1649
|
* @returns Promise resolving to a BatchList with all uploaded files
|
|
1648
1650
|
*/
|
|
1649
1651
|
async function _uploadTranslations(files, options, config) {
|
|
1652
|
+
validateFileFormatTransforms(files.map(({ source }) => source));
|
|
1650
1653
|
return processBatches(files, async (batch) => {
|
|
1651
1654
|
return (await apiRequest(config, "/v2/project/files/upload-translations", {
|
|
1652
1655
|
body: {
|
|
@@ -1655,6 +1658,7 @@ async function _uploadTranslations(files, options, config) {
|
|
|
1655
1658
|
content: encode(source.content),
|
|
1656
1659
|
fileName: source.fileName,
|
|
1657
1660
|
fileFormat: source.fileFormat,
|
|
1661
|
+
transformFormat: source.transformFormat,
|
|
1658
1662
|
locale: source.locale,
|
|
1659
1663
|
dataFormat: source.dataFormat,
|
|
1660
1664
|
formatMetadata: source.formatMetadata,
|
|
@@ -1929,6 +1933,158 @@ async function _publishFiles(files, config) {
|
|
|
1929
1933
|
return await apiRequest(config, "/v2/project/files/publish", { body: { files } });
|
|
1930
1934
|
}
|
|
1931
1935
|
//#endregion
|
|
1936
|
+
//#region src/LocaleConfig.ts
|
|
1937
|
+
/**
|
|
1938
|
+
* LocaleConfig is a client-safe locale and formatting helper.
|
|
1939
|
+
*
|
|
1940
|
+
* It intentionally does not store project IDs, API keys, runtime URLs, or any
|
|
1941
|
+
* translation credentials. It only stores locale metadata needed to resolve
|
|
1942
|
+
* aliases, choose formatting fallbacks, and format values with Intl.
|
|
1943
|
+
*/
|
|
1944
|
+
var LocaleConfig = class {
|
|
1945
|
+
constructor({ defaultLocale = "en", locales = [], customMapping } = {}) {
|
|
1946
|
+
this.defaultLocale = defaultLocale;
|
|
1947
|
+
this.locales = locales;
|
|
1948
|
+
this.customMapping = customMapping;
|
|
1949
|
+
}
|
|
1950
|
+
get translationLocales() {
|
|
1951
|
+
return this.locales.length ? this.locales : void 0;
|
|
1952
|
+
}
|
|
1953
|
+
resolveCanonicalLocaleList(locales) {
|
|
1954
|
+
return locales.map((locale) => this.resolveCanonicalLocale(locale));
|
|
1955
|
+
}
|
|
1956
|
+
resolveCanonicalLocaleArgs(locales) {
|
|
1957
|
+
return locales.map((locale) => Array.isArray(locale) ? this.resolveCanonicalLocaleList(locale) : this.resolveCanonicalLocale(locale));
|
|
1958
|
+
}
|
|
1959
|
+
toLocaleList(locales) {
|
|
1960
|
+
return Array.isArray(locales) ? locales : [locales];
|
|
1961
|
+
}
|
|
1962
|
+
getFormattingLocales(targetLocale, locales) {
|
|
1963
|
+
return (locales !== void 0 ? this.toLocaleList(locales) : [
|
|
1964
|
+
targetLocale,
|
|
1965
|
+
this.defaultLocale,
|
|
1966
|
+
"en"
|
|
1967
|
+
]).filter((locale) => !!locale).map((locale) => this.resolveCanonicalLocale(locale));
|
|
1968
|
+
}
|
|
1969
|
+
formatNum(value, targetLocale, options = {}) {
|
|
1970
|
+
const { locales, ...intlOptions } = options;
|
|
1971
|
+
return _formatNum({
|
|
1972
|
+
value,
|
|
1973
|
+
locales: this.getFormattingLocales(targetLocale, locales),
|
|
1974
|
+
options: intlOptions
|
|
1975
|
+
});
|
|
1976
|
+
}
|
|
1977
|
+
formatDateTime(value, targetLocale, options = {}) {
|
|
1978
|
+
const { locales, ...intlOptions } = options;
|
|
1979
|
+
return _formatDateTime({
|
|
1980
|
+
value,
|
|
1981
|
+
locales: this.getFormattingLocales(targetLocale, locales),
|
|
1982
|
+
options: intlOptions
|
|
1983
|
+
});
|
|
1984
|
+
}
|
|
1985
|
+
formatCurrency(value, currency, targetLocale, options = {}) {
|
|
1986
|
+
const { locales, ...intlOptions } = options;
|
|
1987
|
+
return _formatCurrency({
|
|
1988
|
+
value,
|
|
1989
|
+
currency,
|
|
1990
|
+
locales: this.getFormattingLocales(targetLocale, locales),
|
|
1991
|
+
options: intlOptions
|
|
1992
|
+
});
|
|
1993
|
+
}
|
|
1994
|
+
formatRelativeTime(value, unit, targetLocale, options = {}) {
|
|
1995
|
+
const { locales, ...intlOptions } = options;
|
|
1996
|
+
return _formatRelativeTime({
|
|
1997
|
+
value,
|
|
1998
|
+
unit,
|
|
1999
|
+
locales: this.getFormattingLocales(targetLocale, locales),
|
|
2000
|
+
options: intlOptions
|
|
2001
|
+
});
|
|
2002
|
+
}
|
|
2003
|
+
formatRelativeTimeFromDate(date, targetLocale, options = {}) {
|
|
2004
|
+
const { locales, baseDate, ...intlOptions } = options;
|
|
2005
|
+
return _formatRelativeTimeFromDate({
|
|
2006
|
+
date,
|
|
2007
|
+
baseDate: baseDate ?? /* @__PURE__ */ new Date(),
|
|
2008
|
+
locales: this.getFormattingLocales(targetLocale, locales),
|
|
2009
|
+
options: intlOptions
|
|
2010
|
+
});
|
|
2011
|
+
}
|
|
2012
|
+
formatCutoff(value, targetLocale, options = {}) {
|
|
2013
|
+
const { locales, ...formatOptions } = options;
|
|
2014
|
+
return _formatCutoff({
|
|
2015
|
+
value,
|
|
2016
|
+
locales: this.getFormattingLocales(targetLocale, locales),
|
|
2017
|
+
options: formatOptions
|
|
2018
|
+
});
|
|
2019
|
+
}
|
|
2020
|
+
formatMessage(message, targetLocale, options = {}) {
|
|
2021
|
+
const { locales, variables, dataFormat } = options;
|
|
2022
|
+
if (dataFormat === "STRING") return _formatMessageString(message);
|
|
2023
|
+
return _formatMessageICU(message, this.getFormattingLocales(targetLocale, locales), variables);
|
|
2024
|
+
}
|
|
2025
|
+
formatList(array, targetLocale, options = {}) {
|
|
2026
|
+
const { locales, ...intlOptions } = options;
|
|
2027
|
+
return _formatList({
|
|
2028
|
+
value: array,
|
|
2029
|
+
locales: this.getFormattingLocales(targetLocale, locales),
|
|
2030
|
+
options: intlOptions
|
|
2031
|
+
});
|
|
2032
|
+
}
|
|
2033
|
+
formatListToParts(array, targetLocale, options = {}) {
|
|
2034
|
+
const { locales, ...intlOptions } = options;
|
|
2035
|
+
return _formatListToParts({
|
|
2036
|
+
value: array,
|
|
2037
|
+
locales: this.getFormattingLocales(targetLocale, locales),
|
|
2038
|
+
options: intlOptions
|
|
2039
|
+
});
|
|
2040
|
+
}
|
|
2041
|
+
getLocaleName(locale) {
|
|
2042
|
+
return _getLocaleName(locale, this.defaultLocale, this.customMapping);
|
|
2043
|
+
}
|
|
2044
|
+
getLocaleEmoji(locale) {
|
|
2045
|
+
return _getLocaleEmoji(locale, this.customMapping);
|
|
2046
|
+
}
|
|
2047
|
+
getLocaleProperties(locale) {
|
|
2048
|
+
return _getLocaleProperties(locale, this.defaultLocale, this.customMapping);
|
|
2049
|
+
}
|
|
2050
|
+
requiresTranslation(targetLocale, sourceLocale = this.defaultLocale, approvedLocales = this.translationLocales) {
|
|
2051
|
+
return _requiresTranslation(this.resolveCanonicalLocale(sourceLocale), this.resolveCanonicalLocale(targetLocale), approvedLocales ? this.resolveCanonicalLocaleList(approvedLocales) : void 0, this.customMapping);
|
|
2052
|
+
}
|
|
2053
|
+
determineLocale(locales, approvedLocales = this.locales) {
|
|
2054
|
+
const approvedLocalePairs = approvedLocales.map((locale) => ({
|
|
2055
|
+
locale,
|
|
2056
|
+
canonicalLocale: this.resolveCanonicalLocale(locale)
|
|
2057
|
+
}));
|
|
2058
|
+
const resolvedLocale = _determineLocale(Array.isArray(locales) ? this.resolveCanonicalLocaleList(locales) : this.resolveCanonicalLocale(locales), approvedLocalePairs.map(({ canonicalLocale }) => canonicalLocale), this.customMapping);
|
|
2059
|
+
if (!resolvedLocale) return void 0;
|
|
2060
|
+
return approvedLocalePairs.find(({ canonicalLocale }) => canonicalLocale === resolvedLocale)?.locale || this.resolveAliasLocale(resolvedLocale);
|
|
2061
|
+
}
|
|
2062
|
+
getLocaleDirection(locale) {
|
|
2063
|
+
return _getLocaleDirection(this.resolveCanonicalLocale(locale));
|
|
2064
|
+
}
|
|
2065
|
+
isValidLocale(locale) {
|
|
2066
|
+
return _isValidLocale(locale, this.customMapping);
|
|
2067
|
+
}
|
|
2068
|
+
resolveCanonicalLocale(locale) {
|
|
2069
|
+
return _resolveCanonicalLocale(locale, this.customMapping);
|
|
2070
|
+
}
|
|
2071
|
+
resolveAliasLocale(locale) {
|
|
2072
|
+
return _resolveAliasLocale(locale, this.customMapping);
|
|
2073
|
+
}
|
|
2074
|
+
standardizeLocale(locale) {
|
|
2075
|
+
return _standardizeLocale(locale);
|
|
2076
|
+
}
|
|
2077
|
+
isSameDialect(...locales) {
|
|
2078
|
+
return _isSameDialect(...this.resolveCanonicalLocaleArgs(locales));
|
|
2079
|
+
}
|
|
2080
|
+
isSameLanguage(...locales) {
|
|
2081
|
+
return _isSameLanguage(...this.resolveCanonicalLocaleArgs(locales));
|
|
2082
|
+
}
|
|
2083
|
+
isSupersetLocale(superLocale, subLocale) {
|
|
2084
|
+
return _isSupersetLocale(this.resolveCanonicalLocale(superLocale), this.resolveCanonicalLocale(subLocale));
|
|
2085
|
+
}
|
|
2086
|
+
};
|
|
2087
|
+
//#endregion
|
|
1932
2088
|
//#region src/index.ts
|
|
1933
2089
|
/**
|
|
1934
2090
|
* GT is the core driver for the General Translation library.
|
|
@@ -1945,6 +2101,10 @@ async function _publishFiles(files, config) {
|
|
|
1945
2101
|
* });
|
|
1946
2102
|
*/
|
|
1947
2103
|
var GT = class {
|
|
2104
|
+
/** Client-safe locale and formatting helpers */
|
|
2105
|
+
get localeConfig() {
|
|
2106
|
+
return this._localeConfig;
|
|
2107
|
+
}
|
|
1948
2108
|
/**
|
|
1949
2109
|
* Constructs an instance of the GT class.
|
|
1950
2110
|
*
|
|
@@ -1961,7 +2121,6 @@ var GT = class {
|
|
|
1961
2121
|
* });
|
|
1962
2122
|
*/
|
|
1963
2123
|
constructor(params = {}) {
|
|
1964
|
-
this._renderingLocales = [];
|
|
1965
2124
|
if (typeof process !== "undefined") {
|
|
1966
2125
|
this.apiKey ||= process.env?.GT_API_KEY;
|
|
1967
2126
|
this.devApiKey ||= process.env?.GT_DEV_API_KEY;
|
|
@@ -1981,10 +2140,6 @@ var GT = class {
|
|
|
1981
2140
|
this.targetLocale = _standardizeLocale(targetLocale);
|
|
1982
2141
|
if (!_isValidLocale(this.targetLocale, customMapping)) throw new Error(invalidLocaleError(this.targetLocale));
|
|
1983
2142
|
}
|
|
1984
|
-
this._renderingLocales = [];
|
|
1985
|
-
if (this.sourceLocale) this._renderingLocales.push(this.sourceLocale);
|
|
1986
|
-
if (this.targetLocale) this._renderingLocales.push(this.targetLocale);
|
|
1987
|
-
this._renderingLocales.push("en");
|
|
1988
2143
|
if (locales) {
|
|
1989
2144
|
const result = [];
|
|
1990
2145
|
const invalidLocales = [];
|
|
@@ -2001,6 +2156,11 @@ var GT = class {
|
|
|
2001
2156
|
this.customMapping = customMapping;
|
|
2002
2157
|
this.reverseCustomMapping = Object.fromEntries(Object.entries(customMapping).filter(([, value]) => value && typeof value === "object" && "code" in value).map(([key, value]) => [value.code, key]));
|
|
2003
2158
|
}
|
|
2159
|
+
this._localeConfig = new LocaleConfig({
|
|
2160
|
+
defaultLocale: this.sourceLocale,
|
|
2161
|
+
locales: this.locales ?? [],
|
|
2162
|
+
customMapping: this.customMapping
|
|
2163
|
+
});
|
|
2004
2164
|
}
|
|
2005
2165
|
_getTranslationConfig() {
|
|
2006
2166
|
return {
|
|
@@ -2497,10 +2657,7 @@ var GT = class {
|
|
|
2497
2657
|
* // Returns: '...ld!'
|
|
2498
2658
|
*/
|
|
2499
2659
|
formatCutoff(value, options) {
|
|
2500
|
-
return formatCutoff(value,
|
|
2501
|
-
locales: this._renderingLocales,
|
|
2502
|
-
...options
|
|
2503
|
-
});
|
|
2660
|
+
return this.localeConfig.formatCutoff(value, this.targetLocale, options);
|
|
2504
2661
|
}
|
|
2505
2662
|
/**
|
|
2506
2663
|
* Formats a message according to the specified locales and options.
|
|
@@ -2519,10 +2676,7 @@ var GT = class {
|
|
|
2519
2676
|
* // Returns: "Bonjour John"
|
|
2520
2677
|
*/
|
|
2521
2678
|
formatMessage(message, options) {
|
|
2522
|
-
return formatMessage(message,
|
|
2523
|
-
locales: this._renderingLocales,
|
|
2524
|
-
...options
|
|
2525
|
-
});
|
|
2679
|
+
return this.localeConfig.formatMessage(message, this.targetLocale, options);
|
|
2526
2680
|
}
|
|
2527
2681
|
/**
|
|
2528
2682
|
* Formats a number according to the specified locales and options.
|
|
@@ -2538,10 +2692,7 @@ var GT = class {
|
|
|
2538
2692
|
* // Returns: "$1,234.56"
|
|
2539
2693
|
*/
|
|
2540
2694
|
formatNum(number, options) {
|
|
2541
|
-
return formatNum(number,
|
|
2542
|
-
locales: this._renderingLocales,
|
|
2543
|
-
...options
|
|
2544
|
-
});
|
|
2695
|
+
return this.localeConfig.formatNum(number, this.targetLocale, options);
|
|
2545
2696
|
}
|
|
2546
2697
|
/**
|
|
2547
2698
|
* Formats a date according to the specified locales and options.
|
|
@@ -2557,10 +2708,7 @@ var GT = class {
|
|
|
2557
2708
|
* // Returns: "Thursday, March 14, 2024 at 2:30:45 PM GMT-7"
|
|
2558
2709
|
*/
|
|
2559
2710
|
formatDateTime(date, options) {
|
|
2560
|
-
return formatDateTime(date,
|
|
2561
|
-
locales: this._renderingLocales,
|
|
2562
|
-
...options
|
|
2563
|
-
});
|
|
2711
|
+
return this.localeConfig.formatDateTime(date, this.targetLocale, options);
|
|
2564
2712
|
}
|
|
2565
2713
|
/**
|
|
2566
2714
|
* Formats a currency value according to the specified locales and options.
|
|
@@ -2577,10 +2725,7 @@ var GT = class {
|
|
|
2577
2725
|
* // Returns: "$1,234.56"
|
|
2578
2726
|
*/
|
|
2579
2727
|
formatCurrency(value, currency, options) {
|
|
2580
|
-
return formatCurrency(value, currency,
|
|
2581
|
-
locales: this._renderingLocales,
|
|
2582
|
-
...options
|
|
2583
|
-
});
|
|
2728
|
+
return this.localeConfig.formatCurrency(value, currency, this.targetLocale, options);
|
|
2584
2729
|
}
|
|
2585
2730
|
/**
|
|
2586
2731
|
* Formats a list of items according to the specified locales and options.
|
|
@@ -2596,11 +2741,7 @@ var GT = class {
|
|
|
2596
2741
|
* // Returns: "apple, banana, and orange"
|
|
2597
2742
|
*/
|
|
2598
2743
|
formatList(array, options) {
|
|
2599
|
-
return
|
|
2600
|
-
value: array,
|
|
2601
|
-
locales: options?.locales || this._renderingLocales,
|
|
2602
|
-
options
|
|
2603
|
-
});
|
|
2744
|
+
return this.localeConfig.formatList(array, this.targetLocale, options);
|
|
2604
2745
|
}
|
|
2605
2746
|
/**
|
|
2606
2747
|
* Formats a list of items according to the specified locales and options.
|
|
@@ -2615,11 +2756,7 @@ var GT = class {
|
|
|
2615
2756
|
* // Returns: ['apple', ', ', 42, ' and ', '{ foo: "bar" }']
|
|
2616
2757
|
*/
|
|
2617
2758
|
formatListToParts(array, options) {
|
|
2618
|
-
return
|
|
2619
|
-
value: array,
|
|
2620
|
-
locales: options?.locales || this._renderingLocales,
|
|
2621
|
-
options
|
|
2622
|
-
});
|
|
2759
|
+
return this.localeConfig.formatListToParts(array, this.targetLocale, options);
|
|
2623
2760
|
}
|
|
2624
2761
|
/**
|
|
2625
2762
|
* Formats a relative time value according to the specified locales and options.
|
|
@@ -2636,10 +2773,7 @@ var GT = class {
|
|
|
2636
2773
|
* // Returns: "yesterday"
|
|
2637
2774
|
*/
|
|
2638
2775
|
formatRelativeTime(value, unit, options) {
|
|
2639
|
-
return formatRelativeTime(value, unit,
|
|
2640
|
-
locales: this._renderingLocales,
|
|
2641
|
-
...options
|
|
2642
|
-
});
|
|
2776
|
+
return this.localeConfig.formatRelativeTime(value, unit, this.targetLocale, options);
|
|
2643
2777
|
}
|
|
2644
2778
|
/**
|
|
2645
2779
|
* Formats a relative time string from a Date, automatically selecting the best unit.
|
|
@@ -2654,10 +2788,7 @@ var GT = class {
|
|
|
2654
2788
|
* // Returns: "1 hour ago"
|
|
2655
2789
|
*/
|
|
2656
2790
|
formatRelativeTimeFromDate(date, options) {
|
|
2657
|
-
return formatRelativeTimeFromDate(date,
|
|
2658
|
-
locales: this._renderingLocales,
|
|
2659
|
-
...options
|
|
2660
|
-
});
|
|
2791
|
+
return this.localeConfig.formatRelativeTimeFromDate(date, this.targetLocale, options);
|
|
2661
2792
|
}
|
|
2662
2793
|
/**
|
|
2663
2794
|
* Retrieves the display name of a locale code using Intl.DisplayNames, returning an empty string if no name is found.
|
|
@@ -2672,7 +2803,7 @@ var GT = class {
|
|
|
2672
2803
|
*/
|
|
2673
2804
|
getLocaleName(locale = this.targetLocale) {
|
|
2674
2805
|
if (!locale) throw new Error(noTargetLocaleProvidedError("getLocaleName"));
|
|
2675
|
-
return
|
|
2806
|
+
return this.localeConfig.getLocaleName(locale);
|
|
2676
2807
|
}
|
|
2677
2808
|
/**
|
|
2678
2809
|
* Retrieves an emoji based on a given locale code.
|
|
@@ -2688,7 +2819,7 @@ var GT = class {
|
|
|
2688
2819
|
*/
|
|
2689
2820
|
getLocaleEmoji(locale = this.targetLocale) {
|
|
2690
2821
|
if (!locale) throw new Error(noTargetLocaleProvidedError("getLocaleEmoji"));
|
|
2691
|
-
return getLocaleEmoji(locale
|
|
2822
|
+
return this.localeConfig.getLocaleEmoji(locale);
|
|
2692
2823
|
}
|
|
2693
2824
|
/**
|
|
2694
2825
|
* Generates linguistic details for a given locale code.
|
|
@@ -2724,7 +2855,7 @@ var GT = class {
|
|
|
2724
2855
|
*/
|
|
2725
2856
|
getLocaleProperties(locale = this.targetLocale) {
|
|
2726
2857
|
if (!locale) throw new Error(noTargetLocaleProvidedError("getLocaleProperties"));
|
|
2727
|
-
return getLocaleProperties(locale
|
|
2858
|
+
return this.localeConfig.getLocaleProperties(locale);
|
|
2728
2859
|
}
|
|
2729
2860
|
/**
|
|
2730
2861
|
* Retrieves multiple properties for a given region code, including:
|
|
@@ -2798,6 +2929,7 @@ var GT = class {
|
|
|
2798
2929
|
requiresTranslation(sourceLocale = this.sourceLocale, targetLocale = this.targetLocale, approvedLocales = this.locales, customMapping = this.customMapping) {
|
|
2799
2930
|
if (!sourceLocale) throw new Error(noSourceLocaleProvidedError("requiresTranslation"));
|
|
2800
2931
|
if (!targetLocale) throw new Error(noTargetLocaleProvidedError("requiresTranslation"));
|
|
2932
|
+
if (customMapping === this.customMapping) return this.localeConfig.requiresTranslation(targetLocale, sourceLocale, approvedLocales);
|
|
2801
2933
|
return _requiresTranslation(sourceLocale, targetLocale, approvedLocales, customMapping);
|
|
2802
2934
|
}
|
|
2803
2935
|
/**
|
|
@@ -2812,6 +2944,7 @@ var GT = class {
|
|
|
2812
2944
|
* // Returns: "fr-FR"
|
|
2813
2945
|
*/
|
|
2814
2946
|
determineLocale(locales, approvedLocales = this.locales || [], customMapping = this.customMapping) {
|
|
2947
|
+
if (customMapping === this.customMapping) return this.localeConfig.determineLocale(locales, approvedLocales ?? []);
|
|
2815
2948
|
return _determineLocale(locales, approvedLocales, customMapping);
|
|
2816
2949
|
}
|
|
2817
2950
|
/**
|
|
@@ -2827,7 +2960,7 @@ var GT = class {
|
|
|
2827
2960
|
*/
|
|
2828
2961
|
getLocaleDirection(locale = this.targetLocale) {
|
|
2829
2962
|
if (!locale) throw new Error(noTargetLocaleProvidedError("getLocaleDirection"));
|
|
2830
|
-
return getLocaleDirection(locale);
|
|
2963
|
+
return this.localeConfig.getLocaleDirection(locale);
|
|
2831
2964
|
}
|
|
2832
2965
|
/**
|
|
2833
2966
|
* Checks if a given BCP 47 locale code is valid.
|
|
@@ -2843,7 +2976,8 @@ var GT = class {
|
|
|
2843
2976
|
*/
|
|
2844
2977
|
isValidLocale(locale = this.targetLocale, customMapping = this.customMapping) {
|
|
2845
2978
|
if (!locale) throw new Error(noTargetLocaleProvidedError("isValidLocale"));
|
|
2846
|
-
return isValidLocale(locale
|
|
2979
|
+
if (customMapping === this.customMapping) return this.localeConfig.isValidLocale(locale);
|
|
2980
|
+
return _isValidLocale(locale, customMapping);
|
|
2847
2981
|
}
|
|
2848
2982
|
/**
|
|
2849
2983
|
* Resolves the canonical locale for a given locale.
|
|
@@ -2853,6 +2987,7 @@ var GT = class {
|
|
|
2853
2987
|
*/
|
|
2854
2988
|
resolveCanonicalLocale(locale = this.targetLocale, customMapping = this.customMapping) {
|
|
2855
2989
|
if (!locale) throw new Error(noTargetLocaleProvidedError("resolveCanonicalLocale"));
|
|
2990
|
+
if (customMapping === this.customMapping) return this.localeConfig.resolveCanonicalLocale(locale);
|
|
2856
2991
|
return _resolveCanonicalLocale(locale, customMapping);
|
|
2857
2992
|
}
|
|
2858
2993
|
/**
|
|
@@ -2863,6 +2998,7 @@ var GT = class {
|
|
|
2863
2998
|
*/
|
|
2864
2999
|
resolveAliasLocale(locale, customMapping = this.customMapping) {
|
|
2865
3000
|
if (!locale) throw new Error(noTargetLocaleProvidedError("resolveAliasLocale"));
|
|
3001
|
+
if (customMapping === this.customMapping) return this.localeConfig.resolveAliasLocale(locale);
|
|
2866
3002
|
return _resolveAliasLocale(locale, customMapping);
|
|
2867
3003
|
}
|
|
2868
3004
|
/**
|
|
@@ -2878,7 +3014,7 @@ var GT = class {
|
|
|
2878
3014
|
*/
|
|
2879
3015
|
standardizeLocale(locale = this.targetLocale) {
|
|
2880
3016
|
if (!locale) throw new Error(noTargetLocaleProvidedError("standardizeLocale"));
|
|
2881
|
-
return
|
|
3017
|
+
return this.localeConfig.standardizeLocale(locale);
|
|
2882
3018
|
}
|
|
2883
3019
|
/**
|
|
2884
3020
|
* Checks if multiple BCP 47 locale codes represent the same dialect.
|
|
@@ -2894,7 +3030,7 @@ var GT = class {
|
|
|
2894
3030
|
* // Returns: true
|
|
2895
3031
|
*/
|
|
2896
3032
|
isSameDialect(...locales) {
|
|
2897
|
-
return isSameDialect(...locales);
|
|
3033
|
+
return this.localeConfig.isSameDialect(...locales);
|
|
2898
3034
|
}
|
|
2899
3035
|
/**
|
|
2900
3036
|
* Checks if multiple BCP 47 locale codes represent the same language.
|
|
@@ -2907,7 +3043,7 @@ var GT = class {
|
|
|
2907
3043
|
* // Returns: true
|
|
2908
3044
|
*/
|
|
2909
3045
|
isSameLanguage(...locales) {
|
|
2910
|
-
return
|
|
3046
|
+
return this.localeConfig.isSameLanguage(...locales);
|
|
2911
3047
|
}
|
|
2912
3048
|
/**
|
|
2913
3049
|
* Checks if a locale is a superset of another locale.
|
|
@@ -2924,7 +3060,7 @@ var GT = class {
|
|
|
2924
3060
|
* // Returns: false
|
|
2925
3061
|
*/
|
|
2926
3062
|
isSupersetLocale(superLocale, subLocale) {
|
|
2927
|
-
return isSupersetLocale(superLocale, subLocale);
|
|
3063
|
+
return this.localeConfig.isSupersetLocale(superLocale, subLocale);
|
|
2928
3064
|
}
|
|
2929
3065
|
};
|
|
2930
3066
|
/**
|
|
@@ -3300,6 +3436,6 @@ function isSupersetLocale(superLocale, subLocale) {
|
|
|
3300
3436
|
}
|
|
3301
3437
|
const API_VERSION = API_VERSION$1;
|
|
3302
3438
|
//#endregion
|
|
3303
|
-
export { API_VERSION, GT, determineLocale, formatCurrency, formatCutoff, formatDateTime, formatList, formatListToParts, formatMessage, formatNum, formatRelativeTime, formatRelativeTimeFromDate, getLocaleDirection, getLocaleEmoji, getLocaleName, getLocaleProperties, getRegionProperties, isSameDialect, isSameLanguage, isSupersetLocale, isValidLocale, requiresTranslation, resolveAliasLocale, resolveCanonicalLocale, standardizeLocale };
|
|
3439
|
+
export { API_VERSION, GT, LocaleConfig, determineLocale, formatCurrency, formatCutoff, formatDateTime, formatList, formatListToParts, formatMessage, formatNum, formatRelativeTime, formatRelativeTimeFromDate, getLocaleDirection, getLocaleEmoji, getLocaleName, getLocaleProperties, getRegionProperties, isSameDialect, isSameLanguage, isSupersetLocale, isValidLocale, requiresTranslation, resolveAliasLocale, resolveCanonicalLocale, standardizeLocale };
|
|
3304
3440
|
|
|
3305
3441
|
//# sourceMappingURL=index.mjs.map
|