generaltranslation 7.0.0-alpha.2 → 7.0.0-alpha.20

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/dist/index.d.ts CHANGED
@@ -36,7 +36,7 @@ type GTConstructorParams = {
36
36
  * locales: ['en-US', 'es-ES', 'fr-FR']
37
37
  * });
38
38
  */
39
- export default class GT {
39
+ export declare class GT {
40
40
  /** Base URL for the translation service API */
41
41
  baseUrl: string;
42
42
  /** Project ID for the translation service */
@@ -89,7 +89,7 @@ export default class GT {
89
89
  * // Returns: "Bonjour John"
90
90
  */
91
91
  formatMessage(message: string, options?: {
92
- locales?: string[];
92
+ locales?: string | string[];
93
93
  variables?: FormatVariables;
94
94
  }): string;
95
95
  /**
@@ -97,7 +97,7 @@ export default class GT {
97
97
  *
98
98
  * @param {number} number - The number to format
99
99
  * @param {Object} [options] - Additional options for number formatting
100
- * @param {string[]} [options.locales] - The locales to use for formatting
100
+ * @param {string | string[]} [options.locales] - The locales to use for formatting
101
101
  * @param {Intl.NumberFormatOptions} [options] - Additional Intl.NumberFormat options
102
102
  * @returns {string} The formatted number
103
103
  *
@@ -106,14 +106,14 @@ export default class GT {
106
106
  * // Returns: "$1,234.56"
107
107
  */
108
108
  formatNum(number: number, options?: {
109
- locales?: string[];
109
+ locales?: string | string[];
110
110
  } & Intl.NumberFormatOptions): string;
111
111
  /**
112
112
  * Formats a date according to the specified locales and options.
113
113
  *
114
114
  * @param {Date} date - The date to format
115
115
  * @param {Object} [options] - Additional options for date formatting
116
- * @param {string[]} [options.locales] - The locales to use for formatting
116
+ * @param {string | string[]} [options.locales] - The locales to use for formatting
117
117
  * @param {Intl.DateTimeFormatOptions} [options] - Additional Intl.DateTimeFormat options
118
118
  * @returns {string} The formatted date
119
119
  *
@@ -122,7 +122,7 @@ export default class GT {
122
122
  * // Returns: "Thursday, March 14, 2024 at 2:30:45 PM GMT-7"
123
123
  */
124
124
  formatDateTime(date: Date, options?: {
125
- locales?: string[];
125
+ locales?: string | string[];
126
126
  } & Intl.DateTimeFormatOptions): string;
127
127
  /**
128
128
  * Formats a currency value according to the specified locales and options.
@@ -130,7 +130,7 @@ export default class GT {
130
130
  * @param {number} value - The currency value to format
131
131
  * @param {string} currency - The currency code (e.g., 'USD', 'EUR')
132
132
  * @param {Object} [options] - Additional options for currency formatting
133
- * @param {string[]} [options.locales] - The locales to use for formatting
133
+ * @param {string | string[]} [options.locales] - The locales to use for formatting
134
134
  * @param {Intl.NumberFormatOptions} [options] - Additional Intl.NumberFormat options
135
135
  * @returns {string} The formatted currency value
136
136
  *
@@ -139,14 +139,14 @@ export default class GT {
139
139
  * // Returns: "$1,234.56"
140
140
  */
141
141
  formatCurrency(value: number, currency: string, options?: {
142
- locales?: string[];
142
+ locales?: string | string[];
143
143
  } & Intl.NumberFormatOptions): string;
144
144
  /**
145
145
  * Formats a list of items according to the specified locales and options.
146
146
  *
147
147
  * @param {Array<string | number>} array - The list of items to format
148
148
  * @param {Object} [options] - Additional options for list formatting
149
- * @param {string[]} [options.locales] - The locales to use for formatting
149
+ * @param {string | string[]} [options.locales] - The locales to use for formatting
150
150
  * @param {Intl.ListFormatOptions} [options] - Additional Intl.ListFormat options
151
151
  * @returns {string} The formatted list
152
152
  *
@@ -155,7 +155,7 @@ export default class GT {
155
155
  * // Returns: "apple, banana, and orange"
156
156
  */
157
157
  formatList(array: Array<string | number>, options?: {
158
- locales?: string[];
158
+ locales?: string | string[];
159
159
  } & Intl.ListFormatOptions): string;
160
160
  /**
161
161
  * Formats a relative time value according to the specified locales and options.
@@ -163,7 +163,7 @@ export default class GT {
163
163
  * @param {number} value - The relative time value to format
164
164
  * @param {Intl.RelativeTimeFormatUnit} unit - The unit of time (e.g., 'second', 'minute', 'hour', 'day', 'week', 'month', 'year')
165
165
  * @param {Object} options - Additional options for relative time formatting
166
- * @param {string[]} [options.locales] - The locales to use for formatting
166
+ * @param {string | string[]} [options.locales] - The locales to use for formatting
167
167
  * @param {Intl.RelativeTimeFormatOptions} [options] - Additional Intl.RelativeTimeFormat options
168
168
  * @returns {string} The formatted relative time string
169
169
  *
@@ -172,7 +172,7 @@ export default class GT {
172
172
  * // Returns: "yesterday"
173
173
  */
174
174
  formatRelativeTime(value: number, unit: Intl.RelativeTimeFormatUnit, options?: {
175
- locales?: string[];
175
+ locales?: string | string[];
176
176
  } & Omit<Intl.RelativeTimeFormatOptions, 'locales'>): string;
177
177
  /**
178
178
  * Retrieves the display name of a locale code using Intl.DisplayNames.
@@ -199,16 +199,6 @@ export default class GT {
199
199
  * // Returns: "🇪🇸"
200
200
  */
201
201
  getLocaleEmoji(locale?: string | undefined): string;
202
- /**
203
- * Retrieves an emoji based on a given locale code, taking into account region, language, and specific exceptions.
204
- *
205
- * This function uses the locale's region (if present) to select an emoji or falls back on default emojis for certain languages.
206
- *
207
- * @param locale - A string representing the locale code (e.g., 'en-US', 'fr-CA').
208
- * @param {CustomMapping} [customMapping] - A custom mapping of locale codes to their names.
209
- * @returns The emoji representing the locale or its region, or a default emoji if no specific match is found.
210
- */
211
- static getLocaleEmoji(locale: string, customMapping?: CustomMapping): string;
212
202
  /**
213
203
  * Generates linguistic details for a given locale code.
214
204
  *
@@ -345,172 +335,197 @@ export default class GT {
345
335
  * // Returns: false
346
336
  */
347
337
  isSupersetLocale(superLocale: string, subLocale: string): boolean;
348
- static formatMessage(message: string, options?: {
349
- locales?: string[];
350
- variables?: FormatVariables;
351
- }): string;
352
- /**
353
- * Formats a number according to the specified locales and options.
354
- * @param {Object} params - The parameters for the number formatting.
355
- * @param {number} params.value - The number to format.
356
- * @param {Intl.NumberFormatOptions} [params.options] - Additional options for number formatting.
357
- * @param {string[]} [params.options.locales] - The locales to use for formatting.
358
- * @returns {string} The formatted number.
359
- */
360
- static formatNum(number: number, options: {
361
- locales: string[];
362
- } & Intl.NumberFormatOptions): string;
363
- /**
364
- * Formats a date according to the specified languages and options.
365
- * @param {Object} params - The parameters for the date formatting.
366
- * @param {Date} params.value - The date to format.
367
- * @param {Intl.DateTimeFormatOptions} [params.options] - Additional options for date formatting.
368
- * @param {string[]} [params.options.locales] - The languages to use for formatting.
369
- * @returns {string} The formatted date.
370
- */
371
- static formatDateTime(date: Date, options?: {
372
- locales?: string[];
373
- } & Intl.DateTimeFormatOptions): string;
374
- /**
375
- * Formats a currency value according to the specified languages, currency, and options.
376
- * @param {Object} params - The parameters for the currency formatting.
377
- * @param {number} params.value - The currency value to format.
378
- * @param {string} params.currency - The currency code (e.g., 'USD').
379
- * @param {Intl.NumberFormatOptions} [params.options={}] - Additional options for currency formatting.
380
- * @param {string[]} [params.options.locales] - The locale codes to use for formatting.
381
- * @returns {string} The formatted currency value.
382
- */
383
- static formatCurrency(value: number, currency: string, options: {
384
- locales: string[];
385
- } & Intl.NumberFormatOptions): string;
386
- /**
387
- * Formats a list of items according to the specified locales and options.
388
- * @param {Object} params - The parameters for the list formatting.
389
- * @param {Array<string | number>} params.value - The list of items to format.
390
- * @param {Intl.ListFormatOptions} [params.options={}] - Additional options for list formatting.
391
- * @param {string[]} [params.options.locales] - The locales to use for formatting.
392
- * @returns {string} The formatted list.
393
- */
394
- static formatList(array: Array<string | number>, options: {
395
- locales: string[];
396
- } & Intl.ListFormatOptions): string;
397
- /**
398
- * Formats a relative time value according to the specified locales and options.
399
- * @param {Object} params - The parameters for the relative time formatting.
400
- * @param {number} params.value - The relative time value to format.
401
- * @param {Intl.RelativeTimeFormatUnit} params.unit - The unit of time (e.g., 'second', 'minute', 'hour', 'day', 'week', 'month', 'year').
402
- * @param {Intl.RelativeTimeFormatOptions} [params.options={}] - Additional options for relative time formatting.
403
- * @param {string[]} [params.options.locales] - The locales to use for formatting.
404
- * @returns {string} The formatted relative time string.
405
- */
406
- static formatRelativeTime(value: number, unit: Intl.RelativeTimeFormatUnit, options: {
407
- locales: string[];
408
- } & Omit<Intl.RelativeTimeFormatOptions, 'locales'>): string;
409
- /**
410
- * Retrieves the display name of locale code using Intl.DisplayNames.
411
- *
412
- * @param {string} locale - A BCP-47 locale code.
413
- * @param {string} [defaultLocale] - The default locale to use for formatting.
414
- * @param {CustomMapping} [customMapping] - A custom mapping of locale codes to their names.
415
- * @returns {string} The display name corresponding to the code.
416
- */
417
- static getLocaleName(locale: string, defaultLocale?: string, customMapping?: CustomMapping): string;
418
- /**
419
- * Generates linguistic details for a given locale code.
420
- *
421
- * This function returns information about the locale,
422
- * script, and region of a given language code both in a standard form and in a maximized form (with likely script and region).
423
- * The function provides these names in both your default language and native forms, and an associated emoji.
424
- *
425
- * @param {string} locale - The locale code to get properties for (e.g., "de-AT").
426
- * @param {string} [defaultLocale] - The default locale to use for formatting.
427
- * @param {CustomMapping} [customMapping] - A custom mapping of locale codes to their names.
428
- * @returns {LocaleProperties} - An object containing detailed information about the locale.
429
- *
430
- * @property {string} code - The full locale code, e.g., "de-AT".
431
- * @property {string} name - Language name in the default display language, e.g., "Austrian German".
432
- * @property {string} nativeName - Language name in the locale's native language, e.g., "Österreichisches Deutsch".
433
- * @property {string} languageCode - The base language code, e.g., "de".
434
- * @property {string} languageName - The language name in the default display language, e.g., "German".
435
- * @property {string} nativeLanguageName - The language name in the native language, e.g., "Deutsch".
436
- * @property {string} nameWithRegionCode - Language name with region in the default language, e.g., "German (AT)".
437
- * @property {string} nativeNameWithRegionCode - Language name with region in the native language, e.g., "Deutsch (AT)".
438
- * @property {string} regionCode - The region code from maximization, e.g., "AT".
439
- * @property {string} regionName - The region name in the default display language, e.g., "Austria".
440
- * @property {string} nativeRegionName - The region name in the native language, e.g., "Österreich".
441
- * @property {string} scriptCode - The script code from maximization, e.g., "Latn".
442
- * @property {string} scriptName - The script name in the default display language, e.g., "Latin".
443
- * @property {string} nativeScriptName - The script name in the native language, e.g., "Lateinisch".
444
- * @property {string} maximizedCode - The maximized locale code, e.g., "de-Latn-AT".
445
- * @property {string} maximizedName - Maximized locale name with likely script in the default language, e.g., "Austrian German (Latin)".
446
- * @property {string} nativeMaximizedName - Maximized locale name in the native language, e.g., "Österreichisches Deutsch (Lateinisch)".
447
- * @property {string} minimizedCode - Minimized locale code, e.g., "de-AT" (or "de" for "de-DE").
448
- * @property {string} minimizedName - Minimized language name in the default language, e.g., "Austrian German".
449
- * @property {string} nativeMinimizedName - Minimized language name in the native language, e.g., "Österreichisches Deutsch".
450
- * @property {string} emoji - The emoji associated with the locale's region, if applicable.
451
- */
452
- static getLocaleProperties(locale: string, defaultLocale?: string, customMapping?: CustomMapping): LocaleProperties;
453
- /**
454
- * Determines whether a translation is required based on the source and target locales.
455
- *
456
- * - If the target locale is not specified, the function returns `false`, as translation is not needed.
457
- * - If the source and target locale are the same, returns `false`, indicating that no translation is necessary.
458
- * - If the `approvedLocales` array is provided, and the target locale is not within that array, the function also returns `false`.
459
- * - Otherwise, it returns `true`, meaning that a translation is required.
460
- *
461
- * @param {string} sourceLocale - The locale code for the original content (BCP 47 locale code).
462
- * @param {string} targetLocale - The locale code of the language to translate the content into (BCP 47 locale code).
463
- * @param {string[]} [approvedLocale] - An optional array of approved target locales.
464
- *
465
- * @returns {boolean} - Returns `true` if translation is required, otherwise `false`.
466
- */
467
- static requiresTranslation(sourceLocale: string, targetLocale: string, approvedLocales?: string[]): boolean;
468
- /**
469
- * Determines the best matching locale from the provided approved locales list.
470
- * @param {string | string[]} locales - A single locale or an array of locales sorted in preference order.
471
- * @param {string[]} [approvedLocales=this.locales] - An array of approved locales, also sorted by preference.
472
- * @returns {string | undefined} - The best matching locale from the approvedLocales list, or undefined if no match is found.
473
- */
474
- static determineLocale(locales: string | string[], approvedLocales?: string[] | undefined): string | undefined;
475
- /**
476
- * Get the text direction for a given locale code using the Intl.Locale API.
477
- *
478
- * @param {string} locale - A BCP-47 locale code.
479
- * @returns {string} - 'rtl' if the locale is right-to-left, otherwise 'ltr'.
480
- */
481
- static getLocaleDirection(locale: string): 'ltr' | 'rtl';
482
- /**
483
- * Checks if a given BCP 47 locale code is valid.
484
- * @param {string} locale - The BCP 47 locale code to validate.
485
- * @returns {boolean} True if the BCP 47 code is valid, false otherwise.
486
- */
487
- static isValidLocale(locale: string): boolean;
488
- /**
489
- * Standardizes a BCP 47 locale code to ensure correct formatting.
490
- * @param {string} locale - The BCP 47 locale code to standardize.
491
- * @returns {string} The standardized BCP 47 locale code or an empty string if it is an invalid code.
492
- */
493
- static standardizeLocale(locale: string): string;
494
- /**
495
- * Checks if multiple BCP 47 locale codes represent the same dialect.
496
- * @param {string[]} locales - The BCP 47 locale codes to compare.
497
- * @returns {boolean} True if all BCP 47 codes represent the same dialect, false otherwise.
498
- */
499
- static isSameDialect(...locales: (string | string[])[]): boolean;
500
- /**
501
- * Checks if multiple BCP 47 locale codes represent the same language.
502
- * @param {string[]} locales - The BCP 47 locale codes to compare.
503
- * @returns {boolean} True if all BCP 47 codes represent the same language, false otherwise.
504
- */
505
- static isSameLanguage(...locales: (string | string[])[]): boolean;
506
- /**
507
- * Checks if a locale is a superset of another locale.
508
- * A subLocale is a subset of superLocale if it is an extension of superLocale or are otherwise identical.
509
- *
510
- * @param {string} superLocale - The locale to check if it is a superset of the other locale.
511
- * @param {string} subLocale - The locale to check if it is a subset of the other locale.
512
- * @returns {boolean} True if the first locale is a superset of the second locale, false otherwise.
513
- */
514
- static isSupersetLocale(superLocale: string, subLocale: string): boolean;
515
338
  }
339
+ /**
340
+ * Formats a message according to the specified locales and options.
341
+ *
342
+ * @param {string} message - The message to format.
343
+ * @param {string | string[]} [locales='en'] - The locales to use for formatting.
344
+ * @param {FormatVariables} [variables={}] - The variables to use for formatting.
345
+ * @returns {string} The formatted message.
346
+ *
347
+ * @example
348
+ * formatMessage('Hello {name}', { name: 'John' });
349
+ * // Returns: "Hello John"
350
+ *
351
+ * formatMessage('Hello {name}', { name: 'John' }, { locales: ['fr'] });
352
+ * // Returns: "Bonjour John"
353
+ */
354
+ export declare function formatMessage(message: string, options?: {
355
+ locales?: string | string[];
356
+ variables?: FormatVariables;
357
+ }): string;
358
+ /**
359
+ * Formats a number according to the specified locales and options.
360
+ * @param {Object} params - The parameters for the number formatting.
361
+ * @param {number} params.value - The number to format.
362
+ * @param {Intl.NumberFormatOptions} [params.options] - Additional options for number formatting.
363
+ * @param {string | string[]} [params.options.locales] - The locales to use for formatting.
364
+ * @returns {string} The formatted number.
365
+ */
366
+ export declare function formatNum(number: number, options: {
367
+ locales: string | string[];
368
+ } & Intl.NumberFormatOptions): string;
369
+ /**
370
+ * Formats a date according to the specified languages and options.
371
+ * @param {Object} params - The parameters for the date formatting.
372
+ * @param {Date} params.value - The date to format.
373
+ * @param {Intl.DateTimeFormatOptions} [params.options] - Additional options for date formatting.
374
+ * @param {string | string[]} [params.options.locales] - The languages to use for formatting.
375
+ * @returns {string} The formatted date.
376
+ */
377
+ export declare function formatDateTime(date: Date, options?: {
378
+ locales?: string | string[];
379
+ } & Intl.DateTimeFormatOptions): string;
380
+ /**
381
+ * Formats a currency value according to the specified languages, currency, and options.
382
+ * @param {Object} params - The parameters for the currency formatting.
383
+ * @param {number} params.value - The currency value to format.
384
+ * @param {string} params.currency - The currency code (e.g., 'USD').
385
+ * @param {Intl.NumberFormatOptions} [params.options={}] - Additional options for currency formatting.
386
+ * @param {string | string[]} [params.options.locales] - The locale codes to use for formatting.
387
+ * @returns {string} The formatted currency value.
388
+ */
389
+ export declare function formatCurrency(value: number, currency: string, options: {
390
+ locales: string | string[];
391
+ } & Intl.NumberFormatOptions): string;
392
+ /**
393
+ * Formats a list of items according to the specified locales and options.
394
+ * @param {Object} params - The parameters for the list formatting.
395
+ * @param {Array<string | number>} params.value - The list of items to format.
396
+ * @param {Intl.ListFormatOptions} [params.options={}] - Additional options for list formatting.
397
+ * @param {string | string[]} [params.options.locales] - The locales to use for formatting.
398
+ * @returns {string} The formatted list.
399
+ */
400
+ export declare function formatList(array: Array<string | number>, options: {
401
+ locales: string | string[];
402
+ } & Intl.ListFormatOptions): string;
403
+ /**
404
+ * Formats a relative time value according to the specified locales and options.
405
+ * @param {Object} params - The parameters for the relative time formatting.
406
+ * @param {number} params.value - The relative time value to format.
407
+ * @param {Intl.RelativeTimeFormatUnit} params.unit - The unit of time (e.g., 'second', 'minute', 'hour', 'day', 'week', 'month', 'year').
408
+ * @param {Intl.RelativeTimeFormatOptions} [params.options={}] - Additional options for relative time formatting.
409
+ * @param {string | string[]} [params.options.locales] - The locales to use for formatting.
410
+ * @returns {string} The formatted relative time string.
411
+ */
412
+ export declare function formatRelativeTime(value: number, unit: Intl.RelativeTimeFormatUnit, options: {
413
+ locales: string | string[];
414
+ } & Omit<Intl.RelativeTimeFormatOptions, 'locales'>): string;
415
+ /**
416
+ * Retrieves the display name of locale code using Intl.DisplayNames.
417
+ *
418
+ * @param {string} locale - A BCP-47 locale code.
419
+ * @param {string} [defaultLocale] - The default locale to use for formatting.
420
+ * @param {CustomMapping} [customMapping] - A custom mapping of locale codes to their names.
421
+ * @returns {string} The display name corresponding to the code.
422
+ */
423
+ export declare function getLocaleName(locale: string, defaultLocale?: string, customMapping?: CustomMapping): string;
424
+ /**
425
+ * Retrieves an emoji based on a given locale code, taking into account region, language, and specific exceptions.
426
+ *
427
+ * This function uses the locale's region (if present) to select an emoji or falls back on default emojis for certain languages.
428
+ *
429
+ * @param locale - A string representing the locale code (e.g., 'en-US', 'fr-CA').
430
+ * @param {CustomMapping} [customMapping] - A custom mapping of locale codes to their names.
431
+ * @returns The emoji representing the locale or its region, or a default emoji if no specific match is found.
432
+ */
433
+ export declare function getLocaleEmoji(locale: string, customMapping?: CustomMapping): string;
434
+ /**
435
+ * Generates linguistic details for a given locale code.
436
+ *
437
+ * This function returns information about the locale,
438
+ * script, and region of a given language code both in a standard form and in a maximized form (with likely script and region).
439
+ * The function provides these names in both your default language and native forms, and an associated emoji.
440
+ *
441
+ * @param {string} locale - The locale code to get properties for (e.g., "de-AT").
442
+ * @param {string} [defaultLocale] - The default locale to use for formatting.
443
+ * @param {CustomMapping} [customMapping] - A custom mapping of locale codes to their names.
444
+ * @returns {LocaleProperties} - An object containing detailed information about the locale.
445
+ *
446
+ * @property {string} code - The full locale code, e.g., "de-AT".
447
+ * @property {string} name - Language name in the default display language, e.g., "Austrian German".
448
+ * @property {string} nativeName - Language name in the locale's native language, e.g., "Österreichisches Deutsch".
449
+ * @property {string} languageCode - The base language code, e.g., "de".
450
+ * @property {string} languageName - The language name in the default display language, e.g., "German".
451
+ * @property {string} nativeLanguageName - The language name in the native language, e.g., "Deutsch".
452
+ * @property {string} nameWithRegionCode - Language name with region in the default language, e.g., "German (AT)".
453
+ * @property {string} nativeNameWithRegionCode - Language name with region in the native language, e.g., "Deutsch (AT)".
454
+ * @property {string} regionCode - The region code from maximization, e.g., "AT".
455
+ * @property {string} regionName - The region name in the default display language, e.g., "Austria".
456
+ * @property {string} nativeRegionName - The region name in the native language, e.g., "Österreich".
457
+ * @property {string} scriptCode - The script code from maximization, e.g., "Latn".
458
+ * @property {string} scriptName - The script name in the default display language, e.g., "Latin".
459
+ * @property {string} nativeScriptName - The script name in the native language, e.g., "Lateinisch".
460
+ * @property {string} maximizedCode - The maximized locale code, e.g., "de-Latn-AT".
461
+ * @property {string} maximizedName - Maximized locale name with likely script in the default language, e.g., "Austrian German (Latin)".
462
+ * @property {string} nativeMaximizedName - Maximized locale name in the native language, e.g., "Österreichisches Deutsch (Lateinisch)".
463
+ * @property {string} minimizedCode - Minimized locale code, e.g., "de-AT" (or "de" for "de-DE").
464
+ * @property {string} minimizedName - Minimized language name in the default language, e.g., "Austrian German".
465
+ * @property {string} nativeMinimizedName - Minimized language name in the native language, e.g., "Österreichisches Deutsch".
466
+ * @property {string} emoji - The emoji associated with the locale's region, if applicable.
467
+ */
468
+ export declare function getLocaleProperties(locale: string, defaultLocale?: string, customMapping?: CustomMapping): LocaleProperties;
469
+ /**
470
+ * Determines whether a translation is required based on the source and target locales.
471
+ *
472
+ * - If the target locale is not specified, the function returns `false`, as translation is not needed.
473
+ * - If the source and target locale are the same, returns `false`, indicating that no translation is necessary.
474
+ * - If the `approvedLocales` array is provided, and the target locale is not within that array, the function also returns `false`.
475
+ * - Otherwise, it returns `true`, meaning that a translation is required.
476
+ *
477
+ * @param {string} sourceLocale - The locale code for the original content (BCP 47 locale code).
478
+ * @param {string} targetLocale - The locale code of the language to translate the content into (BCP 47 locale code).
479
+ * @param {string[]} [approvedLocale] - An optional array of approved target locales.
480
+ *
481
+ * @returns {boolean} - Returns `true` if translation is required, otherwise `false`.
482
+ */
483
+ export declare function requiresTranslation(sourceLocale: string, targetLocale: string, approvedLocales?: string[]): boolean;
484
+ /**
485
+ * Determines the best matching locale from the provided approved locales list.
486
+ * @param {string | string[]} locales - A single locale or an array of locales sorted in preference order.
487
+ * @param {string[]} [approvedLocales=this.locales] - An array of approved locales, also sorted by preference.
488
+ * @returns {string | undefined} - The best matching locale from the approvedLocales list, or undefined if no match is found.
489
+ */
490
+ export declare function determineLocale(locales: string | string[], approvedLocales?: string[] | undefined): string | undefined;
491
+ /**
492
+ * Get the text direction for a given locale code using the Intl.Locale API.
493
+ *
494
+ * @param {string} locale - A BCP-47 locale code.
495
+ * @returns {string} - 'rtl' if the locale is right-to-left, otherwise 'ltr'.
496
+ */
497
+ export declare function getLocaleDirection(locale: string): 'ltr' | 'rtl';
498
+ /**
499
+ * Checks if a given BCP 47 locale code is valid.
500
+ * @param {string} locale - The BCP 47 locale code to validate.
501
+ * @returns {boolean} True if the BCP 47 code is valid, false otherwise.
502
+ */
503
+ export declare function isValidLocale(locale: string): boolean;
504
+ /**
505
+ * Standardizes a BCP 47 locale code to ensure correct formatting.
506
+ * @param {string} locale - The BCP 47 locale code to standardize.
507
+ * @returns {string} The standardized BCP 47 locale code or an empty string if it is an invalid code.
508
+ */
509
+ export declare function standardizeLocale(locale: string): string;
510
+ /**
511
+ * Checks if multiple BCP 47 locale codes represent the same dialect.
512
+ * @param {string[]} locales - The BCP 47 locale codes to compare.
513
+ * @returns {boolean} True if all BCP 47 codes represent the same dialect, false otherwise.
514
+ */
515
+ export declare function isSameDialect(...locales: (string | string[])[]): boolean;
516
+ /**
517
+ * Checks if multiple BCP 47 locale codes represent the same language.
518
+ * @param {string[]} locales - The BCP 47 locale codes to compare.
519
+ * @returns {boolean} True if all BCP 47 codes represent the same language, false otherwise.
520
+ */
521
+ export declare function isSameLanguage(...locales: (string | string[])[]): boolean;
522
+ /**
523
+ * Checks if a locale is a superset of another locale.
524
+ * A subLocale is a subset of superLocale if it is an extension of superLocale or are otherwise identical.
525
+ *
526
+ * @param {string} superLocale - The locale to check if it is a superset of the other locale.
527
+ * @param {string} subLocale - The locale to check if it is a subset of the other locale.
528
+ * @returns {boolean} True if the first locale is a superset of the second locale, false otherwise.
529
+ */
530
+ export declare function isSupersetLocale(superLocale: string, subLocale: string): boolean;
516
531
  export {};