generaltranslation 8.2.13 → 8.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/{ApiError-IYfaOR30.mjs → ApiError-0DxxIHLp.mjs} +1 -1
- package/dist/{ApiError-CZ45tkW6.cjs.map → ApiError-0DxxIHLp.mjs.map} +1 -1
- package/dist/{ApiError-CZ45tkW6.cjs → ApiError-D-IBuHj6.cjs} +1 -1
- package/dist/{ApiError-IYfaOR30.mjs.map → ApiError-D-IBuHj6.cjs.map} +1 -1
- package/dist/LocaleConfig.d.ts +1 -59
- package/dist/LocaleConfig.js +1 -225
- package/dist/{base64-2fu94Klt.cjs → base64-C6BHySOc.cjs} +17 -1
- package/dist/base64-C6BHySOc.cjs.map +1 -0
- package/dist/{base64-DH0STixb.mjs → base64-CWITCfhU.mjs} +6 -2
- package/dist/base64-CWITCfhU.mjs.map +1 -0
- package/dist/core.cjs +9 -8
- package/dist/core.d.cts +1 -2
- package/dist/core.d.mts +1 -2
- package/dist/core.d.ts +1 -128
- package/dist/core.js +1 -137
- package/dist/core.mjs +2 -2
- package/dist/derive/indexVars.d.ts +1 -1
- package/dist/errors.cjs +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/id/types.d.ts +1 -1
- package/dist/{id-CyiXsQrY.cjs → id-C2orn1MA.cjs} +2 -2
- package/dist/{id-CyiXsQrY.cjs.map → id-C2orn1MA.cjs.map} +1 -1
- package/dist/{id-DbD7K-HL.mjs → id-DEaFhGqX.mjs} +2 -2
- package/dist/{id-DbD7K-HL.mjs.map → id-DEaFhGqX.mjs.map} +1 -1
- package/dist/id.cjs +1 -1
- package/dist/id.d.cts +1 -1
- package/dist/id.d.mts +1 -1
- package/dist/id.mjs +1 -1
- package/dist/index.cjs +368 -385
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -242
- package/dist/index.d.mts +4 -242
- package/dist/index.d.ts +5 -238
- package/dist/index.js +3 -322
- package/dist/index.mjs +215 -352
- package/dist/index.mjs.map +1 -1
- package/dist/internal.cjs +6 -6
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +6 -5
- package/dist/internal.d.mts +6 -5
- package/dist/internal.mjs +4 -4
- package/dist/internal.mjs.map +1 -1
- package/dist/{isVariable-B08mggBy.cjs → isVariable-Ba1gLXdB.cjs} +1 -1
- package/dist/{isVariable-B08mggBy.cjs.map → isVariable-Ba1gLXdB.cjs.map} +1 -1
- package/dist/{isVariable-CYsKFHvR.mjs → isVariable-fAKEB7gF.mjs} +1 -1
- package/dist/{isVariable-CYsKFHvR.mjs.map → isVariable-fAKEB7gF.mjs.map} +1 -1
- package/dist/locales/getPluralForm.js +2 -2
- package/dist/logging/logger.d.ts +0 -3
- package/dist/logging/logger.js +0 -3
- package/dist/{types-AHtYZIP-.d.mts → types-73XFwmhH.d.mts} +7 -106
- package/dist/{types-Bf8_Apq_.d.cts → types-YrrGRHBP.d.cts} +7 -106
- package/dist/types-dir/api/enqueueEntries.d.ts +1 -1
- package/dist/types-dir/api/enqueueFiles.d.ts +1 -1
- package/dist/types-dir/api/fetchTranslations.d.ts +1 -1
- package/dist/types-dir/api/file.d.ts +1 -1
- package/dist/types-dir/api/translate.d.ts +1 -1
- package/dist/types-dir/api/uploadFiles.d.ts +1 -1
- package/dist/types.cjs +7 -16
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/dist/types.d.ts +10 -12
- package/dist/types.js +1 -2
- package/dist/types.mjs +1 -15
- package/package.json +3 -2
- package/dist/IntlCache-CAW8tKhd.cjs +0 -212
- package/dist/IntlCache-CAW8tKhd.cjs.map +0 -1
- package/dist/IntlCache-WZk0rKvj.mjs +0 -195
- package/dist/IntlCache-WZk0rKvj.mjs.map +0 -1
- package/dist/base64-2fu94Klt.cjs.map +0 -1
- package/dist/base64-DH0STixb.mjs.map +0 -1
- package/dist/cache/IntlCache.d.ts +0 -26
- package/dist/cache/IntlCache.js +0 -84
- package/dist/cache/types.d.ts +0 -32
- package/dist/cache/types.js +0 -1
- package/dist/core-7RP541eY.cjs +0 -1677
- package/dist/core-7RP541eY.cjs.map +0 -1
- package/dist/core-I9pWGafA.d.mts +0 -209
- package/dist/core-TLJoDpJP.d.cts +0 -209
- package/dist/core-isLphYAZ.mjs +0 -1498
- package/dist/core-isLphYAZ.mjs.map +0 -1
- package/dist/errors/formattingErrors.d.ts +0 -1
- package/dist/errors/formattingErrors.js +0 -3
- package/dist/formatting/custom-formats/CutoffFormat/CutoffFormat.d.ts +0 -59
- package/dist/formatting/custom-formats/CutoffFormat/CutoffFormat.js +0 -147
- package/dist/formatting/custom-formats/CutoffFormat/constants.d.ts +0 -4
- package/dist/formatting/custom-formats/CutoffFormat/constants.js +0 -30
- package/dist/formatting/custom-formats/CutoffFormat/types.d.ts +0 -48
- package/dist/formatting/custom-formats/CutoffFormat/types.js +0 -2
- package/dist/formatting/format.d.ts +0 -1
- package/dist/formatting/format.js +0 -257
- package/dist/locales/customLocaleMapping.d.ts +0 -11
- package/dist/locales/customLocaleMapping.js +0 -23
- package/dist/locales/determineLocale.d.ts +0 -1
- package/dist/locales/determineLocale.js +0 -72
- package/dist/locales/getLocaleDirection.d.ts +0 -1
- package/dist/locales/getLocaleDirection.js +0 -89
- package/dist/locales/getLocaleEmoji.d.ts +0 -2
- package/dist/locales/getLocaleEmoji.js +0 -319
- package/dist/locales/getLocaleName.d.ts +0 -1
- package/dist/locales/getLocaleName.js +0 -45
- package/dist/locales/getLocaleProperties.d.ts +0 -32
- package/dist/locales/getLocaleProperties.js +0 -220
- package/dist/locales/getRegionProperties.d.ts +0 -7
- package/dist/locales/getRegionProperties.js +0 -61
- package/dist/locales/isSameDialect.d.ts +0 -1
- package/dist/locales/isSameDialect.js +0 -41
- package/dist/locales/isSameLanguage.d.ts +0 -1
- package/dist/locales/isSameLanguage.js +0 -20
- package/dist/locales/isSupersetLocale.d.ts +0 -1
- package/dist/locales/isSupersetLocale.js +0 -22
- package/dist/locales/isValidLocale.d.ts +0 -1
- package/dist/locales/isValidLocale.js +0 -75
- package/dist/locales/requiresTranslation.d.ts +0 -1
- package/dist/locales/requiresTranslation.js +0 -32
- package/dist/locales/resolveAliasLocale.d.ts +0 -8
- package/dist/locales/resolveAliasLocale.js +0 -21
- package/dist/locales/resolveCanonicalLocale.d.ts +0 -8
- package/dist/locales/resolveCanonicalLocale.js +0 -13
- package/dist/logging/warnings.d.ts +0 -2
- package/dist/logging/warnings.js +0 -2
- package/dist/types-dir/jsx/content.d.ts +0 -61
- package/dist/types-dir/jsx/content.js +0 -11
- package/dist/types-dir/jsx/variables.d.ts +0 -9
- package/dist/types-dir/jsx/variables.js +0 -1
- package/dist/types.cjs.map +0 -1
- package/dist/types.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import {
|
|
5
|
-
import { n as hashSource } from "./id-DbD7K-HL.mjs";
|
|
1
|
+
import { c as defaultTimeout, n as encode, r as validateFileFormatTransforms, t as decode } from "./base64-CWITCfhU.mjs";
|
|
2
|
+
import { t as ApiError } from "./ApiError-0DxxIHLp.mjs";
|
|
3
|
+
import { n as hashSource } from "./id-DEaFhGqX.mjs";
|
|
4
|
+
import { LocaleConfig, LocaleConfig as LocaleConfig$1, determineLocale, determineLocale as determineLocale$1, formatCurrency, formatCutoff, formatDateTime, formatList, formatListToParts, formatMessage, formatNum, formatRelativeTime, formatRelativeTimeFromDate, getLocaleDirection, getLocaleEmoji, getLocaleName, getLocaleProperties, getRegionProperties, getRegionProperties as getRegionProperties$1, isSameDialect, isSameLanguage, isSupersetLocale, isValidLocale, isValidLocale as isValidLocale$1, requiresTranslation, requiresTranslation as requiresTranslation$1, resolveAliasLocale, resolveAliasLocale as resolveAliasLocale$1, resolveCanonicalLocale, resolveCanonicalLocale as resolveCanonicalLocale$1, standardizeLocale, standardizeLocale as standardizeLocale$1 } from "@generaltranslation/format";
|
|
6
5
|
//#region src/logging/errors.ts
|
|
7
6
|
const GT_ERROR_PREFIX = "GT Error:";
|
|
8
7
|
const translationTimeoutError = (timeout) => `${GT_ERROR_PREFIX} Translation request timed out after ${timeout}ms.`;
|
|
@@ -16,6 +15,204 @@ const noApiKeyProvidedError = (functionName) => `${GT_ERROR_PREFIX} Cannot call
|
|
|
16
15
|
const invalidLocaleError = (locale) => `${GT_ERROR_PREFIX} Invalid locale: ${locale}.`;
|
|
17
16
|
const invalidLocalesError = (locales) => `${GT_ERROR_PREFIX} Invalid locales: ${locales.join(", ")}.`;
|
|
18
17
|
//#endregion
|
|
18
|
+
//#region src/logging/logger.ts
|
|
19
|
+
const LOG_LEVELS = {
|
|
20
|
+
debug: 0,
|
|
21
|
+
info: 1,
|
|
22
|
+
warn: 2,
|
|
23
|
+
error: 3,
|
|
24
|
+
off: 4
|
|
25
|
+
};
|
|
26
|
+
const LOG_COLORS = {
|
|
27
|
+
debug: "\x1B[36m",
|
|
28
|
+
info: "\x1B[32m",
|
|
29
|
+
warn: "\x1B[33m",
|
|
30
|
+
error: "\x1B[31m",
|
|
31
|
+
off: ""
|
|
32
|
+
};
|
|
33
|
+
const RESET_COLOR = "\x1B[0m";
|
|
34
|
+
/**
|
|
35
|
+
* Get the configured log level from environment variable or default to 'warn'
|
|
36
|
+
*/
|
|
37
|
+
function getConfiguredLogLevel() {
|
|
38
|
+
if (typeof process !== "undefined" && process.env?._GT_LOG_LEVEL) {
|
|
39
|
+
const envLevel = process.env._GT_LOG_LEVEL.toLowerCase();
|
|
40
|
+
if (envLevel in LOG_LEVELS) return envLevel;
|
|
41
|
+
}
|
|
42
|
+
return "warn";
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Console log handler that outputs formatted messages to console
|
|
46
|
+
*/
|
|
47
|
+
var ConsoleLogHandler = class {
|
|
48
|
+
constructor(config) {
|
|
49
|
+
this.config = config;
|
|
50
|
+
}
|
|
51
|
+
handle(entry) {
|
|
52
|
+
const parts = [];
|
|
53
|
+
if (this.config.includeTimestamp) parts.push(`[${entry.timestamp.toISOString()}]`);
|
|
54
|
+
const colorCode = LOG_COLORS[entry.level];
|
|
55
|
+
const levelText = `[${entry.level.toUpperCase()}]`;
|
|
56
|
+
parts.push(`${colorCode}${levelText}${RESET_COLOR}`);
|
|
57
|
+
if (this.config.prefix) parts.push(`[${this.config.prefix}]`);
|
|
58
|
+
if (this.config.includeContext && entry.context) parts.push(`[${entry.context}]`);
|
|
59
|
+
parts.push(entry.message);
|
|
60
|
+
if (entry.metadata && Object.keys(entry.metadata).length > 0) parts.push(`\n Metadata: ${JSON.stringify(entry.metadata, null, 2)}`);
|
|
61
|
+
const formattedMessage = parts.join(" ");
|
|
62
|
+
switch (entry.level) {
|
|
63
|
+
case "debug":
|
|
64
|
+
console.debug(formattedMessage);
|
|
65
|
+
break;
|
|
66
|
+
case "info":
|
|
67
|
+
console.info(formattedMessage);
|
|
68
|
+
break;
|
|
69
|
+
case "warn":
|
|
70
|
+
console.warn(formattedMessage);
|
|
71
|
+
break;
|
|
72
|
+
case "error":
|
|
73
|
+
console.error(formattedMessage);
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Main Logger class providing structured logging capabilities.
|
|
80
|
+
*/
|
|
81
|
+
var Logger = class {
|
|
82
|
+
constructor(config = {}) {
|
|
83
|
+
this.config = {
|
|
84
|
+
level: getConfiguredLogLevel(),
|
|
85
|
+
includeTimestamp: true,
|
|
86
|
+
includeContext: true,
|
|
87
|
+
enableConsole: true,
|
|
88
|
+
handlers: [],
|
|
89
|
+
...config
|
|
90
|
+
};
|
|
91
|
+
this.handlers = [...this.config.handlers || []];
|
|
92
|
+
if (this.config.enableConsole) this.handlers.push(new ConsoleLogHandler(this.config));
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Add a custom log handler
|
|
96
|
+
*/
|
|
97
|
+
addHandler(handler) {
|
|
98
|
+
this.handlers.push(handler);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Remove a log handler
|
|
102
|
+
*/
|
|
103
|
+
removeHandler(handler) {
|
|
104
|
+
const index = this.handlers.indexOf(handler);
|
|
105
|
+
if (index > -1) this.handlers.splice(index, 1);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Update logger configuration
|
|
109
|
+
*/
|
|
110
|
+
configure(config) {
|
|
111
|
+
this.config = {
|
|
112
|
+
...this.config,
|
|
113
|
+
...config
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Check if a log level should be output based on current configuration
|
|
118
|
+
*/
|
|
119
|
+
shouldLog(level) {
|
|
120
|
+
return LOG_LEVELS[level] >= LOG_LEVELS[this.config.level];
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Internal logging method that creates log entries and passes them to handlers
|
|
124
|
+
*/
|
|
125
|
+
log(level, message, context, metadata) {
|
|
126
|
+
if (!this.shouldLog(level)) return;
|
|
127
|
+
const entry = {
|
|
128
|
+
level,
|
|
129
|
+
message,
|
|
130
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
131
|
+
context,
|
|
132
|
+
metadata
|
|
133
|
+
};
|
|
134
|
+
this.handlers.forEach((handler) => {
|
|
135
|
+
try {
|
|
136
|
+
handler.handle(entry);
|
|
137
|
+
} catch (error) {
|
|
138
|
+
console.error("Error in log handler:", error);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Log a debug message
|
|
144
|
+
* Used for detailed diagnostic information, typically of interest only when diagnosing problems
|
|
145
|
+
*/
|
|
146
|
+
debug(message, context, metadata) {
|
|
147
|
+
this.log("debug", message, context, metadata);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Log an info message
|
|
151
|
+
* Used for general information about application operation.
|
|
152
|
+
*/
|
|
153
|
+
info(message, context, metadata) {
|
|
154
|
+
this.log("info", message, context, metadata);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Log a warning message
|
|
158
|
+
* Used for potentially problematic situations that don't prevent operation
|
|
159
|
+
*/
|
|
160
|
+
warn(message, context, metadata) {
|
|
161
|
+
this.log("warn", message, context, metadata);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Log an error message
|
|
165
|
+
* Used for error events that might still allow the application to continue.
|
|
166
|
+
*/
|
|
167
|
+
error(message, context, metadata) {
|
|
168
|
+
this.log("error", message, context, metadata);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Create a child logger with a specific context
|
|
172
|
+
*/
|
|
173
|
+
child(context) {
|
|
174
|
+
return new ContextLogger(this, context);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Get current logger configuration
|
|
178
|
+
*/
|
|
179
|
+
getConfig() {
|
|
180
|
+
return { ...this.config };
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Context logger that automatically includes context information.
|
|
185
|
+
*/
|
|
186
|
+
var ContextLogger = class ContextLogger {
|
|
187
|
+
constructor(logger, context) {
|
|
188
|
+
this.logger = logger;
|
|
189
|
+
this.context = context;
|
|
190
|
+
}
|
|
191
|
+
debug(message, metadata) {
|
|
192
|
+
this.logger.debug(message, this.context, metadata);
|
|
193
|
+
}
|
|
194
|
+
info(message, metadata) {
|
|
195
|
+
this.logger.info(message, this.context, metadata);
|
|
196
|
+
}
|
|
197
|
+
warn(message, metadata) {
|
|
198
|
+
this.logger.warn(message, this.context, metadata);
|
|
199
|
+
}
|
|
200
|
+
error(message, metadata) {
|
|
201
|
+
this.logger.error(message, this.context, metadata);
|
|
202
|
+
}
|
|
203
|
+
child(childContext) {
|
|
204
|
+
return new ContextLogger(this.logger, `${this.context}:${childContext}`);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
const defaultLogger = new Logger({
|
|
208
|
+
level: getConfiguredLogLevel(),
|
|
209
|
+
includeTimestamp: true,
|
|
210
|
+
includeContext: true,
|
|
211
|
+
prefix: "GT"
|
|
212
|
+
});
|
|
213
|
+
const fetchLogger = defaultLogger.child("fetch");
|
|
214
|
+
const gtInstanceLogger = defaultLogger.child("GT instance");
|
|
215
|
+
//#endregion
|
|
19
216
|
//#region src/translate/utils/fetchWithTimeout.ts
|
|
20
217
|
/**
|
|
21
218
|
* @internal
|
|
@@ -360,61 +557,6 @@ async function _submitUserEditDiffs(payload, config, options = {}) {
|
|
|
360
557
|
return { success: true };
|
|
361
558
|
}
|
|
362
559
|
//#endregion
|
|
363
|
-
//#region src/locales/getRegionProperties.ts
|
|
364
|
-
/**
|
|
365
|
-
* Retrieves multiple properties for a given region code, including:
|
|
366
|
-
* - `code`: the original region code
|
|
367
|
-
* - `name`: the localized display name
|
|
368
|
-
* - `emoji`: the associated flag or symbol
|
|
369
|
-
*
|
|
370
|
-
* Behavior:
|
|
371
|
-
* - Accepts ISO 3166-1 alpha-2 or UN M.49 region codes (e.g., `"US"`, `"FR"`, `"419"`).
|
|
372
|
-
* - If `customMapping` contains a `name` or `emoji` for the region, those override the default values.
|
|
373
|
-
* - Otherwise, uses `Intl.DisplayNames` to get the localized region name in the given `defaultLocale`,
|
|
374
|
-
* falling back to `libraryDefaultLocale`.
|
|
375
|
-
* - Falls back to the region code as `name` if display name resolution fails.
|
|
376
|
-
* - Falls back to `defaultEmoji` if no emoji can be computed or found in `customMapping`.
|
|
377
|
-
*
|
|
378
|
-
* @param {string} region - The region code to look up (e.g., `"US"`, `"GB"`, `"DE"`).
|
|
379
|
-
* @param {string} [defaultLocale=libraryDefaultLocale] - The locale to use when localizing the region name.
|
|
380
|
-
* @param {CustomRegionMapping} [customMapping] - Optional mapping of region codes to custom names and/or emojis.
|
|
381
|
-
* @returns {{ code: string, name: string, emoji: string }} An object containing:
|
|
382
|
-
* - `code`: the input region code
|
|
383
|
-
* - `name`: the localized or custom region name
|
|
384
|
-
* - `emoji`: the matching emoji flag or symbol
|
|
385
|
-
* @internal
|
|
386
|
-
*
|
|
387
|
-
* @example
|
|
388
|
-
* _getRegionProperties('US', 'en');
|
|
389
|
-
* // => { code: 'US', name: 'United States', emoji: '🇺🇸' }
|
|
390
|
-
*
|
|
391
|
-
* @example
|
|
392
|
-
* _getRegionProperties('US', 'fr');
|
|
393
|
-
* // => { code: 'US', name: 'États-Unis', emoji: '🇺🇸' }
|
|
394
|
-
*
|
|
395
|
-
* @example
|
|
396
|
-
* _getRegionProperties('US', 'en', { US: { name: 'USA', emoji: '🗽' } });
|
|
397
|
-
* // => { code: 'US', name: 'USA', emoji: '🗽' }
|
|
398
|
-
*/
|
|
399
|
-
function _getRegionProperties(region, defaultLocale = "en", customMapping) {
|
|
400
|
-
defaultLocale ||= "en";
|
|
401
|
-
try {
|
|
402
|
-
return {
|
|
403
|
-
code: region,
|
|
404
|
-
name: intlCache.get("DisplayNames", [defaultLocale, "en"], { type: "region" }).of(region) || region,
|
|
405
|
-
emoji: getRegionEmoji(region),
|
|
406
|
-
...customMapping?.[region]
|
|
407
|
-
};
|
|
408
|
-
} catch {
|
|
409
|
-
return {
|
|
410
|
-
code: region,
|
|
411
|
-
name: region,
|
|
412
|
-
emoji: defaultEmoji,
|
|
413
|
-
...customMapping?.[region]
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
//#endregion
|
|
418
560
|
//#region src/translate/uploadSourceFiles.ts
|
|
419
561
|
/**
|
|
420
562
|
* @internal
|
|
@@ -790,19 +932,19 @@ var GT = class {
|
|
|
790
932
|
if (devApiKey) this.devApiKey = devApiKey;
|
|
791
933
|
if (projectId) this.projectId = projectId;
|
|
792
934
|
if (sourceLocale) {
|
|
793
|
-
this.sourceLocale =
|
|
794
|
-
if (!
|
|
935
|
+
this.sourceLocale = standardizeLocale$1(sourceLocale);
|
|
936
|
+
if (!isValidLocale$1(this.sourceLocale, customMapping)) throw new Error(invalidLocaleError(this.sourceLocale));
|
|
795
937
|
}
|
|
796
938
|
if (targetLocale) {
|
|
797
|
-
this.targetLocale =
|
|
798
|
-
if (!
|
|
939
|
+
this.targetLocale = standardizeLocale$1(targetLocale);
|
|
940
|
+
if (!isValidLocale$1(this.targetLocale, customMapping)) throw new Error(invalidLocaleError(this.targetLocale));
|
|
799
941
|
}
|
|
800
942
|
if (locales) {
|
|
801
943
|
const result = [];
|
|
802
944
|
const invalidLocales = [];
|
|
803
945
|
locales.forEach((locale) => {
|
|
804
|
-
const standardizedLocale =
|
|
805
|
-
if (
|
|
946
|
+
const standardizedLocale = standardizeLocale$1(locale);
|
|
947
|
+
if (isValidLocale$1(standardizedLocale)) result.push(standardizedLocale);
|
|
806
948
|
else invalidLocales.push(locale);
|
|
807
949
|
});
|
|
808
950
|
if (invalidLocales.length > 0) throw new Error(invalidLocalesError(invalidLocales));
|
|
@@ -813,7 +955,7 @@ var GT = class {
|
|
|
813
955
|
this.customMapping = customMapping;
|
|
814
956
|
this.reverseCustomMapping = Object.fromEntries(Object.entries(customMapping).filter(([, value]) => value && typeof value === "object" && "code" in value).map(([key, value]) => [value.code, key]));
|
|
815
957
|
}
|
|
816
|
-
this._localeConfig = new LocaleConfig({
|
|
958
|
+
this._localeConfig = new LocaleConfig$1({
|
|
817
959
|
defaultLocale: this.sourceLocale,
|
|
818
960
|
locales: this.locales ?? [],
|
|
819
961
|
customMapping: this.customMapping
|
|
@@ -1567,7 +1709,7 @@ var GT = class {
|
|
|
1567
1709
|
}
|
|
1568
1710
|
customMapping = this.customRegionMapping;
|
|
1569
1711
|
}
|
|
1570
|
-
return
|
|
1712
|
+
return getRegionProperties$1(region, this.targetLocale, customMapping);
|
|
1571
1713
|
}
|
|
1572
1714
|
/**
|
|
1573
1715
|
* Determines whether a translation is required based on the source and target locales.
|
|
@@ -1587,7 +1729,7 @@ var GT = class {
|
|
|
1587
1729
|
if (!sourceLocale) throw new Error(noSourceLocaleProvidedError("requiresTranslation"));
|
|
1588
1730
|
if (!targetLocale) throw new Error(noTargetLocaleProvidedError("requiresTranslation"));
|
|
1589
1731
|
if (customMapping === this.customMapping) return this.localeConfig.requiresTranslation(targetLocale, sourceLocale, approvedLocales);
|
|
1590
|
-
return
|
|
1732
|
+
return requiresTranslation$1(sourceLocale, targetLocale, approvedLocales, customMapping);
|
|
1591
1733
|
}
|
|
1592
1734
|
/**
|
|
1593
1735
|
* Determines the best matching locale from the provided approved locales list.
|
|
@@ -1602,7 +1744,7 @@ var GT = class {
|
|
|
1602
1744
|
*/
|
|
1603
1745
|
determineLocale(locales, approvedLocales = this.locales || [], customMapping = this.customMapping) {
|
|
1604
1746
|
if (customMapping === this.customMapping) return this.localeConfig.determineLocale(locales, approvedLocales ?? []);
|
|
1605
|
-
return
|
|
1747
|
+
return determineLocale$1(locales, approvedLocales, customMapping);
|
|
1606
1748
|
}
|
|
1607
1749
|
/**
|
|
1608
1750
|
* Gets the text direction for a given locale code.
|
|
@@ -1634,7 +1776,7 @@ var GT = class {
|
|
|
1634
1776
|
isValidLocale(locale = this.targetLocale, customMapping = this.customMapping) {
|
|
1635
1777
|
if (!locale) throw new Error(noTargetLocaleProvidedError("isValidLocale"));
|
|
1636
1778
|
if (customMapping === this.customMapping) return this.localeConfig.isValidLocale(locale);
|
|
1637
|
-
return
|
|
1779
|
+
return isValidLocale$1(locale, customMapping);
|
|
1638
1780
|
}
|
|
1639
1781
|
/**
|
|
1640
1782
|
* Resolves the canonical locale for a given locale.
|
|
@@ -1645,7 +1787,7 @@ var GT = class {
|
|
|
1645
1787
|
resolveCanonicalLocale(locale = this.targetLocale, customMapping = this.customMapping) {
|
|
1646
1788
|
if (!locale) throw new Error(noTargetLocaleProvidedError("resolveCanonicalLocale"));
|
|
1647
1789
|
if (customMapping === this.customMapping) return this.localeConfig.resolveCanonicalLocale(locale);
|
|
1648
|
-
return
|
|
1790
|
+
return resolveCanonicalLocale$1(locale, customMapping);
|
|
1649
1791
|
}
|
|
1650
1792
|
/**
|
|
1651
1793
|
* Resolves the alias locale for a given locale.
|
|
@@ -1656,7 +1798,7 @@ var GT = class {
|
|
|
1656
1798
|
resolveAliasLocale(locale, customMapping = this.customMapping) {
|
|
1657
1799
|
if (!locale) throw new Error(noTargetLocaleProvidedError("resolveAliasLocale"));
|
|
1658
1800
|
if (customMapping === this.customMapping) return this.localeConfig.resolveAliasLocale(locale);
|
|
1659
|
-
return
|
|
1801
|
+
return resolveAliasLocale$1(locale, customMapping);
|
|
1660
1802
|
}
|
|
1661
1803
|
/**
|
|
1662
1804
|
* Standardizes a BCP 47 locale code to ensure correct formatting.
|
|
@@ -1720,285 +1862,6 @@ var GT = class {
|
|
|
1720
1862
|
return this.localeConfig.isSupersetLocale(superLocale, subLocale);
|
|
1721
1863
|
}
|
|
1722
1864
|
};
|
|
1723
|
-
/**
|
|
1724
|
-
* Formats a number according to the specified locales and options.
|
|
1725
|
-
* @param {Object} params - The parameters for the number formatting.
|
|
1726
|
-
* @param {number} params.value - The number to format.
|
|
1727
|
-
* @param {Intl.NumberFormatOptions} [params.options] - Additional options for number formatting.
|
|
1728
|
-
* @param {string | string[]} [params.options.locales] - The locales to use for formatting.
|
|
1729
|
-
* @returns {string} The formatted number.
|
|
1730
|
-
*/
|
|
1731
|
-
function formatNum(number, options) {
|
|
1732
|
-
return _formatNum({
|
|
1733
|
-
value: number,
|
|
1734
|
-
locales: options.locales,
|
|
1735
|
-
options
|
|
1736
|
-
});
|
|
1737
|
-
}
|
|
1738
|
-
/**
|
|
1739
|
-
* Formats a date according to the specified languages and options.
|
|
1740
|
-
* @param {Object} params - The parameters for the date formatting.
|
|
1741
|
-
* @param {Date} params.value - The date to format.
|
|
1742
|
-
* @param {Intl.DateTimeFormatOptions} [params.options] - Additional options for date formatting.
|
|
1743
|
-
* @param {string | string[]} [params.options.locales] - The languages to use for formatting.
|
|
1744
|
-
* @returns {string} The formatted date.
|
|
1745
|
-
*/
|
|
1746
|
-
function formatDateTime(date, options) {
|
|
1747
|
-
return _formatDateTime({
|
|
1748
|
-
value: date,
|
|
1749
|
-
locales: options?.locales,
|
|
1750
|
-
options
|
|
1751
|
-
});
|
|
1752
|
-
}
|
|
1753
|
-
/**
|
|
1754
|
-
* Formats a currency value according to the specified languages, currency, and options.
|
|
1755
|
-
* @param {Object} params - The parameters for the currency formatting.
|
|
1756
|
-
* @param {number} params.value - The currency value to format.
|
|
1757
|
-
* @param {string} params.currency - The currency code (e.g., 'USD').
|
|
1758
|
-
* @param {Intl.NumberFormatOptions} [params.options={}] - Additional options for currency formatting.
|
|
1759
|
-
* @param {string | string[]} [params.options.locales] - The locale codes to use for formatting.
|
|
1760
|
-
* @returns {string} The formatted currency value.
|
|
1761
|
-
*/
|
|
1762
|
-
function formatCurrency(value, currency, options) {
|
|
1763
|
-
return _formatCurrency({
|
|
1764
|
-
value,
|
|
1765
|
-
currency,
|
|
1766
|
-
locales: options.locales,
|
|
1767
|
-
options
|
|
1768
|
-
});
|
|
1769
|
-
}
|
|
1770
|
-
/**
|
|
1771
|
-
* Formats a list of items according to the specified locales and options.
|
|
1772
|
-
* @param {Object} params - The parameters for the list formatting.
|
|
1773
|
-
* @param {Array<string | number>} params.value - The list of items to format.
|
|
1774
|
-
* @param {Intl.ListFormatOptions} [params.options={}] - Additional options for list formatting.
|
|
1775
|
-
* @param {string | string[]} [params.options.locales] - The locales to use for formatting.
|
|
1776
|
-
* @returns {string} The formatted list.
|
|
1777
|
-
*/
|
|
1778
|
-
function formatList(array, options) {
|
|
1779
|
-
return _formatList({
|
|
1780
|
-
value: array,
|
|
1781
|
-
locales: options.locales,
|
|
1782
|
-
options
|
|
1783
|
-
});
|
|
1784
|
-
}
|
|
1785
|
-
/**
|
|
1786
|
-
* Formats a list of items according to the specified locales and options.
|
|
1787
|
-
* @param {Array<T>} array - The list of items to format.
|
|
1788
|
-
* @param {Object} [options] - Additional options for list formatting.
|
|
1789
|
-
* @param {string | string[]} [options.locales] - The locales to use for formatting.
|
|
1790
|
-
* @param {Intl.ListFormatOptions} [options] - Additional Intl.ListFormat options.
|
|
1791
|
-
* @returns {Array<T | string>} The formatted list parts.
|
|
1792
|
-
*/
|
|
1793
|
-
function formatListToParts(array, options) {
|
|
1794
|
-
return _formatListToParts({
|
|
1795
|
-
value: array,
|
|
1796
|
-
locales: options?.locales,
|
|
1797
|
-
options
|
|
1798
|
-
});
|
|
1799
|
-
}
|
|
1800
|
-
/**
|
|
1801
|
-
* Formats a relative time value according to the specified locales and options.
|
|
1802
|
-
* @param {Object} params - The parameters for the relative time formatting.
|
|
1803
|
-
* @param {number} params.value - The relative time value to format.
|
|
1804
|
-
* @param {Intl.RelativeTimeFormatUnit} params.unit - The unit of time (e.g., 'second', 'minute', 'hour', 'day', 'week', 'month', 'year').
|
|
1805
|
-
* @param {Intl.RelativeTimeFormatOptions} [params.options={}] - Additional options for relative time formatting.
|
|
1806
|
-
* @param {string | string[]} [params.options.locales] - The locales to use for formatting.
|
|
1807
|
-
* @returns {string} The formatted relative time string.
|
|
1808
|
-
*/
|
|
1809
|
-
function formatRelativeTime(value, unit, options) {
|
|
1810
|
-
return _formatRelativeTime({
|
|
1811
|
-
value,
|
|
1812
|
-
unit,
|
|
1813
|
-
locales: options.locales,
|
|
1814
|
-
options
|
|
1815
|
-
});
|
|
1816
|
-
}
|
|
1817
|
-
/**
|
|
1818
|
-
* Formats a relative time string from a Date, automatically selecting the best unit.
|
|
1819
|
-
* @param {Date} date - The date to format relative to now.
|
|
1820
|
-
* @param {Object} options - Formatting options.
|
|
1821
|
-
* @param {string | string[]} options.locales - The locales to use for formatting.
|
|
1822
|
-
* @param {Intl.RelativeTimeFormatOptions} [options] - Additional Intl.RelativeTimeFormat options.
|
|
1823
|
-
* @returns {string} The formatted relative time string (e.g., "2 hours ago", "in 3 days").
|
|
1824
|
-
*/
|
|
1825
|
-
function formatRelativeTimeFromDate(date, options) {
|
|
1826
|
-
const { locales, baseDate, ...intlOptions } = options;
|
|
1827
|
-
return _formatRelativeTimeFromDate({
|
|
1828
|
-
date,
|
|
1829
|
-
baseDate: baseDate ?? /* @__PURE__ */ new Date(),
|
|
1830
|
-
locales,
|
|
1831
|
-
options: intlOptions
|
|
1832
|
-
});
|
|
1833
|
-
}
|
|
1834
|
-
/**
|
|
1835
|
-
* Retrieves the display name of locale code using Intl.DisplayNames.
|
|
1836
|
-
*
|
|
1837
|
-
* @param {string} locale - A BCP-47 locale code.
|
|
1838
|
-
* @param {string} [defaultLocale] - The default locale to use for formatting.
|
|
1839
|
-
* @param {CustomMapping} [customMapping] - A custom mapping of locale codes to their names.
|
|
1840
|
-
* @returns {string} The display name corresponding to the code.
|
|
1841
|
-
*/
|
|
1842
|
-
function getLocaleName(locale, defaultLocale, customMapping) {
|
|
1843
|
-
return _getLocaleName(locale, defaultLocale, customMapping);
|
|
1844
|
-
}
|
|
1845
|
-
/**
|
|
1846
|
-
* Retrieves an emoji based on a given locale code, taking into account region, language, and specific exceptions.
|
|
1847
|
-
*
|
|
1848
|
-
* This function uses the locale's region (if present) to select an emoji or falls back on default emojis for certain languages.
|
|
1849
|
-
*
|
|
1850
|
-
* @param locale - A string representing the locale code (e.g., 'en-US', 'fr-CA').
|
|
1851
|
-
* @param {CustomMapping} [customMapping] - A custom mapping of locale codes to their names.
|
|
1852
|
-
* @returns The emoji representing the locale or its region, or a default emoji if no specific match is found.
|
|
1853
|
-
*/
|
|
1854
|
-
function getLocaleEmoji(locale, customMapping) {
|
|
1855
|
-
return _getLocaleEmoji(locale, customMapping);
|
|
1856
|
-
}
|
|
1857
|
-
/**
|
|
1858
|
-
* Generates linguistic details for a given locale code.
|
|
1859
|
-
*
|
|
1860
|
-
* This function returns information about the locale,
|
|
1861
|
-
* script, and region of a given language code both in a standard form and in a maximized form (with likely script and region).
|
|
1862
|
-
* The function provides these names in both your default language and native forms, and an associated emoji.
|
|
1863
|
-
*
|
|
1864
|
-
* @param {string} locale - The locale code to get properties for (e.g., "de-AT").
|
|
1865
|
-
* @param {string} [defaultLocale] - The default locale to use for formatting.
|
|
1866
|
-
* @param {CustomMapping} [customMapping] - A custom mapping of locale codes to their names.
|
|
1867
|
-
* @returns {LocaleProperties} - An object containing detailed information about the locale.
|
|
1868
|
-
*
|
|
1869
|
-
* @property {string} code - The full locale code, e.g., "de-AT".
|
|
1870
|
-
* @property {string} name - Language name in the default display language, e.g., "Austrian German".
|
|
1871
|
-
* @property {string} nativeName - Language name in the locale's native language, e.g., "Österreichisches Deutsch".
|
|
1872
|
-
* @property {string} languageCode - The base language code, e.g., "de".
|
|
1873
|
-
* @property {string} languageName - The language name in the default display language, e.g., "German".
|
|
1874
|
-
* @property {string} nativeLanguageName - The language name in the native language, e.g., "Deutsch".
|
|
1875
|
-
* @property {string} nameWithRegionCode - Language name with region in the default language, e.g., "German (AT)".
|
|
1876
|
-
* @property {string} nativeNameWithRegionCode - Language name with region in the native language, e.g., "Deutsch (AT)".
|
|
1877
|
-
* @property {string} regionCode - The region code from maximization, e.g., "AT".
|
|
1878
|
-
* @property {string} regionName - The region name in the default display language, e.g., "Austria".
|
|
1879
|
-
* @property {string} nativeRegionName - The region name in the native language, e.g., "Österreich".
|
|
1880
|
-
* @property {string} scriptCode - The script code from maximization, e.g., "Latn".
|
|
1881
|
-
* @property {string} scriptName - The script name in the default display language, e.g., "Latin".
|
|
1882
|
-
* @property {string} nativeScriptName - The script name in the native language, e.g., "Lateinisch".
|
|
1883
|
-
* @property {string} maximizedCode - The maximized locale code, e.g., "de-Latn-AT".
|
|
1884
|
-
* @property {string} maximizedName - Maximized locale name with likely script in the default language, e.g., "Austrian German (Latin)".
|
|
1885
|
-
* @property {string} nativeMaximizedName - Maximized locale name in the native language, e.g., "Österreichisches Deutsch (Lateinisch)".
|
|
1886
|
-
* @property {string} minimizedCode - Minimized locale code, e.g., "de-AT" (or "de" for "de-DE").
|
|
1887
|
-
* @property {string} minimizedName - Minimized language name in the default language, e.g., "Austrian German".
|
|
1888
|
-
* @property {string} nativeMinimizedName - Minimized language name in the native language, e.g., "Österreichisches Deutsch".
|
|
1889
|
-
* @property {string} emoji - The emoji associated with the locale's region, if applicable.
|
|
1890
|
-
*/
|
|
1891
|
-
function getLocaleProperties(locale, defaultLocale, customMapping) {
|
|
1892
|
-
return _getLocaleProperties(locale, defaultLocale, customMapping);
|
|
1893
|
-
}
|
|
1894
|
-
/**
|
|
1895
|
-
* Retrieves multiple properties for a given region code, including:
|
|
1896
|
-
* - `code`: the original region code
|
|
1897
|
-
* - `name`: the localized display name
|
|
1898
|
-
* - `emoji`: the associated flag or symbol
|
|
1899
|
-
*
|
|
1900
|
-
* Behavior:
|
|
1901
|
-
* - Accepts ISO 3166-1 alpha-2 or UN M.49 region codes (e.g., `"US"`, `"FR"`, `"419"`).
|
|
1902
|
-
* - If `customMapping` contains a `name` or `emoji` for the region, those override the default values.
|
|
1903
|
-
* - Otherwise, uses `Intl.DisplayNames` to get the localized region name in the given `defaultLocale`,
|
|
1904
|
-
* falling back to `libraryDefaultLocale`.
|
|
1905
|
-
* - Falls back to the region code as `name` if display name resolution fails.
|
|
1906
|
-
* - Falls back to `defaultEmoji` if no emoji mapping is found in `emojis` or `customMapping`.
|
|
1907
|
-
*
|
|
1908
|
-
* @param {string} region - The region code to look up (e.g., `"US"`, `"GB"`, `"DE"`).
|
|
1909
|
-
* @param {string} [defaultLocale=libraryDefaultLocale] - The locale to use when localizing the region name.
|
|
1910
|
-
* @param {CustomRegionMapping} [customMapping] - Optional mapping of region codes to custom names and/or emojis.
|
|
1911
|
-
* @returns {{ code: string, name: string, emoji: string }} An object containing:
|
|
1912
|
-
* - `code`: the input region code
|
|
1913
|
-
* - `name`: the localized or custom region name
|
|
1914
|
-
* - `emoji`: the matching emoji flag or symbol
|
|
1915
|
-
*
|
|
1916
|
-
* @example
|
|
1917
|
-
* getRegionProperties('US', 'en');
|
|
1918
|
-
* // => { code: 'US', name: 'United States', emoji: '🇺🇸' }
|
|
1919
|
-
*
|
|
1920
|
-
* @example
|
|
1921
|
-
* getRegionProperties('US', 'fr');
|
|
1922
|
-
* // => { code: 'US', name: 'États-Unis', emoji: '🇺🇸' }
|
|
1923
|
-
*
|
|
1924
|
-
* @example
|
|
1925
|
-
* getRegionProperties('US', 'en', { US: { name: 'USA', emoji: '🗽' } });
|
|
1926
|
-
* // => { code: 'US', name: 'USA', emoji: '🗽' }
|
|
1927
|
-
*/
|
|
1928
|
-
function getRegionProperties(region, defaultLocale, customMapping) {
|
|
1929
|
-
return _getRegionProperties(region, defaultLocale, customMapping);
|
|
1930
|
-
}
|
|
1931
|
-
/**
|
|
1932
|
-
* Determines whether a translation is required based on the source and target locales.
|
|
1933
|
-
*
|
|
1934
|
-
* - If the target locale is not specified, the function returns `false`, as translation is not needed.
|
|
1935
|
-
* - If the source and target locale are the same, returns `false`, indicating that no translation is necessary.
|
|
1936
|
-
* - If the `approvedLocales` array is provided, and the target locale is not within that array, the function also returns `false`.
|
|
1937
|
-
* - Otherwise, it returns `true`, meaning that a translation is required.
|
|
1938
|
-
*
|
|
1939
|
-
* @param {string} sourceLocale - The locale code for the original content (BCP 47 locale code).
|
|
1940
|
-
* @param {string} targetLocale - The locale code of the language to translate the content into (BCP 47 locale code).
|
|
1941
|
-
* @param {string[]} [approvedLocale] - An optional array of approved target locales.
|
|
1942
|
-
*
|
|
1943
|
-
* @returns {boolean} - Returns `true` if translation is required, otherwise `false`.
|
|
1944
|
-
*/
|
|
1945
|
-
function requiresTranslation(sourceLocale, targetLocale, approvedLocales, customMapping) {
|
|
1946
|
-
return _requiresTranslation(sourceLocale, targetLocale, approvedLocales, customMapping);
|
|
1947
|
-
}
|
|
1948
|
-
/**
|
|
1949
|
-
* Determines the best matching locale from the provided approved locales list.
|
|
1950
|
-
* @param {string | string[]} locales - A single locale or an array of locales sorted in preference order.
|
|
1951
|
-
* @param {string[]} [approvedLocales=this.locales] - An array of approved locales, also sorted by preference.
|
|
1952
|
-
* @returns {string | undefined} - The best matching locale from the approvedLocales list, or undefined if no match is found.
|
|
1953
|
-
*/
|
|
1954
|
-
function determineLocale(locales, approvedLocales = [], customMapping = void 0) {
|
|
1955
|
-
return _determineLocale(locales, approvedLocales, customMapping);
|
|
1956
|
-
}
|
|
1957
|
-
/**
|
|
1958
|
-
* Get the text direction for a given locale code using the Intl.Locale API.
|
|
1959
|
-
*
|
|
1960
|
-
* @param {string} locale - A BCP-47 locale code.
|
|
1961
|
-
* @returns {string} 'rtl' if the locale is right-to-left; otherwise 'ltr'.
|
|
1962
|
-
*/
|
|
1963
|
-
function getLocaleDirection(locale) {
|
|
1964
|
-
return _getLocaleDirection(locale);
|
|
1965
|
-
}
|
|
1966
|
-
/**
|
|
1967
|
-
* Resolves the alias locale for a given locale.
|
|
1968
|
-
* @param {string} locale - The locale to resolve the alias locale for
|
|
1969
|
-
* @param {CustomMapping} [customMapping] - The custom mapping to use for resolving the alias locale
|
|
1970
|
-
* @returns {string} The alias locale
|
|
1971
|
-
*/
|
|
1972
|
-
function resolveAliasLocale(locale, customMapping) {
|
|
1973
|
-
return _resolveAliasLocale(locale, customMapping);
|
|
1974
|
-
}
|
|
1975
|
-
/**
|
|
1976
|
-
* Checks if multiple BCP 47 locale codes represent the same dialect.
|
|
1977
|
-
* @param {string[]} locales - The BCP 47 locale codes to compare.
|
|
1978
|
-
* @returns {boolean} True if all BCP 47 codes represent the same dialect, false otherwise.
|
|
1979
|
-
*/
|
|
1980
|
-
function isSameDialect(...locales) {
|
|
1981
|
-
return _isSameDialect(...locales);
|
|
1982
|
-
}
|
|
1983
|
-
/**
|
|
1984
|
-
* Checks if multiple BCP 47 locale codes represent the same language.
|
|
1985
|
-
* @param {string[]} locales - The BCP 47 locale codes to compare.
|
|
1986
|
-
* @returns {boolean} True if all BCP 47 codes represent the same language, false otherwise.
|
|
1987
|
-
*/
|
|
1988
|
-
function isSameLanguage(...locales) {
|
|
1989
|
-
return _isSameLanguage(...locales);
|
|
1990
|
-
}
|
|
1991
|
-
/**
|
|
1992
|
-
* Checks if a locale is a superset of another locale.
|
|
1993
|
-
* A subLocale is a subset of superLocale if it is an extension of superLocale or are otherwise identical.
|
|
1994
|
-
*
|
|
1995
|
-
* @param {string} superLocale - The locale to check if it is a superset of the other locale.
|
|
1996
|
-
* @param {string} subLocale - The locale to check if it is a subset of the other locale.
|
|
1997
|
-
* @returns {boolean} True if the first locale is a superset of the second locale, false otherwise.
|
|
1998
|
-
*/
|
|
1999
|
-
function isSupersetLocale(superLocale, subLocale) {
|
|
2000
|
-
return _isSupersetLocale(superLocale, subLocale);
|
|
2001
|
-
}
|
|
2002
1865
|
const API_VERSION = API_VERSION$1;
|
|
2003
1866
|
//#endregion
|
|
2004
1867
|
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 };
|