generaltranslation 8.2.10 → 8.2.11
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/core-3SOQ5ND6.cjs.map +1 -1
- package/dist/{core-CJMv4fMa.d.cts → core-6rY3oy32.d.cts} +2 -2
- package/dist/{core-DtPj_ruw.d.mts → core-BYVWty_t.d.mts} +2 -2
- package/dist/core-Bx0m6GOp.mjs.map +1 -1
- package/dist/core.d.cts +1 -1
- package/dist/core.d.mts +1 -1
- package/dist/id.d.cts +1 -1
- package/dist/id.d.mts +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/internal.cjs +1 -1
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +2 -2
- package/dist/internal.d.mts +2 -2
- package/dist/internal.mjs +1 -1
- package/dist/internal.mjs.map +1 -1
- package/dist/{types-Dfy_sRLD.d.mts → types-Cy8q2XZX.d.mts} +7 -4
- package/dist/{types-mZeu4HS3.d.cts → types-NKhpChvT.d.cts} +7 -4
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# generaltranslation
|
|
2
2
|
|
|
3
|
+
## 8.2.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1308](https://github.com/generaltranslation/gt/pull/1308) [`fecaf93`](https://github.com/generaltranslation/gt/commit/fecaf93d1dcae65598b3f81b8eeabaeb35be13c6) Thanks [@bgub](https://github.com/bgub)! - Add shared cache expiry, batching, and runtime translation configuration to I18nManager.
|
|
8
|
+
|
|
3
9
|
## 8.2.10
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-3SOQ5ND6.cjs","names":["intlCache","intlCache","intlCache","intlCache","intlCache","intlCache","IntlMessageFormat","intlCache","intlCache","intlCache"],"sources":["../src/locales/isValidLocale.ts","../src/locales/isSameDialect.ts","../src/locales/isSameLanguage.ts","../src/locales/requiresTranslation.ts","../src/locales/customLocaleMapping.ts","../src/locales/getLocaleEmoji.ts","../src/locales/getLocaleProperties.ts","../src/locales/determineLocale.ts","../src/logging/logger.ts","../src/formatting/format.ts","../src/locales/getLocaleName.ts","../src/locales/getLocaleDirection.ts","../src/locales/isSupersetLocale.ts","../src/locales/resolveAliasLocale.ts","../src/locales/resolveCanonicalLocale.ts","../src/LocaleConfig.ts","../src/core.ts"],"sourcesContent":["import { intlCache } from '../cache/IntlCache';\nimport { libraryDefaultLocale } from '../settings/settings';\nimport { CustomMapping } from './customLocaleMapping';\n\nconst scriptExceptions = ['Cham', 'Jamo', 'Kawi', 'Lisu', 'Toto', 'Thai'];\n\n//// According to BCP 47, the range qaa–qtz is reserved for private-use language codes\nconst isCustomLanguage = (language: string) => {\n return language >= 'qaa' && language <= 'qtz';\n};\n\n/**\n * Checks if a given BCP 47 language code is valid.\n * @param {string} code - The BCP 47 language code to validate.\n * @param {CustomMapping} [customMapping] - The custom mapping to use for validation.\n * @returns {boolean} True if the BCP 47 code is valid, false otherwise.\n * @internal\n */\nexport const _isValidLocale = (\n locale: string,\n customMapping?: CustomMapping\n): boolean => {\n // If in custom mapping, return true\n if (\n customMapping?.[locale] &&\n typeof customMapping[locale] === 'object' &&\n 'code' in (customMapping[locale] as Object) &&\n (customMapping[locale] as { code: string }).code\n ) {\n locale = (customMapping[locale] as { code: string }).code;\n }\n\n try {\n const { language, region, script } = intlCache.get('Locale', locale);\n if (\n locale.split('-').length !==\n (() => {\n let partCount = 1;\n if (region) partCount += 1;\n if (script) partCount += 1;\n return partCount;\n })()\n )\n return false;\n const displayLanguageNames = intlCache.get(\n 'DisplayNames',\n [libraryDefaultLocale],\n {\n type: 'language',\n }\n );\n if (\n displayLanguageNames.of(language) === language &&\n !isCustomLanguage(language)\n )\n return false;\n if (region) {\n const displayRegionNames = intlCache.get(\n 'DisplayNames',\n [libraryDefaultLocale],\n {\n type: 'region',\n }\n );\n if (displayRegionNames.of(region) === region) return false;\n }\n if (script) {\n const displayScriptNames = intlCache.get(\n 'DisplayNames',\n [libraryDefaultLocale],\n {\n type: 'script',\n }\n );\n if (\n displayScriptNames.of(script) === script &&\n !scriptExceptions.includes(script)\n )\n return false;\n }\n return true;\n } catch {\n return false;\n }\n};\n\n/**\n * Standardizes a BCP 47 locale to ensure correct formatting.\n * @param {string} locale - The BCP 47 locale to standardize.\n * @returns {string} The standardized BCP 47 locale, or an empty string if invalid.\n * @internal\n */\nexport const _standardizeLocale = (locale: string): string => {\n try {\n return Intl.getCanonicalLocales(locale)[0];\n } catch {\n return locale;\n }\n};\n","import { intlCache } from '../cache/IntlCache';\nimport { _standardizeLocale } from './isValidLocale';\n\nfunction checkTwoLocalesAreSameDialect(codeA: string, codeB: string) {\n const {\n language: languageA,\n region: regionA,\n script: scriptA,\n } = intlCache.get('Locale', codeA);\n const {\n language: languageB,\n region: regionB,\n script: scriptB,\n } = intlCache.get('Locale', codeB);\n if (languageA !== languageB) return false;\n if (regionA && regionB && regionA !== regionB) return false;\n if (scriptA && scriptB && scriptA !== scriptB) return false;\n return true;\n}\n\n/**\n * Test two or more language codes to determine if they are exactly the same\n * e.g. \"en-US\" and \"en\" would be exactly the same.\n * \"en-GB\" and \"en\" would be exactly the same.\n * \"en-GB\" and \"en-US\" would be different.\n * @internal\n */\nexport default function _isSameDialect(\n ...locales: (string | string[])[]\n): boolean {\n try {\n // standardize codes\n const flattenedCodes = locales.flat().map(_standardizeLocale);\n\n for (let i = 0; i < flattenedCodes.length; i++) {\n for (let j = i + 1; j < flattenedCodes.length; j++) {\n if (\n !checkTwoLocalesAreSameDialect(flattenedCodes[i], flattenedCodes[j])\n )\n return false;\n }\n }\n\n return true;\n } catch (error) {\n console.error(error);\n return false;\n }\n}\n","import { intlCache } from '../cache/IntlCache';\n\n/**\n * @internal\n */\nexport default function _isSameLanguage(\n ...locales: (string | string[])[]\n): boolean {\n try {\n const flattenedCodes = locales.flat();\n // Get the language for each code\n const languages = flattenedCodes.map(\n (locale) => intlCache.get('Locale', locale).language\n );\n return languages.every((language) => language === languages[0]);\n } catch (error) {\n console.error(error);\n return false;\n }\n}\n","import { CustomMapping } from './customLocaleMapping';\nimport _isSameDialect from './isSameDialect';\nimport _isSameLanguage from './isSameLanguage';\nimport { _isValidLocale } from './isValidLocale';\n\n/**\n * Given a target locale and a source locale, determines whether a translation is required\n * If the target locale and the source locale are the same, returns false, otherwise returns true\n * If a translation is not possible due to the target locale being outside of the optional approvedLanguages scope, also returns false\n * @internal\n */\nexport default function _requiresTranslation(\n sourceLocale: string,\n targetLocale: string,\n approvedLocales?: string[],\n customMapping?: CustomMapping\n): boolean {\n // If codes are invalid\n if (\n !_isValidLocale(sourceLocale, customMapping) ||\n !_isValidLocale(targetLocale, customMapping) ||\n (approvedLocales &&\n approvedLocales.some(\n (approvedLocale) => !_isValidLocale(approvedLocale, customMapping)\n ))\n ) {\n return false;\n }\n\n // Check if the languages are identical, if so, a translation is not required\n if (_isSameDialect(sourceLocale, targetLocale)) {\n return false;\n }\n\n // Check that the target locale is within the approvedLocales scope, if not, a translation is not required\n // isSameLanguage rather than checkTwoLocalesAreSameDialect so we can show different dialects as a fallback\n if (\n approvedLocales &&\n !approvedLocales.some((approvedLocale) =>\n _isSameLanguage(targetLocale, approvedLocale)\n )\n ) {\n return false;\n }\n // Otherwise, a translation is required!\n return true;\n}\n","import { LocaleProperties } from './getLocaleProperties';\nimport { _isValidLocale } from './isValidLocale';\n\nexport type FullCustomMapping = Record<string, LocaleProperties>;\nexport type CustomMapping = Record<string, string | Partial<LocaleProperties>>;\n\nexport const getCustomProperty = (\n customMapping: CustomMapping,\n locale: string,\n property: keyof LocaleProperties\n): string | undefined => {\n if (customMapping?.[locale]) {\n if (typeof customMapping[locale] === 'string') {\n return property === 'name' ? customMapping[locale] : undefined;\n }\n return customMapping[locale][property];\n }\n return undefined;\n};\n\n/**\n * Checks if a given locale should use the canonical locale.\n * @param locale - The locale to check if it should use the canonical locale\n * @param customMapping - The custom mapping to use for checking if the locale should use the canonical locale\n * @returns True if the locale should use the canonical locale, false otherwise\n */\nexport const shouldUseCanonicalLocale = (\n locale: string,\n customMapping: CustomMapping\n): boolean => {\n return !!(\n customMapping?.[locale] &&\n typeof customMapping[locale] === 'object' &&\n 'code' in (customMapping[locale] as Object) &&\n (customMapping[locale] as { code: string }).code &&\n _isValidLocale((customMapping[locale] as { code: string }).code)\n );\n};\n","import { intlCache } from '../cache/IntlCache';\nimport {\n getCustomProperty,\n shouldUseCanonicalLocale,\n type CustomMapping,\n} from './customLocaleMapping';\nimport { _standardizeLocale } from './isValidLocale';\n\n/**\n * @internal\n */\nexport default function _getLocaleEmoji(\n locale: string,\n customMapping?: CustomMapping\n): string {\n const aliasedLocale = locale;\n if (customMapping && shouldUseCanonicalLocale(locale, customMapping)) {\n locale = (customMapping[locale] as { code: string }).code;\n }\n\n try {\n const standardizedLocale = _standardizeLocale(locale);\n const localeObject = intlCache.get('Locale', standardizedLocale);\n const { language, region } = localeObject;\n\n if (customMapping) {\n for (const l of [aliasedLocale, locale, standardizedLocale, language]) {\n const customEmoji = getCustomProperty(customMapping, l, 'emoji');\n if (customEmoji) return customEmoji;\n }\n }\n\n const regionEmoji = region && getSupportedRegionEmoji(region);\n if (regionEmoji) return regionEmoji;\n\n const extrapolated = localeObject.maximize();\n\n return (\n exceptions[extrapolated.language] ||\n getRegionEmoji(extrapolated.region || '')\n );\n } catch {\n return defaultEmoji;\n }\n}\n\n// Default language emoji for when none else can be found\nconst europeAfricaGlobe = '🌍';\nconst asiaAustraliaGlobe = '🌏';\nexport const defaultEmoji = europeAfricaGlobe;\n\n// Exceptions to better reflect linguistic and cultural identities\nconst exceptions = {\n ca: europeAfricaGlobe,\n eu: europeAfricaGlobe,\n ku: europeAfricaGlobe,\n bo: asiaAustraliaGlobe,\n ug: asiaAustraliaGlobe,\n gd: '🏴',\n cy: '🏴',\n gv: '🇮🇲',\n grc: '🏺',\n} as Record<string, string>;\n\nconst specialRegionEmojis = {\n EU: '🇪🇺',\n '419': '🌎',\n} as Record<string, string>;\n\n// Regions with Unicode regional-indicator flag sequences.\nconst flagRegions = new Set([\n 'AF', // Afghanistan\n 'AX', // Åland Islands\n 'AL', // Albania\n 'DZ', // Algeria\n 'AS', // American Samoa\n 'AD', // Andorra\n 'AO', // Angola\n 'AI', // Anguilla\n 'AQ', // Antarctica\n 'AG', // Antigua and Barbuda\n 'AR', // Argentina\n 'AM', // Armenia\n 'AW', // Aruba\n 'AU', // Australia\n 'AT', // Austria\n 'AZ', // Azerbaijan\n 'BS', // Bahamas\n 'BH', // Bahrain\n 'BD', // Bangladesh\n 'BB', // Barbados\n 'BY', // Belarus\n 'BE', // Belgium\n 'BZ', // Belize\n 'BJ', // Benin\n 'BM', // Bermuda\n 'BT', // Bhutan\n 'BO', // Bolivia\n 'BQ', // Bonaire, Sint Eustatius and Saba\n 'BA', // Bosnia and Herzegovina\n 'BW', // Botswana\n 'BV', // Bouvet Island\n 'BR', // Brazil\n 'IO', // British Indian Ocean Territory\n 'BN', // Brunei Darussalam\n 'BG', // Bulgaria\n 'BF', // Burkina Faso\n 'BI', // Burundi\n 'CV', // Cabo Verde\n 'KH', // Cambodia\n 'CM', // Cameroon\n 'CA', // Canada\n 'KY', // Cayman Islands\n 'CF', // Central African Republic\n 'TD', // Chad\n 'CL', // Chile\n 'CN', // China\n 'CX', // Christmas Island\n 'CC', // Cocos (Keeling) Islands\n 'CO', // Colombia\n 'KM', // Comoros\n 'CD', // Congo (Democratic Republic)\n 'CG', // Congo (Republic)\n 'CK', // Cook Islands\n 'CR', // Costa Rica\n 'CI', // Côte d'Ivoire\n 'HR', // Croatia\n 'CU', // Cuba\n 'CW', // Curaçao\n 'CY', // Cyprus\n 'CZ', // Czechia\n 'DK', // Denmark\n 'DJ', // Djibouti\n 'DM', // Dominica\n 'DO', // Dominican Republic\n 'EC', // Ecuador\n 'EG', // Egypt\n 'SV', // El Salvador\n 'GQ', // Equatorial Guinea\n 'ER', // Eritrea\n 'EE', // Estonia\n 'SZ', // Eswatini\n 'ET', // Ethiopia\n 'FK', // Falkland Islands\n 'FO', // Faroe Islands\n 'FJ', // Fiji\n 'FI', // Finland\n 'FR', // France\n 'GF', // French Guiana\n 'PF', // French Polynesia\n 'TF', // French Southern Territories\n 'GA', // Gabon\n 'GM', // Gambia\n 'GE', // Georgia\n 'DE', // Germany\n 'GH', // Ghana\n 'GI', // Gibraltar\n 'GR', // Greece\n 'GL', // Greenland\n 'GD', // Grenada\n 'GP', // Guadeloupe\n 'GU', // Guam\n 'GT', // Guatemala\n 'GG', // Guernsey\n 'GN', // Guinea\n 'GW', // Guinea-Bissau\n 'GY', // Guyana\n 'HT', // Haiti\n 'HM', // Heard Island and McDonald Islands\n 'VA', // Holy See\n 'HN', // Honduras\n 'HK', // Hong Kong\n 'HU', // Hungary\n 'IS', // Iceland\n 'IN', // India\n 'ID', // Indonesia\n 'IR', // Iran\n 'IQ', // Iraq\n 'IE', // Ireland\n 'IM', // Isle of Man\n 'IL', // Israel\n 'IT', // Italy\n 'JM', // Jamaica\n 'JP', // Japan\n 'JE', // Jersey\n 'JO', // Jordan\n 'KZ', // Kazakhstan\n 'KE', // Kenya\n 'KI', // Kiribati\n 'KP', // Korea (North)\n 'KR', // Korea (South)\n 'KW', // Kuwait\n 'KG', // Kyrgyzstan\n 'LA', // Laos\n 'LV', // Latvia\n 'LB', // Lebanon\n 'LS', // Lesotho\n 'LR', // Liberia\n 'LY', // Libya\n 'LI', // Liechtenstein\n 'LT', // Lithuania\n 'LU', // Luxembourg\n 'MO', // Macao\n 'MG', // Madagascar\n 'MW', // Malawi\n 'MY', // Malaysia\n 'MV', // Maldives\n 'ML', // Mali\n 'MT', // Malta\n 'MH', // Marshall Islands\n 'MQ', // Martinique\n 'MR', // Mauritania\n 'MU', // Mauritius\n 'YT', // Mayotte\n 'MX', // Mexico\n 'FM', // Micronesia\n 'MD', // Moldova\n 'MC', // Monaco\n 'MN', // Mongolia\n 'ME', // Montenegro\n 'MS', // Montserrat\n 'MA', // Morocco\n 'MZ', // Mozambique\n 'MM', // Myanmar\n 'NA', // Namibia\n 'NR', // Nauru\n 'NP', // Nepal\n 'NL', // Netherlands\n 'NC', // New Caledonia\n 'NZ', // New Zealand\n 'NI', // Nicaragua\n 'NE', // Niger\n 'NG', // Nigeria\n 'NU', // Niue\n 'NF', // Norfolk Island\n 'MK', // North Macedonia\n 'MP', // Northern Mariana Islands\n 'NO', // Norway\n 'OM', // Oman\n 'PK', // Pakistan\n 'PW', // Palau\n 'PS', // Palestine, State of\n 'PA', // Panama\n 'PG', // Papua New Guinea\n 'PY', // Paraguay\n 'PE', // Peru\n 'PH', // Philippines\n 'PN', // Pitcairn\n 'PL', // Poland\n 'PT', // Portugal\n 'PR', // Puerto Rico\n 'QA', // Qatar\n 'RE', // Réunion\n 'RO', // Romania\n 'RU', // Russian Federation\n 'RW', // Rwanda\n 'BL', // Saint Barthélemy\n 'SH', // Saint Helena, Ascension and Tristan da Cunha\n 'KN', // Saint Kitts and Nevis\n 'LC', // Saint Lucia\n 'MF', // Saint Martin (French part)\n 'PM', // Saint Pierre and Miquelon\n 'VC', // Saint Vincent and the Grenadines\n 'WS', // Samoa\n 'SM', // San Marino\n 'ST', // São Tomé and Príncipe\n 'SA', // Saudi Arabia\n 'SN', // Senegal\n 'RS', // Serbia\n 'SC', // Seychelles\n 'SL', // Sierra Leone\n 'SG', // Singapore\n 'SX', // Sint Maarten (Dutch part)\n 'SK', // Slovakia\n 'SI', // Slovenia\n 'SB', // Solomon Islands\n 'SO', // Somalia\n 'ZA', // South Africa\n 'GS', // South Georgia and the South Sandwich Islands\n 'SS', // South Sudan\n 'ES', // Spain\n 'LK', // Sri Lanka\n 'SD', // Sudan\n 'SR', // Suriname\n 'SJ', // Svalbard and Jan Mayen\n 'SE', // Sweden\n 'CH', // Switzerland\n 'SY', // Syrian Arab Republic\n 'TW', // Taiwan\n 'TJ', // Tajikistan\n 'TZ', // Tanzania\n 'TH', // Thailand\n 'TL', // Timor-Leste\n 'TG', // Togo\n 'TK', // Tokelau\n 'TO', // Tonga\n 'TT', // Trinidad and Tobago\n 'TN', // Tunisia\n 'TR', // Türkiye\n 'TM', // Turkmenistan\n 'TC', // Turks and Caicos Islands\n 'TV', // Tuvalu\n 'UG', // Uganda\n 'UA', // Ukraine\n 'AE', // United Arab Emirates\n 'GB', // United Kingdom\n 'US', // United States of America\n 'UM', // United States Minor Outlying Islands\n 'UY', // Uruguay\n 'UZ', // Uzbekistan\n 'VU', // Vanuatu\n 'VE', // Venezuela\n 'VN', // Viet Nam\n 'VG', // Virgin Islands (British)\n 'VI', // Virgin Islands (U.S.)\n 'WF', // Wallis and Futuna\n 'EH', // Western Sahara\n 'YE', // Yemen\n 'ZM', // Zambia\n 'ZW', // Zimbabwe\n]);\n\nconst regionalIndicatorOffset = 0x1f1e6 - 'A'.charCodeAt(0);\n\nexport function getRegionEmoji(region: string): string {\n return getSupportedRegionEmoji(region) || defaultEmoji;\n}\n\nfunction getSupportedRegionEmoji(region: string): string | undefined {\n const normalizedRegion = region.toUpperCase();\n const specialEmoji = specialRegionEmojis[normalizedRegion];\n if (specialEmoji) return specialEmoji;\n\n if (!flagRegions.has(normalizedRegion)) return undefined;\n\n return String.fromCodePoint(\n normalizedRegion.charCodeAt(0) + regionalIndicatorOffset,\n normalizedRegion.charCodeAt(1) + regionalIndicatorOffset\n );\n}\n","import { libraryDefaultLocale } from '../settings/settings';\nimport { defaultEmoji } from './getLocaleEmoji';\nimport { _isValidLocale, _standardizeLocale } from './isValidLocale';\nimport _getLocaleEmoji from './getLocaleEmoji';\nimport { intlCache } from '../cache/IntlCache';\nimport { CustomMapping, shouldUseCanonicalLocale } from './customLocaleMapping';\n\nexport type LocaleProperties = {\n // assume code = \"de-AT\", defaultLocale = \"en-US\"\n\n code: string; // \"de-AT\"\n name: string; // \"Austrian German\"\n nativeName: string; // \"Österreichisches Deutsch\"\n\n languageCode: string; // \"de\"\n languageName: string; // \"German\"\n nativeLanguageName: string; // \"Deutsch\"\n\n // note that maximize() is NOT called here!\n\n nameWithRegionCode: string; // \"German (AT)\"\n nativeNameWithRegionCode: string; // \"Deutsch (AT)\"\n\n // for most likely script and region, maximize() is called\n\n regionCode: string; // \"AT\"\n regionName: string; // \"Austria\"\n nativeRegionName: string; // Österreich\n\n scriptCode: string; // \"Latn\"\n scriptName: string; // \"Latin\"\n nativeScriptName: string; // \"Lateinisch\"\n\n maximizedCode: string; // \"de-Latn-AT\"\n maximizedName: string; // \"Austrian German (Latin)\"\n nativeMaximizedName: string; // Österreichisches Deutsch (Lateinisch)\n\n minimizedCode: string; // \"de-AT\", but for \"de-DE\" it would just be \"de\"\n minimizedName: string; // \"\"Austrian German\";\n nativeMinimizedName: string; // \"Österreichisches Deutsch\"\n\n // Emoji depending on region code\n // In order not to accidentally spark international conflict, some emojis are hard-coded\n emoji: string;\n};\n\n/**\n * Creates a set of custom locale properties from a custom mapping.\n *\n * @param lArray - An array of locale codes to search for in the custom mapping.\n * @param customMapping - Optional custom mapping of locale codes to names.\n * @returns A partial set of locale properties, or undefined if no custom mapping is provided.\n */\nexport function createCustomLocaleProperties(\n lArray: string[],\n customMapping?: CustomMapping\n): Partial<LocaleProperties> | undefined {\n if (customMapping) {\n let merged: Partial<LocaleProperties> = {};\n for (const l of lArray) {\n const value = customMapping[l];\n if (value) {\n if (typeof value === 'string') {\n merged.name ||= value;\n } else if (value) {\n merged = { ...value, ...merged };\n }\n }\n }\n return merged;\n }\n return undefined;\n}\n\n/**\n * @internal\n */\nexport default function _getLocaleProperties(\n locale: string,\n defaultLocale: string = libraryDefaultLocale,\n customMapping?: CustomMapping\n): LocaleProperties {\n // Check for canonical locale\n const aliasedLocale = locale;\n if (customMapping && shouldUseCanonicalLocale(locale, customMapping)) {\n // Override locale with canonical locale\n locale = (customMapping[locale] as { code: string }).code;\n }\n\n defaultLocale ||= libraryDefaultLocale;\n\n try {\n const standardizedLocale = _standardizeLocale(locale); // \"de-AT\"\n\n const localeObject = intlCache.get('Locale', locale);\n const languageCode = localeObject.language; // \"de\"\n\n const customLocaleProperties = createCustomLocaleProperties(\n [aliasedLocale, locale, standardizedLocale, languageCode],\n customMapping\n );\n\n const baseRegion = localeObject.region; // \"AT\"\n\n const maximizedLocale = localeObject.maximize();\n const maximizedCode = maximizedLocale.toString(); // \"de-Latn-AT\"\n const regionCode =\n localeObject.region ||\n customLocaleProperties?.regionCode ||\n maximizedLocale.region ||\n ''; // \"AT\"\n const scriptCode =\n localeObject.script ||\n customLocaleProperties?.scriptCode ||\n maximizedLocale.script ||\n ''; // \"Latn\"\n\n const minimizedLocale = localeObject.minimize();\n const minimizedCode = minimizedLocale.toString(); // \"de-AT\"\n\n // Language names (default and native)\n\n const defaultLanguageOrder = [defaultLocale, locale, libraryDefaultLocale];\n const nativeLanguageOrder = [locale, defaultLocale, libraryDefaultLocale];\n\n const languageNames = intlCache.get('DisplayNames', defaultLanguageOrder, {\n type: 'language',\n });\n const nativeLanguageNames = intlCache.get(\n 'DisplayNames',\n nativeLanguageOrder,\n { type: 'language' }\n );\n\n const customName = customLocaleProperties?.name;\n const customNativeName =\n customLocaleProperties?.nativeName || customLocaleProperties?.name;\n\n const name = customName || languageNames.of(locale) || locale; // \"Austrian German\"\n const nativeName =\n customNativeName || nativeLanguageNames.of(locale) || locale; // \"Österreichisches Deutsch\"\n\n const maximizedName =\n customLocaleProperties?.maximizedName ||\n customName ||\n languageNames.of(maximizedCode) ||\n locale; // \"Austrian German (Latin)\"\n const nativeMaximizedName =\n customLocaleProperties?.nativeMaximizedName ||\n customNativeName ||\n nativeLanguageNames.of(maximizedCode) ||\n locale; // \"Österreichisches Deutsch (Lateinisch)\"\n\n const minimizedName =\n customLocaleProperties?.minimizedName ||\n customName ||\n languageNames.of(minimizedCode) ||\n locale; // \"Austrian German\", but for \"de-DE\" would just be \"German\"\n const nativeMinimizedName =\n customLocaleProperties?.nativeMinimizedName ||\n customNativeName ||\n nativeLanguageNames.of(minimizedCode) ||\n locale; // \"Österreichisches Deutsch\", but for \"de-DE\" would just be \"Deutsch\"\n\n const languageName =\n customLocaleProperties?.languageName ||\n customName ||\n languageNames.of(languageCode) ||\n locale; // \"German\"\n const nativeLanguageName =\n customLocaleProperties?.nativeLanguageName ||\n customNativeName ||\n nativeLanguageNames.of(languageCode) ||\n locale; // \"Deutsch\"\n\n const nameWithRegionCode =\n customLocaleProperties?.nameWithRegionCode || baseRegion\n ? `${languageName} (${baseRegion})`\n : name; // German (AT)\n const nativeNameWithRegionCode =\n customLocaleProperties?.nativeNameWithRegionCode ||\n (baseRegion ? `${nativeLanguageName} (${baseRegion})` : nativeName) ||\n nameWithRegionCode; // \"Deutsch (AT)\"\n\n // Region names (default and native)\n\n const regionNames = intlCache.get('DisplayNames', defaultLanguageOrder, {\n type: 'region',\n });\n const nativeRegionNames = intlCache.get(\n 'DisplayNames',\n nativeLanguageOrder,\n { type: 'region' }\n );\n\n const regionName =\n customLocaleProperties?.regionName ||\n (regionCode ? regionNames.of(regionCode) : '') ||\n ''; // \"Austria\"\n const nativeRegionName =\n customLocaleProperties?.nativeRegionName ||\n (regionCode ? nativeRegionNames.of(regionCode) : '') ||\n ''; // \"Österreich\"\n\n // Script names (default and native)\n\n const scriptNames = intlCache.get('DisplayNames', defaultLanguageOrder, {\n type: 'script',\n });\n const nativeScriptNames = intlCache.get(\n 'DisplayNames',\n nativeLanguageOrder,\n { type: 'script' }\n );\n\n const scriptName =\n customLocaleProperties?.scriptName ||\n (scriptCode ? scriptNames.of(scriptCode) : '') ||\n ''; // \"Latin\"\n const nativeScriptName =\n customLocaleProperties?.nativeScriptName ||\n (scriptCode ? nativeScriptNames.of(scriptCode) : '') ||\n ''; // \"Lateinisch\"\n\n // Emoji\n\n const emoji =\n customLocaleProperties?.emoji ||\n _getLocaleEmoji(standardizedLocale, customMapping);\n\n return {\n code: standardizedLocale,\n name,\n nativeName,\n maximizedCode,\n maximizedName,\n nativeMaximizedName,\n minimizedCode,\n minimizedName,\n nativeMinimizedName,\n languageCode,\n languageName,\n nativeLanguageName,\n nameWithRegionCode,\n nativeNameWithRegionCode,\n regionCode,\n regionName,\n nativeRegionName,\n scriptCode,\n scriptName,\n nativeScriptName,\n emoji,\n };\n } catch {\n let code = _isValidLocale(locale) ? _standardizeLocale(locale) : locale;\n const codeParts = code?.split('-');\n let languageCode = codeParts?.[0] || code || '';\n let regionCode =\n codeParts.length > 2 ? codeParts?.[2] : codeParts?.[1] || '';\n let scriptCode = codeParts?.[3] || '';\n\n const customLocaleProperties = createCustomLocaleProperties(\n [code, languageCode],\n customMapping\n );\n\n code = customLocaleProperties?.code || code;\n const name = customLocaleProperties?.name || code;\n const nativeName = customLocaleProperties?.nativeName || name;\n\n const maximizedCode = customLocaleProperties?.maximizedCode || code;\n const maximizedName = customLocaleProperties?.maximizedName || name;\n const nativeMaximizedName =\n customLocaleProperties?.nativeMaximizedName || nativeName;\n\n const minimizedCode = customLocaleProperties?.minimizedCode || code;\n const minimizedName = customLocaleProperties?.minimizedName || name;\n const nativeMinimizedName =\n customLocaleProperties?.nativeMinimizedName || nativeName;\n\n languageCode = customLocaleProperties?.languageCode || languageCode;\n const languageName = customLocaleProperties?.languageName || name;\n const nativeLanguageName =\n customLocaleProperties?.nativeLanguageName || nativeName;\n\n regionCode = customLocaleProperties?.regionCode || regionCode;\n const regionName = customLocaleProperties?.regionName || '';\n const nativeRegionName = customLocaleProperties?.nativeRegionName || '';\n\n scriptCode = customLocaleProperties?.scriptCode || scriptCode;\n const scriptName = customLocaleProperties?.scriptName || '';\n const nativeScriptName = customLocaleProperties?.nativeScriptName || '';\n\n const nameWithRegionCode =\n customLocaleProperties?.nameWithRegionCode ||\n (regionName ? `${languageName} (${regionName})` : name);\n const nativeNameWithRegionCode =\n customLocaleProperties?.nativeNameWithRegionCode ||\n (nativeRegionName\n ? `${nativeLanguageName} (${nativeRegionName})`\n : nativeName);\n\n const emoji = customLocaleProperties?.emoji || defaultEmoji;\n\n return {\n code,\n name,\n nativeName,\n maximizedCode,\n maximizedName,\n nativeMaximizedName,\n minimizedCode,\n minimizedName,\n nativeMinimizedName,\n languageCode,\n languageName,\n nativeLanguageName,\n nameWithRegionCode,\n nativeNameWithRegionCode,\n regionCode,\n regionName,\n nativeRegionName,\n scriptCode,\n scriptName,\n nativeScriptName,\n emoji,\n };\n }\n}\n","import { _isValidLocale, _standardizeLocale } from './isValidLocale';\nimport _isSameLanguage from './isSameLanguage';\nimport _isSameDialect from './isSameDialect';\nimport _getLocaleProperties from './getLocaleProperties';\nimport { CustomMapping } from './customLocaleMapping';\n\n/**\n * Given a list of locales and a list of approved locales, sorted in preference order\n * Determines which locale is the best match among the approved locales, prioritizing exact matches and falling back to dialects of the same language\n * @internal\n */\nexport default function _determineLocale(\n locales: string | string[],\n approvedLocales: string[],\n customMapping?: CustomMapping\n): string | undefined {\n if (typeof locales === 'string') locales = [locales];\n locales = locales\n .filter((locale) => _isValidLocale(locale, customMapping))\n .map(_standardizeLocale);\n approvedLocales = approvedLocales\n .filter((locale) => _isValidLocale(locale, customMapping))\n .map(_standardizeLocale);\n for (const locale of locales) {\n const candidates = approvedLocales.filter((approvedLocale) =>\n _isSameLanguage(locale, approvedLocale)\n );\n const getMatchingCode = ({\n locale,\n languageCode,\n minimizedCode,\n regionCode,\n scriptCode,\n }: {\n locale: string;\n languageCode: string;\n minimizedCode: string;\n regionCode: string;\n scriptCode: string;\n }) => {\n const locales = [\n locale, // If the full locale is supported under this language category\n `${languageCode}-${regionCode}`, // Attempt to match parts\n `${languageCode}-${scriptCode}`,\n minimizedCode, // If a minimized variant of this locale is supported\n ];\n for (const l of locales) {\n if (candidates.includes(l)) return l;\n }\n return null;\n };\n const { languageCode, ...codes } = _getLocaleProperties(locale);\n const matchingCode =\n getMatchingCode({ locale, languageCode, ...codes }) ||\n getMatchingCode({\n locale: languageCode,\n ..._getLocaleProperties(languageCode),\n });\n if (matchingCode) return matchingCode;\n }\n return undefined;\n}\n","/**\n * Comprehensive logging system for the General Translation library\n * Provides structured logging with multiple levels and configurable output\n */\n\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'off';\n\nexport interface LogEntry {\n level: LogLevel;\n message: string;\n timestamp: Date;\n context?: string;\n metadata?: Record<string, any>;\n}\n\nexport interface LoggerConfig {\n /** Minimum log level to output */\n level: LogLevel;\n /** Whether to include timestamps in log output */\n includeTimestamp: boolean;\n /** Whether to include context information */\n includeContext: boolean;\n /** Custom prefix for all log messages */\n prefix?: string;\n /** Whether to output to console (default: true) */\n enableConsole: boolean;\n /** Custom log handlers */\n handlers?: LogHandler[];\n}\n\nexport interface LogHandler {\n handle(entry: LogEntry): void;\n}\n\nconst LOG_LEVELS: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n off: 4,\n};\n\nconst LOG_COLORS: Record<LogLevel, string> = {\n debug: '\\x1b[36m', // Cyan\n info: '\\x1b[32m', // Green\n warn: '\\x1b[33m', // Yellow\n error: '\\x1b[31m', // Red\n off: '', // No color needed since 'off' level logs are never displayed\n};\n\nconst RESET_COLOR = '\\x1b[0m';\n\n/**\n * Get the configured log level from environment variable or default to 'warn'\n */\nfunction getConfiguredLogLevel(): LogLevel {\n if (typeof process !== 'undefined' && process.env?._GT_LOG_LEVEL) {\n const envLevel = process.env._GT_LOG_LEVEL.toLowerCase();\n if (envLevel in LOG_LEVELS) {\n return envLevel as LogLevel;\n }\n }\n return 'warn';\n}\n\n/**\n * Console log handler that outputs formatted messages to console\n */\nexport class ConsoleLogHandler implements LogHandler {\n private config: LoggerConfig;\n\n constructor(config: LoggerConfig) {\n this.config = config;\n }\n\n handle(entry: LogEntry): void {\n const parts: string[] = [];\n\n // Add timestamp if enabled\n if (this.config.includeTimestamp) {\n parts.push(`[${entry.timestamp.toISOString()}]`);\n }\n\n // Add level with color\n const colorCode = LOG_COLORS[entry.level];\n const levelText = `[${entry.level.toUpperCase()}]`;\n parts.push(`${colorCode}${levelText}${RESET_COLOR}`);\n\n // Add prefix if configured\n if (this.config.prefix) {\n parts.push(`[${this.config.prefix}]`);\n }\n\n // Add context if available and enabled\n if (this.config.includeContext && entry.context) {\n parts.push(`[${entry.context}]`);\n }\n\n // Add the main message\n parts.push(entry.message);\n\n // Format metadata if available\n if (entry.metadata && Object.keys(entry.metadata).length > 0) {\n parts.push(`\\n Metadata: ${JSON.stringify(entry.metadata, null, 2)}`);\n }\n\n const formattedMessage = parts.join(' ');\n\n // Output to appropriate console method based on level\n switch (entry.level) {\n case 'debug':\n console.debug(formattedMessage);\n break;\n case 'info':\n console.info(formattedMessage);\n break;\n case 'warn':\n console.warn(formattedMessage);\n break;\n case 'error':\n console.error(formattedMessage);\n break;\n }\n }\n}\n\n/**\n * Main Logger class providing structured logging capabilities\n */\nexport class Logger {\n private config: LoggerConfig;\n private handlers: LogHandler[];\n\n constructor(config: Partial<LoggerConfig> = {}) {\n this.config = {\n level: getConfiguredLogLevel(),\n includeTimestamp: true,\n includeContext: true,\n enableConsole: true,\n handlers: [],\n ...config,\n };\n\n this.handlers = [...(this.config.handlers || [])];\n\n // Add console handler if enabled\n if (this.config.enableConsole) {\n this.handlers.push(new ConsoleLogHandler(this.config));\n }\n }\n\n /**\n * Add a custom log handler\n */\n addHandler(handler: LogHandler): void {\n this.handlers.push(handler);\n }\n\n /**\n * Remove a log handler\n */\n removeHandler(handler: LogHandler): void {\n const index = this.handlers.indexOf(handler);\n if (index > -1) {\n this.handlers.splice(index, 1);\n }\n }\n\n /**\n * Update logger configuration\n */\n configure(config: Partial<LoggerConfig>): void {\n this.config = { ...this.config, ...config };\n }\n\n /**\n * Check if a log level should be output based on current configuration\n */\n private shouldLog(level: LogLevel): boolean {\n return LOG_LEVELS[level] >= LOG_LEVELS[this.config.level];\n }\n\n /**\n * Internal logging method that creates log entries and passes them to handlers\n */\n private log(\n level: LogLevel,\n message: string,\n context?: string,\n metadata?: Record<string, any>\n ): void {\n if (!this.shouldLog(level)) {\n return;\n }\n\n const entry: LogEntry = {\n level,\n message,\n timestamp: new Date(),\n context,\n metadata,\n };\n\n // Pass to all handlers\n this.handlers.forEach((handler) => {\n try {\n handler.handle(entry);\n } catch (error) {\n // Prevent logging errors from breaking the application\n console.error('Error in log handler:', error);\n }\n });\n }\n\n /**\n * Log a debug message\n * Used for detailed diagnostic information, typically of interest only when diagnosing problems\n */\n debug(\n message: string,\n context?: string,\n metadata?: Record<string, any>\n ): void {\n this.log('debug', message, context, metadata);\n }\n\n /**\n * Log an info message\n * Used for general information about application operation\n */\n info(\n message: string,\n context?: string,\n metadata?: Record<string, any>\n ): void {\n this.log('info', message, context, metadata);\n }\n\n /**\n * Log a warning message\n * Used for potentially problematic situations that don't prevent operation\n */\n warn(\n message: string,\n context?: string,\n metadata?: Record<string, any>\n ): void {\n this.log('warn', message, context, metadata);\n }\n\n /**\n * Log an error message\n * Used for error events that might still allow the application to continue\n */\n error(\n message: string,\n context?: string,\n metadata?: Record<string, any>\n ): void {\n this.log('error', message, context, metadata);\n }\n\n /**\n * Create a child logger with a specific context\n */\n child(context: string): ContextLogger {\n return new ContextLogger(this, context);\n }\n\n /**\n * Get current logger configuration\n */\n getConfig(): LoggerConfig {\n return { ...this.config };\n }\n}\n\n/**\n * Context logger that automatically includes context information\n */\nexport class ContextLogger {\n private logger: Logger;\n private context: string;\n\n constructor(logger: Logger, context: string) {\n this.logger = logger;\n this.context = context;\n }\n\n debug(message: string, metadata?: Record<string, any>): void {\n this.logger.debug(message, this.context, metadata);\n }\n\n info(message: string, metadata?: Record<string, any>): void {\n this.logger.info(message, this.context, metadata);\n }\n\n warn(message: string, metadata?: Record<string, any>): void {\n this.logger.warn(message, this.context, metadata);\n }\n\n error(message: string, metadata?: Record<string, any>): void {\n this.logger.error(message, this.context, metadata);\n }\n\n child(childContext: string): ContextLogger {\n return new ContextLogger(this.logger, `${this.context}:${childContext}`);\n }\n}\n\n// Default logger instance\nexport const defaultLogger = new Logger({\n level: getConfiguredLogLevel(),\n includeTimestamp: true,\n includeContext: true,\n prefix: 'GT',\n});\n\n// Convenience functions using the default logger\nexport const debug = (\n message: string,\n context?: string,\n metadata?: Record<string, any>\n) => defaultLogger.debug(message, context, metadata);\n\nexport const info = (\n message: string,\n context?: string,\n metadata?: Record<string, any>\n) => defaultLogger.info(message, context, metadata);\n\nexport const warn = (\n message: string,\n context?: string,\n metadata?: Record<string, any>\n) => defaultLogger.warn(message, context, metadata);\n\nexport const error = (\n message: string,\n context?: string,\n metadata?: Record<string, any>\n) => defaultLogger.error(message, context, metadata);\n\n// Create context-specific loggers for different parts of the system\nexport const fetchLogger = defaultLogger.child('fetch');\nexport const validationLogger = defaultLogger.child('validation');\nexport const formattingLogger = defaultLogger.child('formatting');\nexport const localeLogger = defaultLogger.child('locale');\nexport const gtInstanceLogger = defaultLogger.child('GT instance');\n\n// Export types and classes\nexport { Logger as GTLogger };\n","import { FormatVariables, I18nextMessage } from '../types';\nimport { intlCache } from '../cache/IntlCache';\nimport { libraryDefaultLocale } from '../settings/settings';\nimport { IntlMessageFormat } from 'intl-messageformat';\nimport { formatI18nextWarning, formatJsxWarning } from '../logging/warnings';\nimport { formattingLogger } from '../logging/logger';\nimport { JsxChildren } from '../types';\nimport {\n CutoffFormatOptions,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars\n CutoffFormatStyle,\n} from './custom-formats/CutoffFormat/types';\n\n/**\n * Formats a string value with cutoff behavior according to the specified locales and options.\n *\n * @param {Object} params - The parameters for the cutoff formatting.\n * @param {string} params.value - The string value to format with cutoff behavior.\n * @param {string | string[]} [params.locales='en'] - The locales to use for formatting.\n * @param {CutoffFormatOptions} [params.options={}] - Additional options for cutoff formatting.\n * @param {number} [params.options.maxChars] - The maximum number of characters to display.\n * @param {CutoffFormatStyle} [params.options.style='ellipsis'] - The style of the terminator.\n * @param {string} [params.options.terminator] - Optional override for the terminator to use.\n * @param {string} [params.options.separator] - Optional override for the separator between terminator and value.\n *\n * @returns {string} The formatted string with terminator applied if cutoff occurs.\n * @internal\n *\n * @example\n * _formatCutoff({ value: 'Hello, world!', options: { maxChars: 8 } }); // Returns 'Hello, w...'\n *\n * Will fallback to an empty string if formatting fails.\n */\nexport function _formatCutoff({\n value,\n locales = libraryDefaultLocale,\n options = {},\n}: {\n value: string;\n locales?: string | string[];\n options?: CutoffFormatOptions;\n}): string {\n return intlCache.get('CutoffFormat', locales, options).format(value);\n}\n\n/**\n * Formats a message according to the specified locales and options.\n *\n * @param {string} message - The message to format.\n * @param {string | string[]} [locales='en'] - The locales to use for formatting.\n * @param {Record<string, any>} [variables={}] - The variables to use for formatting.\n * @returns {string} The formatted message.\n * @internal\n *\n * Will fallback to an empty string\n * TODO: add this to custom formats\n */\nexport function _formatMessageICU(\n message: string,\n locales: string | string[] = libraryDefaultLocale,\n variables: FormatVariables = {}\n): string {\n const messageFormat = new IntlMessageFormat(message, locales);\n return messageFormat.format(variables)?.toString() ?? '';\n}\n\n/**\n * Returns the message as-is without any formatting.\n *\n * @param {string} message - The message to return.\n * @returns {string} The original message, unchanged.\n * @internal\n *\n * TODO: add this to custom formats\n */\nexport function _formatMessageString(message: string): string {\n return message;\n}\n\n/**\n * Formats a number according to the specified locales and options.\n *\n * @param {Object} params - The parameters for the number formatting.\n * @param {number} params.value - The number to format.\n * @param {string | string[]} [params.locales=['en']] - The locales to use for formatting.\n * @param {Intl.NumberFormatOptions} [params.options={}] - Additional options for number formatting.\n *\n * @returns {string} The formatted number.\n * @internal\n */\nexport function _formatNum({\n value,\n locales = [libraryDefaultLocale],\n options = {},\n}: {\n value: number;\n locales?: string | string[];\n options?: Intl.NumberFormatOptions;\n}): string {\n const res = intlCache\n .get('NumberFormat', locales, {\n numberingSystem: 'latn',\n ...options,\n })\n .format(value);\n return res;\n}\n\n/**\n * Formats a date according to the specified locales and options.\n *\n * @param {Object} params - The parameters for the date formatting.\n * @param {Date} params.value - The date to format.\n * @param {string | string[]} [params.locales='en'] - The locales to use for formatting.\n * @param {Intl.DateTimeFormatOptions} [params.options={}] - Additional options for date formatting.\n *\n * @returns {string} The formatted date.\n * @internal\n */\nexport function _formatDateTime({\n value,\n locales = [libraryDefaultLocale],\n options = {},\n}: {\n value: Date;\n locales?: string | string[];\n options?: Intl.DateTimeFormatOptions;\n}): string {\n return intlCache\n .get('DateTimeFormat', locales, {\n calendar: 'gregory',\n numberingSystem: 'latn',\n ...options,\n })\n .format(value);\n}\n\n/**\n * Formats a currency value according to the specified locales, currency, and options.\n *\n * @param {Object} params - The parameters for the currency formatting.\n * @param {number} params.value - The currency value to format.\n * @param {string} params.currency - The currency code (e.g., 'USD').\n * @param {string | string[]} [params.locales=['en']] - The locales to use for formatting.\n * @param {Intl.NumberFormatOptions} [params.options={}] - Additional options for currency formatting.\n *\n * @returns {string} The formatted currency value.\n * @internal\n */\n\nexport function _formatCurrency({\n value,\n locales = [libraryDefaultLocale],\n currency = 'USD',\n options = {},\n}: {\n value: number;\n currency?: string;\n locales?: string | string[];\n options?: Intl.NumberFormatOptions;\n}): string {\n return intlCache\n .get('NumberFormat', locales, {\n style: 'currency',\n currency,\n numberingSystem: 'latn',\n ...options,\n })\n .format(value);\n}\n\n/**\n * Formats a list of items according to the specified locales and options.\n *\n * @param {Object} params - The parameters for the list formatting.\n * @param {Array<string | number>} params.value - The list of items to format.\n * @param {string | string[]} [params.locales=['en']] - The locales to use for formatting.\n * @param {Intl.ListFormatOptions} [params.options={}] - Additional options for list formatting.\n *\n * @returns {string} The formatted list.\n * @internal\n */\nexport function _formatList({\n value,\n locales = [libraryDefaultLocale],\n options = {},\n}: {\n value: Array<any>;\n locales?: string | string[];\n options?: Intl.ListFormatOptions;\n}): string {\n return intlCache\n .get('ListFormat', locales, {\n type: 'conjunction', // Default type, can be overridden via options\n style: 'long', // Default style, can be overridden via options\n ...options,\n })\n .format(value);\n}\n\n/**\n * Formats a list of items according to the specified locales and options.\n * @param {Object} params - The parameters for the list formatting.\n * @param {Array<T>} params.value - The list of items to format.\n * @param {string | string[]} [params.locales=['en']] - The locales to use for formatting.\n * @param {Intl.ListFormatOptions} [params.options={}] - Additional options for list formatting.\n * @returns {Array<T | string>} The formatted list parts.\n * @internal\n */\nexport function _formatListToParts<T>({\n value,\n locales = [libraryDefaultLocale],\n options = {},\n}: {\n value: Array<T>;\n locales?: string | string[];\n options?: Intl.ListFormatOptions;\n}) {\n const formatListParts = intlCache\n .get('ListFormat', locales, {\n type: 'conjunction', // Default type, can be overridden via options\n style: 'long', // Default style, can be overridden via options\n ...options,\n })\n .formatToParts(value.map(() => '1'));\n let partIndex = 0;\n return formatListParts.map((part) => {\n if (part.type === 'element') return value[partIndex++];\n return part.value;\n });\n}\n\n/**\n * Selects the best unit and computes the value for relative time formatting\n * based on the difference between a date and a base date.\n * @param {Date} date - The target date.\n * @param {Date} baseDate - The base date to compute relative time from. Must be provided by the caller for hydration safety.\n * @returns {{ value: number, unit: Intl.RelativeTimeFormatUnit }} The computed value and unit.\n * @internal\n */\nexport function _selectRelativeTimeUnit(\n date: Date,\n baseDate: Date\n): {\n value: number;\n unit: Intl.RelativeTimeFormatUnit;\n} {\n const now = baseDate.getTime();\n const diffMs = date.getTime() - now;\n const absDiffMs = Math.abs(diffMs);\n const sign = diffMs < 0 ? -1 : 1;\n\n // Use Math.floor to avoid confusing jumps near boundaries\n // (e.g. 3.5 days rounding to \"1 week ago\" instead of \"3 days ago\")\n const seconds = Math.floor(absDiffMs / 1000);\n const minutes = Math.floor(absDiffMs / (1000 * 60));\n const hours = Math.floor(absDiffMs / (1000 * 60 * 60));\n const days = Math.floor(absDiffMs / (1000 * 60 * 60 * 24));\n const weeks = Math.floor(absDiffMs / (1000 * 60 * 60 * 24 * 7));\n const months = Math.floor(absDiffMs / (1000 * 60 * 60 * 24 * 30));\n const years = Math.floor(absDiffMs / (1000 * 60 * 60 * 24 * 365));\n\n if (seconds < 60) return { value: sign * seconds, unit: 'second' };\n if (minutes < 60) return { value: sign * minutes, unit: 'minute' };\n if (hours < 24) return { value: sign * hours, unit: 'hour' };\n if (days < 7) return { value: sign * days, unit: 'day' };\n if (days < 28) return { value: sign * weeks, unit: 'week' };\n if (months < 1) return { value: sign * weeks, unit: 'week' };\n if (months < 12) return { value: sign * months, unit: 'month' };\n if (years < 1) return { value: sign * months, unit: 'month' };\n return { value: sign * years, unit: 'year' };\n}\n\n/**\n * Formats a relative time from a Date, automatically selecting the best unit.\n * @internal\n */\nexport function _formatRelativeTimeFromDate({\n date,\n baseDate,\n locales = [libraryDefaultLocale],\n options = {},\n}: {\n date: Date;\n baseDate: Date;\n locales?: string | string[];\n options?: Intl.RelativeTimeFormatOptions;\n}): string {\n const { value, unit } = _selectRelativeTimeUnit(date, baseDate);\n return _formatRelativeTime({ value, unit, locales, options });\n}\n\n/**\n * Formats a relative time value according to the specified locales and options.\n *\n * @param {Object} params - The parameters for the relative time formatting.\n * @param {number} params.value - The relative time value to format.\n * @param {Intl.RelativeTimeFormatUnit} params.unit - The unit of time (e.g., 'second', 'minute', 'hour', 'day', 'week', 'month', 'year').\n * @param {string | string[]} [params.locales=['en']] - The locales to use for formatting.\n * @param {Intl.RelativeTimeFormatOptions} [params.options={}] - Additional options for relative time formatting.\n *\n * @returns {string} The formatted relative time string.\n * @internal\n */\nexport function _formatRelativeTime({\n value,\n unit,\n locales = [libraryDefaultLocale],\n options = {},\n}: {\n value: number;\n unit: Intl.RelativeTimeFormatUnit;\n locales?: string | string[];\n options?: Intl.RelativeTimeFormatOptions;\n}): string {\n return intlCache\n .get('RelativeTimeFormat', locales, {\n style: 'long',\n numeric: 'auto',\n ...options,\n })\n .format(value, unit);\n}\n\n/**\n * @experimental This function is not currently supported but will be implemented in a future version.\n * Use {@link _formatMessageICU} for current ICU message format support.\n * Formats an I18next message according to the specified locales and options.\n *\n * @param message - The I18next message to format.\n * @param variables - The variables to use for formatting.\n * @returns The formatted I18next message.\n * @internal\n */\nexport function _formatI18next(\n message: I18nextMessage,\n // eslint-disable-next-line no-unused-vars\n _variables: FormatVariables = {}\n): string {\n formattingLogger.warn(formatI18nextWarning);\n return message;\n}\n\n/**\n * @experimental This function is not currently supported but will be implemented in a future version.\n * Use {@link _formatMessageICU} for current ICU message format support.\n * Formats a JSX message according to the specified locales and options.\n *\n * @param message - The JSX message to format.\n * @param variables - The variables to use for formatting.\n * @returns The formatted JSX message.\n * @internal\n */\nexport function _formatJsx(\n message: JsxChildren,\n // eslint-disable-next-line no-unused-vars\n _variables: FormatVariables = {}\n): JsxChildren {\n formattingLogger.warn(formatJsxWarning);\n return message;\n}\n","import { intlCache } from '../cache/IntlCache';\nimport { libraryDefaultLocale } from '../settings/settings';\nimport {\n CustomMapping,\n getCustomProperty,\n shouldUseCanonicalLocale,\n} from './customLocaleMapping';\nimport { _standardizeLocale } from './isValidLocale';\n\n/**\n * Retrieves the display name(s) of locale code(s) using Intl.DisplayNames.\n *\n * @param {string} locale - A BCP-47 locale code.\n * @param {string} [defaultLocale=libraryDefaultLocale] - The locale for display names.\n * @returns {string} The display name(s) corresponding to the code(s), or empty string(s) if invalid.\n * @internal\n */\nexport function _getLocaleName(\n locale: string,\n defaultLocale: string = libraryDefaultLocale,\n customMapping?: CustomMapping\n): string {\n // Check for canonical locale\n const aliasedLocale = locale;\n if (customMapping && shouldUseCanonicalLocale(locale, customMapping)) {\n // Override locale with canonical locale\n locale = (customMapping[locale] as { code: string }).code;\n }\n\n defaultLocale ||= libraryDefaultLocale;\n try {\n const standardizedLocale = _standardizeLocale(locale);\n if (customMapping) {\n for (const l of [\n aliasedLocale,\n locale,\n standardizedLocale,\n intlCache.get('Locale', standardizedLocale).language,\n ]) {\n const customName = getCustomProperty(customMapping, l, 'name');\n if (customName) return customName;\n }\n }\n const displayNames = intlCache.get(\n 'DisplayNames',\n [defaultLocale, standardizedLocale, libraryDefaultLocale], // default locale order\n { type: 'language' }\n );\n return displayNames.of(standardizedLocale) || '';\n } catch {\n // In case Intl.DisplayNames construction fails, return empty string(s)\n return '';\n }\n}\n","import { intlCache } from '../cache/IntlCache';\nimport _getLocaleProperties from './getLocaleProperties';\n\n/**\n * Get the text direction for a given locale code using the Intl.Locale API.\n *\n * @param {string} code - The locale code to check.\n * @returns {string} - 'rtl' if the language is right-to-left, otherwise 'ltr'.\n * @internal\n */\nexport function _getLocaleDirection(code: string): 'ltr' | 'rtl' {\n // Extract via textInfo property\n try {\n const locale = intlCache.get('Locale', code);\n const textInfoDirection = extractDirectionWithTextInfo(locale);\n if (textInfoDirection) {\n return textInfoDirection;\n }\n } catch {\n // silent\n }\n\n // Fallback to simple heuristics\n const { scriptCode, languageCode } = _getLocaleProperties(code);\n\n // Handle RTL script or language\n if (scriptCode) return isRtlScript(scriptCode) ? 'rtl' : 'ltr';\n if (languageCode) return isRtlLanguage(languageCode) ? 'rtl' : 'ltr';\n\n return 'ltr';\n}\n\n// ===== HELPER CONSTANTS ===== //\n\nconst RTL_SCRIPTS = new Set([\n 'arab',\n 'adlm',\n 'hebr',\n 'nkoo',\n 'rohg',\n 'samr',\n 'syrc',\n 'thaa',\n 'yezi',\n]);\n\nconst RTL_LANGUAGES = new Set([\n 'ar',\n 'arc',\n 'ckb',\n 'dv',\n 'fa',\n 'he',\n 'iw',\n 'ku',\n 'lrc',\n 'nqo',\n 'ps',\n 'pnb',\n 'sd',\n 'syr',\n 'ug',\n 'ur',\n 'yi',\n]);\n\n// ===== HELPER FUNCTIONS ===== //\n\n/**\n * Handles extracting direction via textInfo property\n * @param Locale - Intl.Locale object\n * @returns {'ltr' | 'rtl'} - The direction of the locale\n *\n * Intl.Locale.prototype.getTextInfo() / textInfo property incorporated in ES2024 Specification.\n * This is not supported by all browsers yet.\n * See: {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo#browser_compatibility}\n */\nfunction extractDirectionWithTextInfo(\n locale: Intl.Locale\n): 'ltr' | 'rtl' | undefined {\n if (\n 'textInfo' in locale &&\n typeof locale.textInfo === 'object' &&\n locale.textInfo !== null &&\n 'direction' in locale.textInfo &&\n (locale.textInfo?.direction === 'rtl' ||\n locale.textInfo?.direction === 'ltr')\n ) {\n return locale.textInfo?.direction;\n }\n\n return undefined;\n}\n\nfunction isRtlScript(script: string | undefined): boolean {\n return script ? RTL_SCRIPTS.has(script.toLowerCase()) : false;\n}\n\nfunction isRtlLanguage(language: string | undefined): boolean {\n return language ? RTL_LANGUAGES.has(language.toLowerCase()) : false;\n}\n","import { intlCache } from '../cache/IntlCache';\nimport { _standardizeLocale } from './isValidLocale';\n\n/**\n * @internal\n */\nexport default function _isSupersetLocale(\n superLocale: string,\n subLocale: string\n): boolean {\n try {\n const {\n language: languageSuper,\n region: regionSuper,\n script: scriptSuper,\n } = intlCache.get('Locale', _standardizeLocale(superLocale));\n const {\n language: languageSub,\n region: regionSub,\n script: scriptSub,\n } = intlCache.get('Locale', _standardizeLocale(subLocale));\n\n if (languageSuper !== languageSub) return false;\n if (regionSuper && regionSuper !== regionSub) return false;\n if (scriptSuper && scriptSuper !== scriptSub) return false;\n\n return true;\n } catch (error) {\n console.error(error);\n return false;\n }\n}\n","import { CustomMapping } from './customLocaleMapping';\n\n/**\n * Resolves the alias locale for a given locale.\n * @param locale - The locale to resolve the alias locale for\n * @param customMapping - The custom mapping to use for resolving the alias locale\n * @returns The alias locale\n */\nexport function _resolveAliasLocale(\n locale: string,\n customMapping?: CustomMapping\n): string {\n let reverseCustomMapping: Record<string, string> | undefined;\n if (customMapping) {\n reverseCustomMapping = Object.fromEntries(\n Object.entries(customMapping)\n .filter(\n ([, value]) => value && typeof value === 'object' && 'code' in value\n )\n .map(([key, value]) => [(value as { code: string }).code, key])\n );\n }\n\n return reverseCustomMapping?.[locale] || locale;\n}\n","import { shouldUseCanonicalLocale } from './customLocaleMapping';\nimport { CustomMapping } from './customLocaleMapping';\n\n/**\n * Resolves the canonical locale for a given locale.\n * @param locale - The locale to resolve the canonical locale for\n * @param customMapping - The custom mapping to use for resolving the canonical locale\n * @returns The canonical locale\n */\nexport function _resolveCanonicalLocale(\n locale: string,\n customMapping?: CustomMapping\n): string {\n if (customMapping && shouldUseCanonicalLocale(locale, customMapping)) {\n return (customMapping[locale] as { code: string }).code;\n }\n\n return locale;\n}\n","import {\n _formatCurrency,\n _formatCutoff,\n _formatDateTime,\n _formatList,\n _formatListToParts,\n _formatMessageICU,\n _formatMessageString,\n _formatNum,\n _formatRelativeTime,\n _formatRelativeTimeFromDate,\n} from './formatting/format';\nimport _requiresTranslation from './locales/requiresTranslation';\nimport _determineLocale from './locales/determineLocale';\nimport _isSameLanguage from './locales/isSameLanguage';\nimport _getLocaleProperties from './locales/getLocaleProperties';\nimport _getLocaleEmoji from './locales/getLocaleEmoji';\nimport { _isValidLocale, _standardizeLocale } from './locales/isValidLocale';\nimport { _getLocaleName } from './locales/getLocaleName';\nimport { _getLocaleDirection } from './locales/getLocaleDirection';\nimport { libraryDefaultLocale } from './settings/settings';\nimport _isSameDialect from './locales/isSameDialect';\nimport _isSupersetLocale from './locales/isSupersetLocale';\nimport { CustomMapping, FormatVariables } from './types';\nimport { _resolveAliasLocale } from './locales/resolveAliasLocale';\nimport { _resolveCanonicalLocale } from './locales/resolveCanonicalLocale';\nimport { CutoffFormatOptions } from './formatting/custom-formats/CutoffFormat/types';\nimport { StringFormat } from './types-dir/jsx/content';\n\nexport type LocaleConfigConstructorParams = {\n defaultLocale?: string;\n locales?: string[];\n customMapping?: CustomMapping;\n};\n\ntype LocalesOption = {\n locales?: string | string[];\n};\n\ntype WithLocales<T = object> = T & LocalesOption;\n\n/**\n * LocaleConfig contains the locale and formatting primitives exposed through\n * the core entrypoint.\n *\n * It intentionally does not store project IDs, API keys, runtime URLs, or any\n * translation credentials. It only stores locale metadata needed to resolve\n * aliases, choose formatting fallbacks, and format values with Intl.\n */\nexport class LocaleConfig {\n readonly defaultLocale: string;\n readonly locales: string[];\n readonly customMapping?: CustomMapping;\n\n constructor({\n defaultLocale = libraryDefaultLocale,\n locales = [],\n customMapping,\n }: LocaleConfigConstructorParams = {}) {\n this.defaultLocale = defaultLocale;\n this.locales = locales;\n this.customMapping = customMapping;\n }\n\n private get translationLocales() {\n return this.locales.length ? this.locales : undefined;\n }\n\n private resolveCanonicalLocaleList(locales: string[]) {\n return locales.map((locale) => this.resolveCanonicalLocale(locale));\n }\n\n private resolveCanonicalLocaleArgs(locales: (string | string[])[]) {\n return locales.map((locale) =>\n Array.isArray(locale)\n ? this.resolveCanonicalLocaleList(locale)\n : this.resolveCanonicalLocale(locale)\n );\n }\n\n private toLocaleList(locales: string | string[]) {\n return Array.isArray(locales) ? locales : [locales];\n }\n\n private getFormattingLocales(\n targetLocale?: string,\n locales?: string | string[]\n ) {\n const localeList =\n locales !== undefined\n ? this.toLocaleList(locales)\n : [targetLocale, this.defaultLocale, libraryDefaultLocale];\n\n return localeList\n .filter((locale): locale is string => !!locale)\n .map((locale) => this.resolveCanonicalLocale(locale));\n }\n\n formatNum(\n value: number,\n targetLocale?: string,\n options: WithLocales<Intl.NumberFormatOptions> = {}\n ) {\n const { locales, ...intlOptions } = options;\n return _formatNum({\n value,\n locales: this.getFormattingLocales(targetLocale, locales),\n options: intlOptions,\n });\n }\n\n formatDateTime(\n value: Date,\n targetLocale?: string,\n options: WithLocales<Intl.DateTimeFormatOptions> = {}\n ) {\n const { locales, ...intlOptions } = options;\n return _formatDateTime({\n value,\n locales: this.getFormattingLocales(targetLocale, locales),\n options: intlOptions,\n });\n }\n\n formatCurrency(\n value: number,\n currency: string,\n targetLocale?: string,\n options: WithLocales<Intl.NumberFormatOptions> = {}\n ) {\n const { locales, ...intlOptions } = options;\n return _formatCurrency({\n value,\n currency,\n locales: this.getFormattingLocales(targetLocale, locales),\n options: intlOptions,\n });\n }\n\n formatRelativeTime(\n value: number,\n unit: Intl.RelativeTimeFormatUnit,\n targetLocale?: string,\n options: WithLocales<Intl.RelativeTimeFormatOptions> = {}\n ) {\n const { locales, ...intlOptions } = options;\n return _formatRelativeTime({\n value,\n unit,\n locales: this.getFormattingLocales(targetLocale, locales),\n options: intlOptions,\n });\n }\n\n formatRelativeTimeFromDate(\n date: Date,\n targetLocale?: string,\n options: WithLocales<\n Intl.RelativeTimeFormatOptions & { baseDate?: Date }\n > = {}\n ) {\n const { locales, baseDate, ...intlOptions } = options;\n return _formatRelativeTimeFromDate({\n date,\n baseDate: baseDate ?? new Date(),\n locales: this.getFormattingLocales(targetLocale, locales),\n options: intlOptions,\n });\n }\n\n formatCutoff(\n value: string,\n targetLocale?: string,\n options: WithLocales<CutoffFormatOptions> = {}\n ) {\n const { locales, ...formatOptions } = options;\n return _formatCutoff({\n value,\n locales: this.getFormattingLocales(targetLocale, locales),\n options: formatOptions,\n });\n }\n\n formatMessage(\n message: string,\n targetLocale?: string,\n options: WithLocales<{\n variables?: FormatVariables;\n dataFormat?: StringFormat;\n }> = {}\n ) {\n const { locales, variables, dataFormat } = options;\n if (dataFormat === 'STRING') return _formatMessageString(message);\n return _formatMessageICU(\n message,\n this.getFormattingLocales(targetLocale, locales),\n variables\n );\n }\n\n formatList(\n array: Array<string | number>,\n targetLocale?: string,\n options: WithLocales<Intl.ListFormatOptions> = {}\n ) {\n const { locales, ...intlOptions } = options;\n return _formatList({\n value: array,\n locales: this.getFormattingLocales(targetLocale, locales),\n options: intlOptions,\n });\n }\n\n formatListToParts<T>(\n array: Array<T>,\n targetLocale?: string,\n options: WithLocales<Intl.ListFormatOptions> = {}\n ) {\n const { locales, ...intlOptions } = options;\n return _formatListToParts<T>({\n value: array,\n locales: this.getFormattingLocales(targetLocale, locales),\n options: intlOptions,\n });\n }\n\n getLocaleName(locale: string) {\n return _getLocaleName(locale, this.defaultLocale, this.customMapping);\n }\n\n getLocaleEmoji(locale: string) {\n return _getLocaleEmoji(locale, this.customMapping);\n }\n\n getLocaleProperties(locale: string) {\n return _getLocaleProperties(locale, this.defaultLocale, this.customMapping);\n }\n\n requiresTranslation(\n targetLocale: string,\n sourceLocale: string = this.defaultLocale,\n approvedLocales: string[] | undefined = this.translationLocales\n ) {\n return _requiresTranslation(\n this.resolveCanonicalLocale(sourceLocale),\n this.resolveCanonicalLocale(targetLocale),\n approvedLocales\n ? this.resolveCanonicalLocaleList(approvedLocales)\n : undefined,\n this.customMapping\n );\n }\n\n determineLocale(\n locales: string | string[],\n approvedLocales: string[] = this.locales\n ) {\n const approvedLocalePairs = approvedLocales.map((locale) => ({\n locale,\n canonicalLocale: this.resolveCanonicalLocale(locale),\n }));\n const resolvedLocale = _determineLocale(\n Array.isArray(locales)\n ? this.resolveCanonicalLocaleList(locales)\n : this.resolveCanonicalLocale(locales),\n approvedLocalePairs.map(({ canonicalLocale }) => canonicalLocale),\n this.customMapping\n );\n if (!resolvedLocale) return undefined;\n return (\n approvedLocalePairs.find(\n ({ canonicalLocale }) => canonicalLocale === resolvedLocale\n )?.locale || this.resolveAliasLocale(resolvedLocale)\n );\n }\n\n getLocaleDirection(locale: string) {\n return _getLocaleDirection(this.resolveCanonicalLocale(locale));\n }\n\n isValidLocale(locale: string) {\n return _isValidLocale(locale, this.customMapping);\n }\n\n resolveCanonicalLocale(locale: string) {\n return _resolveCanonicalLocale(locale, this.customMapping);\n }\n\n resolveAliasLocale(locale: string) {\n return _resolveAliasLocale(locale, this.customMapping);\n }\n\n standardizeLocale(locale: string) {\n return _standardizeLocale(locale);\n }\n\n isSameDialect(...locales: (string | string[])[]) {\n return _isSameDialect(...this.resolveCanonicalLocaleArgs(locales));\n }\n\n isSameLanguage(...locales: (string | string[])[]) {\n return _isSameLanguage(...this.resolveCanonicalLocaleArgs(locales));\n }\n\n isSupersetLocale(superLocale: string, subLocale: string) {\n return _isSupersetLocale(\n this.resolveCanonicalLocale(superLocale),\n this.resolveCanonicalLocale(subLocale)\n );\n }\n}\n","import {\n _formatCutoff,\n _formatMessageICU,\n _formatMessageString,\n} from './formatting/format';\nimport type { CutoffFormatOptions } from './formatting/custom-formats/CutoffFormat/types';\nimport { _isValidLocale, _standardizeLocale } from './locales/isValidLocale';\nimport { _resolveCanonicalLocale } from './locales/resolveCanonicalLocale';\nimport type { CustomMapping, FormatVariables } from './types';\nimport type { StringFormat } from './types-dir/jsx/content';\n\nexport {\n LocaleConfig,\n type LocaleConfigConstructorParams,\n} from './LocaleConfig';\n\n/**\n * Core formatting and locale helpers.\n *\n * This entry point exposes deterministic locale and formatting primitives. It\n * does not export the GT service client, project credentials, network\n * translation methods, file APIs, or other server/service concerns from the\n * root `generaltranslation` facade.\n *\n * This entry point is intended for framework and shared packages that need\n * locale metadata or formatting behavior without pulling in the full\n * translation API surface.\n */\n\n/**\n * Formats a string with cutoff behavior, applying a terminator when the string exceeds the maximum character limit.\n *\n * This standalone function provides cutoff formatting functionality without requiring a GT instance.\n * The locales parameter is required for proper terminator selection based on the target language.\n *\n * @param {string} value - The string value to format with cutoff behavior.\n * @param {Object} [options] - Configuration options for cutoff formatting.\n * @param {string | string[]} [options.locales] - The locales to use for terminator selection.\n * @param {number} [options.maxChars] - The maximum number of characters to display.\n * - Undefined values are treated as no cutoff.\n * - Negative values follow .slice() behavior and terminator will be added before the value.\n * - 0 will result in an empty string.\n * - If cutoff results in an empty string, no terminator is added.\n * @param {CutoffFormatStyle} [options.style='ellipsis'] - The style of the terminator.\n * @param {string} [options.terminator] - Optional override the terminator to use.\n * @param {string} [options.separator] - Optional override the separator to use between the terminator and the value.\n * - If no terminator is provided, then separator is ignored.\n * @returns {string} The formatted string with terminator applied if cutoff occurs.\n *\n * @example\n * formatCutoff('Hello, world!', { locales: 'en-US', maxChars: 8 });\n * // Returns: 'Hello, …'\n *\n * @example\n * formatCutoff('Hello, world!', { locales: 'en-US', maxChars: -3 });\n * // Returns: '…d!'\n *\n * @example\n * formatCutoff('Very long text that needs cutting', {\n * locales: 'en-US',\n * maxChars: 15,\n * style: 'ellipsis',\n * separator: ' '\n * });\n * // Returns: 'Very long tex …'\n */\nexport function formatCutoff(\n value: string,\n options?: {\n locales?: string | string[];\n } & CutoffFormatOptions\n) {\n return _formatCutoff({ value, locales: options?.locales, options });\n}\n\n/**\n * Formats a message according to the specified locales and options.\n *\n * @param {string} message - The message to format.\n * @param {Object} [options] - Configuration options for message formatting.\n * @param {string | string[]} [options.locales] - The locales to use for formatting.\n * @param {FormatVariables} [options.variables] - The variables to use for formatting.\n * @param {StringFormat} [options.dataFormat='ICU'] - The format of the message. When STRING, the message is returned as is.\n * @returns {string} The formatted message.\n *\n * @example\n * formatMessage('Hello {name}', { variables: { name: 'John' } });\n * // Returns: \"Hello John\"\n *\n * @example\n * formatMessage('Hello {name}', {\n * locales: ['fr'],\n * variables: { name: 'John' }\n * });\n */\nexport function formatMessage(\n message: string,\n options?: {\n locales?: string | string[];\n variables?: FormatVariables;\n dataFormat?: StringFormat;\n }\n) {\n switch (options?.dataFormat) {\n case 'STRING':\n return _formatMessageString(message);\n default:\n return _formatMessageICU(message, options?.locales, options?.variables);\n }\n}\n\n/**\n * Checks if a given BCP 47 locale code is valid.\n *\n * @param {string} locale - The BCP 47 locale code to validate.\n * @param {CustomMapping} [customMapping] - The custom mapping to use for validation.\n * @returns {boolean} True if the BCP 47 code is valid, false otherwise.\n *\n * @example\n * isValidLocale('en-US');\n * // Returns: true\n *\n * @example\n * isValidLocale('en_US');\n * // Returns: false\n */\nexport function isValidLocale(locale: string, customMapping?: CustomMapping) {\n return _isValidLocale(locale, customMapping);\n}\n\n/**\n * Resolves the canonical locale for a given locale.\n *\n * @param {string} locale - The locale to resolve the canonical locale for.\n * @param {CustomMapping} [customMapping] - The custom mapping to use for resolving the canonical locale.\n * @returns {string} The canonical locale.\n *\n * @example\n * resolveCanonicalLocale('en-US');\n * // Returns: 'en-US'\n *\n * @example\n * resolveCanonicalLocale('en', { en: 'en-US' });\n * // Returns: 'en-US'\n */\nexport function resolveCanonicalLocale(\n locale: string,\n customMapping?: CustomMapping\n) {\n return _resolveCanonicalLocale(locale, customMapping);\n}\n\n/**\n * Standardizes a BCP 47 locale code to ensure correct formatting.\n *\n * @param {string} locale - The BCP 47 locale code to standardize.\n * @returns {string} The standardized BCP 47 locale code or an empty string if it is an invalid code.\n *\n * @example\n * standardizeLocale('en-us');\n * // Returns: 'en-US'\n *\n * @example\n * standardizeLocale('not a locale');\n * // Returns: ''\n */\nexport function standardizeLocale(locale: string) {\n return _standardizeLocale(locale);\n}\n"],"mappings":";;;AAIA,MAAM,mBAAmB;CAAC;CAAQ;CAAQ;CAAQ;CAAQ;CAAQ;CAAO;AAGzE,MAAM,oBAAoB,aAAqB;AAC7C,QAAO,YAAY,SAAS,YAAY;;;;;;;;;AAU1C,MAAa,kBACX,QACA,kBACY;AAEZ,KACE,gBAAgB,WAChB,OAAO,cAAc,YAAY,YACjC,UAAW,cAAc,WACxB,cAAc,QAA6B,KAE5C,UAAU,cAAc,QAA6B;AAGvD,KAAI;EACF,MAAM,EAAE,UAAU,QAAQ,WAAWA,kBAAAA,UAAU,IAAI,UAAU,OAAO;AACpE,MACE,OAAO,MAAM,IAAI,CAAC,kBACX;GACL,IAAI,YAAY;AAChB,OAAI,OAAQ,cAAa;AACzB,OAAI,OAAQ,cAAa;AACzB,UAAO;MACL,CAEJ,QAAO;AAQT,MAP6BA,kBAAAA,UAAU,IACrC,gBACA,CAAA,KAAsB,EACtB,EACE,MAAM,YACP,CAGmB,CAAC,GAAG,SAAS,KAAK,YACtC,CAAC,iBAAiB,SAAS,CAE3B,QAAO;AACT,MAAI;OACyBA,kBAAAA,UAAU,IACnC,gBACA,CAAA,KAAsB,EACtB,EACE,MAAM,UACP,CAEmB,CAAC,GAAG,OAAO,KAAK,OAAQ,QAAO;;AAEvD,MAAI;OACyBA,kBAAAA,UAAU,IACnC,gBACA,CAAA,KAAsB,EACtB,EACE,MAAM,UACP,CAGiB,CAAC,GAAG,OAAO,KAAK,UAClC,CAAC,iBAAiB,SAAS,OAAO,CAElC,QAAO;;AAEX,SAAO;SACD;AACN,SAAO;;;;;;;;;AAUX,MAAa,sBAAsB,WAA2B;AAC5D,KAAI;AACF,SAAO,KAAK,oBAAoB,OAAO,CAAC;SAClC;AACN,SAAO;;;;;AC7FX,SAAS,8BAA8B,O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A;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,MAAM,0BAA0B,SAAU,IAAI,WAAW,EAAE;AAE3D,SAAgB,eAAe,QAAwB;AACrD,QAAO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;;;;;;AClPL,SAAgB,aACd,OACA,SAGA;AACA,QAAO,cAAc;EAAE;EAAO,SAAS,SAAS;EAAS;EAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;AAuBrE,SAAgB,cACd,SACA,SAKA;AACA,SAAQ,SAAS,YAAjB;EACE,KAAK,SACH,QAAO,qBAAqB,QAAQ;EACtC,QACE,QAAO,kBAAkB,SAAS,SAAS,SAAS,SAAS,UAAU;;;;;;;;;;;;;;;;;;AAmB7E,SAAgB,cAAc,QAAgB,eAA+B;AAC3E,QAAO,eAAe,QAAQ,cAAc;;;;;;;;;;;;;;;;;AAkB9C,SAAgB,uBACd,QACA,eACA;AACA,QAAO,wBAAwB,QAAQ,cAAc;;;;;;;;;;;;;;;;AAiBvD,SAAgB,kBAAkB,QAAgB;AAChD,QAAO,mBAAmB,OAAO"}
|
|
1
|
+
{"version":3,"file":"core-3SOQ5ND6.cjs","names":["intlCache","intlCache","intlCache","intlCache","intlCache","intlCache","IntlMessageFormat","intlCache","intlCache","intlCache"],"sources":["../src/locales/isValidLocale.ts","../src/locales/isSameDialect.ts","../src/locales/isSameLanguage.ts","../src/locales/requiresTranslation.ts","../src/locales/customLocaleMapping.ts","../src/locales/getLocaleEmoji.ts","../src/locales/getLocaleProperties.ts","../src/locales/determineLocale.ts","../src/logging/logger.ts","../src/formatting/format.ts","../src/locales/getLocaleName.ts","../src/locales/getLocaleDirection.ts","../src/locales/isSupersetLocale.ts","../src/locales/resolveAliasLocale.ts","../src/locales/resolveCanonicalLocale.ts","../src/LocaleConfig.ts","../src/core.ts"],"sourcesContent":["import { intlCache } from '../cache/IntlCache';\nimport { libraryDefaultLocale } from '../settings/settings';\nimport { CustomMapping } from './customLocaleMapping';\n\nconst scriptExceptions = ['Cham', 'Jamo', 'Kawi', 'Lisu', 'Toto', 'Thai'];\n\n//// According to BCP 47, the range qaa–qtz is reserved for private-use language codes\nconst isCustomLanguage = (language: string) => {\n return language >= 'qaa' && language <= 'qtz';\n};\n\n/**\n * Checks if a given BCP 47 language code is valid.\n * @param {string} code - The BCP 47 language code to validate.\n * @param {CustomMapping} [customMapping] - The custom mapping to use for validation.\n * @returns {boolean} True if the BCP 47 code is valid, false otherwise.\n * @internal\n */\nexport const _isValidLocale = (\n locale: string,\n customMapping?: CustomMapping\n): boolean => {\n // If in custom mapping, return true\n if (\n customMapping?.[locale] &&\n typeof customMapping[locale] === 'object' &&\n 'code' in (customMapping[locale] as Object) &&\n (customMapping[locale] as { code: string }).code\n ) {\n locale = (customMapping[locale] as { code: string }).code;\n }\n\n try {\n const { language, region, script } = intlCache.get('Locale', locale);\n if (\n locale.split('-').length !==\n (() => {\n let partCount = 1;\n if (region) partCount += 1;\n if (script) partCount += 1;\n return partCount;\n })()\n )\n return false;\n const displayLanguageNames = intlCache.get(\n 'DisplayNames',\n [libraryDefaultLocale],\n {\n type: 'language',\n }\n );\n if (\n displayLanguageNames.of(language) === language &&\n !isCustomLanguage(language)\n )\n return false;\n if (region) {\n const displayRegionNames = intlCache.get(\n 'DisplayNames',\n [libraryDefaultLocale],\n {\n type: 'region',\n }\n );\n if (displayRegionNames.of(region) === region) return false;\n }\n if (script) {\n const displayScriptNames = intlCache.get(\n 'DisplayNames',\n [libraryDefaultLocale],\n {\n type: 'script',\n }\n );\n if (\n displayScriptNames.of(script) === script &&\n !scriptExceptions.includes(script)\n )\n return false;\n }\n return true;\n } catch {\n return false;\n }\n};\n\n/**\n * Standardizes a BCP 47 locale to ensure correct formatting.\n * @param {string} locale - The BCP 47 locale to standardize.\n * @returns {string} The standardized BCP 47 locale, or an empty string if invalid.\n * @internal\n */\nexport const _standardizeLocale = (locale: string): string => {\n try {\n return Intl.getCanonicalLocales(locale)[0];\n } catch {\n return locale;\n }\n};\n","import { intlCache } from '../cache/IntlCache';\nimport { _standardizeLocale } from './isValidLocale';\n\nfunction checkTwoLocalesAreSameDialect(codeA: string, codeB: string) {\n const {\n language: languageA,\n region: regionA,\n script: scriptA,\n } = intlCache.get('Locale', codeA);\n const {\n language: languageB,\n region: regionB,\n script: scriptB,\n } = intlCache.get('Locale', codeB);\n if (languageA !== languageB) return false;\n if (regionA && regionB && regionA !== regionB) return false;\n if (scriptA && scriptB && scriptA !== scriptB) return false;\n return true;\n}\n\n/**\n * Test two or more language codes to determine if they are exactly the same\n * e.g. \"en-US\" and \"en\" would be exactly the same.\n * \"en-GB\" and \"en\" would be exactly the same.\n * \"en-GB\" and \"en-US\" would be different.\n * @internal\n */\nexport default function _isSameDialect(\n ...locales: (string | string[])[]\n): boolean {\n try {\n // standardize codes\n const flattenedCodes = locales.flat().map(_standardizeLocale);\n\n for (let i = 0; i < flattenedCodes.length; i++) {\n for (let j = i + 1; j < flattenedCodes.length; j++) {\n if (\n !checkTwoLocalesAreSameDialect(flattenedCodes[i], flattenedCodes[j])\n )\n return false;\n }\n }\n\n return true;\n } catch (error) {\n console.error(error);\n return false;\n }\n}\n","import { intlCache } from '../cache/IntlCache';\n\n/**\n * @internal\n */\nexport default function _isSameLanguage(\n ...locales: (string | string[])[]\n): boolean {\n try {\n const flattenedCodes = locales.flat();\n // Get the language for each code\n const languages = flattenedCodes.map(\n (locale) => intlCache.get('Locale', locale).language\n );\n return languages.every((language) => language === languages[0]);\n } catch (error) {\n console.error(error);\n return false;\n }\n}\n","import { CustomMapping } from './customLocaleMapping';\nimport _isSameDialect from './isSameDialect';\nimport _isSameLanguage from './isSameLanguage';\nimport { _isValidLocale } from './isValidLocale';\n\n/**\n * Given a target locale and a source locale, determines whether a translation is required\n * If the target locale and the source locale are the same, returns false, otherwise returns true\n * If a translation is not possible due to the target locale being outside of the optional approvedLanguages scope, also returns false\n * @internal\n */\nexport default function _requiresTranslation(\n sourceLocale: string,\n targetLocale: string,\n approvedLocales?: string[],\n customMapping?: CustomMapping\n): boolean {\n // If codes are invalid\n if (\n !_isValidLocale(sourceLocale, customMapping) ||\n !_isValidLocale(targetLocale, customMapping) ||\n (approvedLocales &&\n approvedLocales.some(\n (approvedLocale) => !_isValidLocale(approvedLocale, customMapping)\n ))\n ) {\n return false;\n }\n\n // Check if the languages are identical, if so, a translation is not required\n if (_isSameDialect(sourceLocale, targetLocale)) {\n return false;\n }\n\n // Check that the target locale is within the approvedLocales scope, if not, a translation is not required\n // isSameLanguage rather than checkTwoLocalesAreSameDialect so we can show different dialects as a fallback\n if (\n approvedLocales &&\n !approvedLocales.some((approvedLocale) =>\n _isSameLanguage(targetLocale, approvedLocale)\n )\n ) {\n return false;\n }\n // Otherwise, a translation is required!\n return true;\n}\n","import { LocaleProperties } from './getLocaleProperties';\nimport { _isValidLocale } from './isValidLocale';\n\nexport type FullCustomMapping = Record<string, LocaleProperties>;\nexport type CustomMapping = Record<string, string | Partial<LocaleProperties>>;\n\nexport const getCustomProperty = (\n customMapping: CustomMapping,\n locale: string,\n property: keyof LocaleProperties\n): string | undefined => {\n if (customMapping?.[locale]) {\n if (typeof customMapping[locale] === 'string') {\n return property === 'name' ? customMapping[locale] : undefined;\n }\n return customMapping[locale][property];\n }\n return undefined;\n};\n\n/**\n * Checks if a given locale should use the canonical locale.\n * @param locale - The locale to check if it should use the canonical locale\n * @param customMapping - The custom mapping to use for checking if the locale should use the canonical locale\n * @returns True if the locale should use the canonical locale, false otherwise\n */\nexport const shouldUseCanonicalLocale = (\n locale: string,\n customMapping: CustomMapping\n): boolean => {\n return !!(\n customMapping?.[locale] &&\n typeof customMapping[locale] === 'object' &&\n 'code' in (customMapping[locale] as Object) &&\n (customMapping[locale] as { code: string }).code &&\n _isValidLocale((customMapping[locale] as { code: string }).code)\n );\n};\n","import { intlCache } from '../cache/IntlCache';\nimport {\n getCustomProperty,\n shouldUseCanonicalLocale,\n type CustomMapping,\n} from './customLocaleMapping';\nimport { _standardizeLocale } from './isValidLocale';\n\n/**\n * @internal\n */\nexport default function _getLocaleEmoji(\n locale: string,\n customMapping?: CustomMapping\n): string {\n const aliasedLocale = locale;\n if (customMapping && shouldUseCanonicalLocale(locale, customMapping)) {\n locale = (customMapping[locale] as { code: string }).code;\n }\n\n try {\n const standardizedLocale = _standardizeLocale(locale);\n const localeObject = intlCache.get('Locale', standardizedLocale);\n const { language, region } = localeObject;\n\n if (customMapping) {\n for (const l of [aliasedLocale, locale, standardizedLocale, language]) {\n const customEmoji = getCustomProperty(customMapping, l, 'emoji');\n if (customEmoji) return customEmoji;\n }\n }\n\n const regionEmoji = region && getSupportedRegionEmoji(region);\n if (regionEmoji) return regionEmoji;\n\n const extrapolated = localeObject.maximize();\n\n return (\n exceptions[extrapolated.language] ||\n getRegionEmoji(extrapolated.region || '')\n );\n } catch {\n return defaultEmoji;\n }\n}\n\n// Default language emoji for when none else can be found\nconst europeAfricaGlobe = '🌍';\nconst asiaAustraliaGlobe = '🌏';\nexport const defaultEmoji = europeAfricaGlobe;\n\n// Exceptions to better reflect linguistic and cultural identities\nconst exceptions = {\n ca: europeAfricaGlobe,\n eu: europeAfricaGlobe,\n ku: europeAfricaGlobe,\n bo: asiaAustraliaGlobe,\n ug: asiaAustraliaGlobe,\n gd: '🏴',\n cy: '🏴',\n gv: '🇮🇲',\n grc: '🏺',\n} as Record<string, string>;\n\nconst specialRegionEmojis = {\n EU: '🇪🇺',\n '419': '🌎',\n} as Record<string, string>;\n\n// Regions with Unicode regional-indicator flag sequences.\nconst flagRegions = new Set([\n 'AF', // Afghanistan\n 'AX', // Åland Islands\n 'AL', // Albania\n 'DZ', // Algeria\n 'AS', // American Samoa\n 'AD', // Andorra\n 'AO', // Angola\n 'AI', // Anguilla\n 'AQ', // Antarctica\n 'AG', // Antigua and Barbuda\n 'AR', // Argentina\n 'AM', // Armenia\n 'AW', // Aruba\n 'AU', // Australia\n 'AT', // Austria\n 'AZ', // Azerbaijan\n 'BS', // Bahamas\n 'BH', // Bahrain\n 'BD', // Bangladesh\n 'BB', // Barbados\n 'BY', // Belarus\n 'BE', // Belgium\n 'BZ', // Belize\n 'BJ', // Benin\n 'BM', // Bermuda\n 'BT', // Bhutan\n 'BO', // Bolivia\n 'BQ', // Bonaire, Sint Eustatius and Saba\n 'BA', // Bosnia and Herzegovina\n 'BW', // Botswana\n 'BV', // Bouvet Island\n 'BR', // Brazil\n 'IO', // British Indian Ocean Territory\n 'BN', // Brunei Darussalam\n 'BG', // Bulgaria\n 'BF', // Burkina Faso\n 'BI', // Burundi\n 'CV', // Cabo Verde\n 'KH', // Cambodia\n 'CM', // Cameroon\n 'CA', // Canada\n 'KY', // Cayman Islands\n 'CF', // Central African Republic\n 'TD', // Chad\n 'CL', // Chile\n 'CN', // China\n 'CX', // Christmas Island\n 'CC', // Cocos (Keeling) Islands\n 'CO', // Colombia\n 'KM', // Comoros\n 'CD', // Congo (Democratic Republic)\n 'CG', // Congo (Republic)\n 'CK', // Cook Islands\n 'CR', // Costa Rica\n 'CI', // Côte d'Ivoire\n 'HR', // Croatia\n 'CU', // Cuba\n 'CW', // Curaçao\n 'CY', // Cyprus\n 'CZ', // Czechia\n 'DK', // Denmark\n 'DJ', // Djibouti\n 'DM', // Dominica\n 'DO', // Dominican Republic\n 'EC', // Ecuador\n 'EG', // Egypt\n 'SV', // El Salvador\n 'GQ', // Equatorial Guinea\n 'ER', // Eritrea\n 'EE', // Estonia\n 'SZ', // Eswatini\n 'ET', // Ethiopia\n 'FK', // Falkland Islands\n 'FO', // Faroe Islands\n 'FJ', // Fiji\n 'FI', // Finland\n 'FR', // France\n 'GF', // French Guiana\n 'PF', // French Polynesia\n 'TF', // French Southern Territories\n 'GA', // Gabon\n 'GM', // Gambia\n 'GE', // Georgia\n 'DE', // Germany\n 'GH', // Ghana\n 'GI', // Gibraltar\n 'GR', // Greece\n 'GL', // Greenland\n 'GD', // Grenada\n 'GP', // Guadeloupe\n 'GU', // Guam\n 'GT', // Guatemala\n 'GG', // Guernsey\n 'GN', // Guinea\n 'GW', // Guinea-Bissau\n 'GY', // Guyana\n 'HT', // Haiti\n 'HM', // Heard Island and McDonald Islands\n 'VA', // Holy See\n 'HN', // Honduras\n 'HK', // Hong Kong\n 'HU', // Hungary\n 'IS', // Iceland\n 'IN', // India\n 'ID', // Indonesia\n 'IR', // Iran\n 'IQ', // Iraq\n 'IE', // Ireland\n 'IM', // Isle of Man\n 'IL', // Israel\n 'IT', // Italy\n 'JM', // Jamaica\n 'JP', // Japan\n 'JE', // Jersey\n 'JO', // Jordan\n 'KZ', // Kazakhstan\n 'KE', // Kenya\n 'KI', // Kiribati\n 'KP', // Korea (North)\n 'KR', // Korea (South)\n 'KW', // Kuwait\n 'KG', // Kyrgyzstan\n 'LA', // Laos\n 'LV', // Latvia\n 'LB', // Lebanon\n 'LS', // Lesotho\n 'LR', // Liberia\n 'LY', // Libya\n 'LI', // Liechtenstein\n 'LT', // Lithuania\n 'LU', // Luxembourg\n 'MO', // Macao\n 'MG', // Madagascar\n 'MW', // Malawi\n 'MY', // Malaysia\n 'MV', // Maldives\n 'ML', // Mali\n 'MT', // Malta\n 'MH', // Marshall Islands\n 'MQ', // Martinique\n 'MR', // Mauritania\n 'MU', // Mauritius\n 'YT', // Mayotte\n 'MX', // Mexico\n 'FM', // Micronesia\n 'MD', // Moldova\n 'MC', // Monaco\n 'MN', // Mongolia\n 'ME', // Montenegro\n 'MS', // Montserrat\n 'MA', // Morocco\n 'MZ', // Mozambique\n 'MM', // Myanmar\n 'NA', // Namibia\n 'NR', // Nauru\n 'NP', // Nepal\n 'NL', // Netherlands\n 'NC', // New Caledonia\n 'NZ', // New Zealand\n 'NI', // Nicaragua\n 'NE', // Niger\n 'NG', // Nigeria\n 'NU', // Niue\n 'NF', // Norfolk Island\n 'MK', // North Macedonia\n 'MP', // Northern Mariana Islands\n 'NO', // Norway\n 'OM', // Oman\n 'PK', // Pakistan\n 'PW', // Palau\n 'PS', // Palestine, State of\n 'PA', // Panama\n 'PG', // Papua New Guinea\n 'PY', // Paraguay\n 'PE', // Peru\n 'PH', // Philippines\n 'PN', // Pitcairn\n 'PL', // Poland\n 'PT', // Portugal\n 'PR', // Puerto Rico\n 'QA', // Qatar\n 'RE', // Réunion\n 'RO', // Romania\n 'RU', // Russian Federation\n 'RW', // Rwanda\n 'BL', // Saint Barthélemy\n 'SH', // Saint Helena, Ascension and Tristan da Cunha\n 'KN', // Saint Kitts and Nevis\n 'LC', // Saint Lucia\n 'MF', // Saint Martin (French part)\n 'PM', // Saint Pierre and Miquelon\n 'VC', // Saint Vincent and the Grenadines\n 'WS', // Samoa\n 'SM', // San Marino\n 'ST', // São Tomé and Príncipe\n 'SA', // Saudi Arabia\n 'SN', // Senegal\n 'RS', // Serbia\n 'SC', // Seychelles\n 'SL', // Sierra Leone\n 'SG', // Singapore\n 'SX', // Sint Maarten (Dutch part)\n 'SK', // Slovakia\n 'SI', // Slovenia\n 'SB', // Solomon Islands\n 'SO', // Somalia\n 'ZA', // South Africa\n 'GS', // South Georgia and the South Sandwich Islands\n 'SS', // South Sudan\n 'ES', // Spain\n 'LK', // Sri Lanka\n 'SD', // Sudan\n 'SR', // Suriname\n 'SJ', // Svalbard and Jan Mayen\n 'SE', // Sweden\n 'CH', // Switzerland\n 'SY', // Syrian Arab Republic\n 'TW', // Taiwan\n 'TJ', // Tajikistan\n 'TZ', // Tanzania\n 'TH', // Thailand\n 'TL', // Timor-Leste\n 'TG', // Togo\n 'TK', // Tokelau\n 'TO', // Tonga\n 'TT', // Trinidad and Tobago\n 'TN', // Tunisia\n 'TR', // Türkiye\n 'TM', // Turkmenistan\n 'TC', // Turks and Caicos Islands\n 'TV', // Tuvalu\n 'UG', // Uganda\n 'UA', // Ukraine\n 'AE', // United Arab Emirates\n 'GB', // United Kingdom\n 'US', // United States of America\n 'UM', // United States Minor Outlying Islands\n 'UY', // Uruguay\n 'UZ', // Uzbekistan\n 'VU', // Vanuatu\n 'VE', // Venezuela\n 'VN', // Viet Nam\n 'VG', // Virgin Islands (British)\n 'VI', // Virgin Islands (U.S.)\n 'WF', // Wallis and Futuna\n 'EH', // Western Sahara\n 'YE', // Yemen\n 'ZM', // Zambia\n 'ZW', // Zimbabwe\n]);\n\nconst regionalIndicatorOffset = 0x1f1e6 - 'A'.charCodeAt(0);\n\nexport function getRegionEmoji(region: string): string {\n return getSupportedRegionEmoji(region) || defaultEmoji;\n}\n\nfunction getSupportedRegionEmoji(region: string): string | undefined {\n const normalizedRegion = region.toUpperCase();\n const specialEmoji = specialRegionEmojis[normalizedRegion];\n if (specialEmoji) return specialEmoji;\n\n if (!flagRegions.has(normalizedRegion)) return undefined;\n\n return String.fromCodePoint(\n normalizedRegion.charCodeAt(0) + regionalIndicatorOffset,\n normalizedRegion.charCodeAt(1) + regionalIndicatorOffset\n );\n}\n","import { libraryDefaultLocale } from '../settings/settings';\nimport { defaultEmoji } from './getLocaleEmoji';\nimport { _isValidLocale, _standardizeLocale } from './isValidLocale';\nimport _getLocaleEmoji from './getLocaleEmoji';\nimport { intlCache } from '../cache/IntlCache';\nimport { CustomMapping, shouldUseCanonicalLocale } from './customLocaleMapping';\n\nexport type LocaleProperties = {\n // assume code = \"de-AT\", defaultLocale = \"en-US\"\n\n code: string; // \"de-AT\"\n name: string; // \"Austrian German\"\n nativeName: string; // \"Österreichisches Deutsch\"\n\n languageCode: string; // \"de\"\n languageName: string; // \"German\"\n nativeLanguageName: string; // \"Deutsch\"\n\n // note that maximize() is NOT called here!\n\n nameWithRegionCode: string; // \"German (AT)\"\n nativeNameWithRegionCode: string; // \"Deutsch (AT)\"\n\n // for most likely script and region, maximize() is called\n\n regionCode: string; // \"AT\"\n regionName: string; // \"Austria\"\n nativeRegionName: string; // Österreich\n\n scriptCode: string; // \"Latn\"\n scriptName: string; // \"Latin\"\n nativeScriptName: string; // \"Lateinisch\"\n\n maximizedCode: string; // \"de-Latn-AT\"\n maximizedName: string; // \"Austrian German (Latin)\"\n nativeMaximizedName: string; // Österreichisches Deutsch (Lateinisch)\n\n minimizedCode: string; // \"de-AT\", but for \"de-DE\" it would just be \"de\"\n minimizedName: string; // \"\"Austrian German\";\n nativeMinimizedName: string; // \"Österreichisches Deutsch\"\n\n // Emoji depending on region code\n // In order not to accidentally spark international conflict, some emojis are hard-coded\n emoji: string;\n};\n\n/**\n * Creates a set of custom locale properties from a custom mapping.\n *\n * @param lArray - An array of locale codes to search for in the custom mapping.\n * @param customMapping - Optional custom mapping of locale codes to names.\n * @returns A partial set of locale properties, or undefined if no custom mapping is provided.\n */\nexport function createCustomLocaleProperties(\n lArray: string[],\n customMapping?: CustomMapping\n): Partial<LocaleProperties> | undefined {\n if (customMapping) {\n let merged: Partial<LocaleProperties> = {};\n for (const l of lArray) {\n const value = customMapping[l];\n if (value) {\n if (typeof value === 'string') {\n merged.name ||= value;\n } else if (value) {\n merged = { ...value, ...merged };\n }\n }\n }\n return merged;\n }\n return undefined;\n}\n\n/**\n * @internal\n */\nexport default function _getLocaleProperties(\n locale: string,\n defaultLocale: string = libraryDefaultLocale,\n customMapping?: CustomMapping\n): LocaleProperties {\n // Check for canonical locale\n const aliasedLocale = locale;\n if (customMapping && shouldUseCanonicalLocale(locale, customMapping)) {\n // Override locale with canonical locale\n locale = (customMapping[locale] as { code: string }).code;\n }\n\n defaultLocale ||= libraryDefaultLocale;\n\n try {\n const standardizedLocale = _standardizeLocale(locale); // \"de-AT\"\n\n const localeObject = intlCache.get('Locale', locale);\n const languageCode = localeObject.language; // \"de\"\n\n const customLocaleProperties = createCustomLocaleProperties(\n [aliasedLocale, locale, standardizedLocale, languageCode],\n customMapping\n );\n\n const baseRegion = localeObject.region; // \"AT\"\n\n const maximizedLocale = localeObject.maximize();\n const maximizedCode = maximizedLocale.toString(); // \"de-Latn-AT\"\n const regionCode =\n localeObject.region ||\n customLocaleProperties?.regionCode ||\n maximizedLocale.region ||\n ''; // \"AT\"\n const scriptCode =\n localeObject.script ||\n customLocaleProperties?.scriptCode ||\n maximizedLocale.script ||\n ''; // \"Latn\"\n\n const minimizedLocale = localeObject.minimize();\n const minimizedCode = minimizedLocale.toString(); // \"de-AT\"\n\n // Language names (default and native)\n\n const defaultLanguageOrder = [defaultLocale, locale, libraryDefaultLocale];\n const nativeLanguageOrder = [locale, defaultLocale, libraryDefaultLocale];\n\n const languageNames = intlCache.get('DisplayNames', defaultLanguageOrder, {\n type: 'language',\n });\n const nativeLanguageNames = intlCache.get(\n 'DisplayNames',\n nativeLanguageOrder,\n { type: 'language' }\n );\n\n const customName = customLocaleProperties?.name;\n const customNativeName =\n customLocaleProperties?.nativeName || customLocaleProperties?.name;\n\n const name = customName || languageNames.of(locale) || locale; // \"Austrian German\"\n const nativeName =\n customNativeName || nativeLanguageNames.of(locale) || locale; // \"Österreichisches Deutsch\"\n\n const maximizedName =\n customLocaleProperties?.maximizedName ||\n customName ||\n languageNames.of(maximizedCode) ||\n locale; // \"Austrian German (Latin)\"\n const nativeMaximizedName =\n customLocaleProperties?.nativeMaximizedName ||\n customNativeName ||\n nativeLanguageNames.of(maximizedCode) ||\n locale; // \"Österreichisches Deutsch (Lateinisch)\"\n\n const minimizedName =\n customLocaleProperties?.minimizedName ||\n customName ||\n languageNames.of(minimizedCode) ||\n locale; // \"Austrian German\", but for \"de-DE\" would just be \"German\"\n const nativeMinimizedName =\n customLocaleProperties?.nativeMinimizedName ||\n customNativeName ||\n nativeLanguageNames.of(minimizedCode) ||\n locale; // \"Österreichisches Deutsch\", but for \"de-DE\" would just be \"Deutsch\"\n\n const languageName =\n customLocaleProperties?.languageName ||\n customName ||\n languageNames.of(languageCode) ||\n locale; // \"German\"\n const nativeLanguageName =\n customLocaleProperties?.nativeLanguageName ||\n customNativeName ||\n nativeLanguageNames.of(languageCode) ||\n locale; // \"Deutsch\"\n\n const nameWithRegionCode =\n customLocaleProperties?.nameWithRegionCode || baseRegion\n ? `${languageName} (${baseRegion})`\n : name; // German (AT)\n const nativeNameWithRegionCode =\n customLocaleProperties?.nativeNameWithRegionCode ||\n (baseRegion ? `${nativeLanguageName} (${baseRegion})` : nativeName) ||\n nameWithRegionCode; // \"Deutsch (AT)\"\n\n // Region names (default and native)\n\n const regionNames = intlCache.get('DisplayNames', defaultLanguageOrder, {\n type: 'region',\n });\n const nativeRegionNames = intlCache.get(\n 'DisplayNames',\n nativeLanguageOrder,\n { type: 'region' }\n );\n\n const regionName =\n customLocaleProperties?.regionName ||\n (regionCode ? regionNames.of(regionCode) : '') ||\n ''; // \"Austria\"\n const nativeRegionName =\n customLocaleProperties?.nativeRegionName ||\n (regionCode ? nativeRegionNames.of(regionCode) : '') ||\n ''; // \"Österreich\"\n\n // Script names (default and native)\n\n const scriptNames = intlCache.get('DisplayNames', defaultLanguageOrder, {\n type: 'script',\n });\n const nativeScriptNames = intlCache.get(\n 'DisplayNames',\n nativeLanguageOrder,\n { type: 'script' }\n );\n\n const scriptName =\n customLocaleProperties?.scriptName ||\n (scriptCode ? scriptNames.of(scriptCode) : '') ||\n ''; // \"Latin\"\n const nativeScriptName =\n customLocaleProperties?.nativeScriptName ||\n (scriptCode ? nativeScriptNames.of(scriptCode) : '') ||\n ''; // \"Lateinisch\"\n\n // Emoji\n\n const emoji =\n customLocaleProperties?.emoji ||\n _getLocaleEmoji(standardizedLocale, customMapping);\n\n return {\n code: standardizedLocale,\n name,\n nativeName,\n maximizedCode,\n maximizedName,\n nativeMaximizedName,\n minimizedCode,\n minimizedName,\n nativeMinimizedName,\n languageCode,\n languageName,\n nativeLanguageName,\n nameWithRegionCode,\n nativeNameWithRegionCode,\n regionCode,\n regionName,\n nativeRegionName,\n scriptCode,\n scriptName,\n nativeScriptName,\n emoji,\n };\n } catch {\n let code = _isValidLocale(locale) ? _standardizeLocale(locale) : locale;\n const codeParts = code?.split('-');\n let languageCode = codeParts?.[0] || code || '';\n let regionCode =\n codeParts.length > 2 ? codeParts?.[2] : codeParts?.[1] || '';\n let scriptCode = codeParts?.[3] || '';\n\n const customLocaleProperties = createCustomLocaleProperties(\n [code, languageCode],\n customMapping\n );\n\n code = customLocaleProperties?.code || code;\n const name = customLocaleProperties?.name || code;\n const nativeName = customLocaleProperties?.nativeName || name;\n\n const maximizedCode = customLocaleProperties?.maximizedCode || code;\n const maximizedName = customLocaleProperties?.maximizedName || name;\n const nativeMaximizedName =\n customLocaleProperties?.nativeMaximizedName || nativeName;\n\n const minimizedCode = customLocaleProperties?.minimizedCode || code;\n const minimizedName = customLocaleProperties?.minimizedName || name;\n const nativeMinimizedName =\n customLocaleProperties?.nativeMinimizedName || nativeName;\n\n languageCode = customLocaleProperties?.languageCode || languageCode;\n const languageName = customLocaleProperties?.languageName || name;\n const nativeLanguageName =\n customLocaleProperties?.nativeLanguageName || nativeName;\n\n regionCode = customLocaleProperties?.regionCode || regionCode;\n const regionName = customLocaleProperties?.regionName || '';\n const nativeRegionName = customLocaleProperties?.nativeRegionName || '';\n\n scriptCode = customLocaleProperties?.scriptCode || scriptCode;\n const scriptName = customLocaleProperties?.scriptName || '';\n const nativeScriptName = customLocaleProperties?.nativeScriptName || '';\n\n const nameWithRegionCode =\n customLocaleProperties?.nameWithRegionCode ||\n (regionName ? `${languageName} (${regionName})` : name);\n const nativeNameWithRegionCode =\n customLocaleProperties?.nativeNameWithRegionCode ||\n (nativeRegionName\n ? `${nativeLanguageName} (${nativeRegionName})`\n : nativeName);\n\n const emoji = customLocaleProperties?.emoji || defaultEmoji;\n\n return {\n code,\n name,\n nativeName,\n maximizedCode,\n maximizedName,\n nativeMaximizedName,\n minimizedCode,\n minimizedName,\n nativeMinimizedName,\n languageCode,\n languageName,\n nativeLanguageName,\n nameWithRegionCode,\n nativeNameWithRegionCode,\n regionCode,\n regionName,\n nativeRegionName,\n scriptCode,\n scriptName,\n nativeScriptName,\n emoji,\n };\n }\n}\n","import { _isValidLocale, _standardizeLocale } from './isValidLocale';\nimport _isSameLanguage from './isSameLanguage';\nimport _isSameDialect from './isSameDialect';\nimport _getLocaleProperties from './getLocaleProperties';\nimport { CustomMapping } from './customLocaleMapping';\n\n/**\n * Given a list of locales and a list of approved locales, sorted in preference order\n * Determines which locale is the best match among the approved locales, prioritizing exact matches and falling back to dialects of the same language\n * @internal\n */\nexport default function _determineLocale(\n locales: string | string[],\n approvedLocales: string[],\n customMapping?: CustomMapping\n): string | undefined {\n if (typeof locales === 'string') locales = [locales];\n locales = locales\n .filter((locale) => _isValidLocale(locale, customMapping))\n .map(_standardizeLocale);\n approvedLocales = approvedLocales\n .filter((locale) => _isValidLocale(locale, customMapping))\n .map(_standardizeLocale);\n for (const locale of locales) {\n const candidates = approvedLocales.filter((approvedLocale) =>\n _isSameLanguage(locale, approvedLocale)\n );\n const getMatchingCode = ({\n locale,\n languageCode,\n minimizedCode,\n regionCode,\n scriptCode,\n }: {\n locale: string;\n languageCode: string;\n minimizedCode: string;\n regionCode: string;\n scriptCode: string;\n }) => {\n const locales = [\n locale, // If the full locale is supported under this language category\n `${languageCode}-${regionCode}`, // Attempt to match parts\n `${languageCode}-${scriptCode}`,\n minimizedCode, // If a minimized variant of this locale is supported\n ];\n for (const l of locales) {\n if (candidates.includes(l)) return l;\n }\n return null;\n };\n const { languageCode, ...codes } = _getLocaleProperties(locale);\n const matchingCode =\n getMatchingCode({ locale, languageCode, ...codes }) ||\n getMatchingCode({\n locale: languageCode,\n ..._getLocaleProperties(languageCode),\n });\n if (matchingCode) return matchingCode;\n }\n return undefined;\n}\n","/**\n * Comprehensive logging system for the General Translation library\n * Provides structured logging with multiple levels and configurable output\n */\n\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'off';\n\nexport interface LogEntry {\n level: LogLevel;\n message: string;\n timestamp: Date;\n context?: string;\n metadata?: Record<string, any>;\n}\n\nexport interface LoggerConfig {\n /** Minimum log level to output */\n level: LogLevel;\n /** Whether to include timestamps in log output */\n includeTimestamp: boolean;\n /** Whether to include context information */\n includeContext: boolean;\n /** Custom prefix for all log messages */\n prefix?: string;\n /** Whether to output to console (default: true) */\n enableConsole: boolean;\n /** Custom log handlers */\n handlers?: LogHandler[];\n}\n\nexport interface LogHandler {\n handle(entry: LogEntry): void;\n}\n\nconst LOG_LEVELS: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n off: 4,\n};\n\nconst LOG_COLORS: Record<LogLevel, string> = {\n debug: '\\x1b[36m', // Cyan\n info: '\\x1b[32m', // Green\n warn: '\\x1b[33m', // Yellow\n error: '\\x1b[31m', // Red\n off: '', // No color needed since 'off' level logs are never displayed\n};\n\nconst RESET_COLOR = '\\x1b[0m';\n\n/**\n * Get the configured log level from environment variable or default to 'warn'\n */\nfunction getConfiguredLogLevel(): LogLevel {\n if (typeof process !== 'undefined' && process.env?._GT_LOG_LEVEL) {\n const envLevel = process.env._GT_LOG_LEVEL.toLowerCase();\n if (envLevel in LOG_LEVELS) {\n return envLevel as LogLevel;\n }\n }\n return 'warn';\n}\n\n/**\n * Console log handler that outputs formatted messages to console\n */\nexport class ConsoleLogHandler implements LogHandler {\n private config: LoggerConfig;\n\n constructor(config: LoggerConfig) {\n this.config = config;\n }\n\n handle(entry: LogEntry): void {\n const parts: string[] = [];\n\n // Add timestamp if enabled\n if (this.config.includeTimestamp) {\n parts.push(`[${entry.timestamp.toISOString()}]`);\n }\n\n // Add level with color\n const colorCode = LOG_COLORS[entry.level];\n const levelText = `[${entry.level.toUpperCase()}]`;\n parts.push(`${colorCode}${levelText}${RESET_COLOR}`);\n\n // Add prefix if configured\n if (this.config.prefix) {\n parts.push(`[${this.config.prefix}]`);\n }\n\n // Add context if available and enabled\n if (this.config.includeContext && entry.context) {\n parts.push(`[${entry.context}]`);\n }\n\n // Add the main message\n parts.push(entry.message);\n\n // Format metadata if available\n if (entry.metadata && Object.keys(entry.metadata).length > 0) {\n parts.push(`\\n Metadata: ${JSON.stringify(entry.metadata, null, 2)}`);\n }\n\n const formattedMessage = parts.join(' ');\n\n // Output to appropriate console method based on level\n switch (entry.level) {\n case 'debug':\n console.debug(formattedMessage);\n break;\n case 'info':\n console.info(formattedMessage);\n break;\n case 'warn':\n console.warn(formattedMessage);\n break;\n case 'error':\n console.error(formattedMessage);\n break;\n }\n }\n}\n\n/**\n * Main Logger class providing structured logging capabilities\n */\nexport class Logger {\n private config: LoggerConfig;\n private handlers: LogHandler[];\n\n constructor(config: Partial<LoggerConfig> = {}) {\n this.config = {\n level: getConfiguredLogLevel(),\n includeTimestamp: true,\n includeContext: true,\n enableConsole: true,\n handlers: [],\n ...config,\n };\n\n this.handlers = [...(this.config.handlers || [])];\n\n // Add console handler if enabled\n if (this.config.enableConsole) {\n this.handlers.push(new ConsoleLogHandler(this.config));\n }\n }\n\n /**\n * Add a custom log handler\n */\n addHandler(handler: LogHandler): void {\n this.handlers.push(handler);\n }\n\n /**\n * Remove a log handler\n */\n removeHandler(handler: LogHandler): void {\n const index = this.handlers.indexOf(handler);\n if (index > -1) {\n this.handlers.splice(index, 1);\n }\n }\n\n /**\n * Update logger configuration\n */\n configure(config: Partial<LoggerConfig>): void {\n this.config = { ...this.config, ...config };\n }\n\n /**\n * Check if a log level should be output based on current configuration\n */\n private shouldLog(level: LogLevel): boolean {\n return LOG_LEVELS[level] >= LOG_LEVELS[this.config.level];\n }\n\n /**\n * Internal logging method that creates log entries and passes them to handlers\n */\n private log(\n level: LogLevel,\n message: string,\n context?: string,\n metadata?: Record<string, any>\n ): void {\n if (!this.shouldLog(level)) {\n return;\n }\n\n const entry: LogEntry = {\n level,\n message,\n timestamp: new Date(),\n context,\n metadata,\n };\n\n // Pass to all handlers\n this.handlers.forEach((handler) => {\n try {\n handler.handle(entry);\n } catch (error) {\n // Prevent logging errors from breaking the application\n console.error('Error in log handler:', error);\n }\n });\n }\n\n /**\n * Log a debug message\n * Used for detailed diagnostic information, typically of interest only when diagnosing problems\n */\n debug(\n message: string,\n context?: string,\n metadata?: Record<string, any>\n ): void {\n this.log('debug', message, context, metadata);\n }\n\n /**\n * Log an info message\n * Used for general information about application operation\n */\n info(\n message: string,\n context?: string,\n metadata?: Record<string, any>\n ): void {\n this.log('info', message, context, metadata);\n }\n\n /**\n * Log a warning message\n * Used for potentially problematic situations that don't prevent operation\n */\n warn(\n message: string,\n context?: string,\n metadata?: Record<string, any>\n ): void {\n this.log('warn', message, context, metadata);\n }\n\n /**\n * Log an error message\n * Used for error events that might still allow the application to continue\n */\n error(\n message: string,\n context?: string,\n metadata?: Record<string, any>\n ): void {\n this.log('error', message, context, metadata);\n }\n\n /**\n * Create a child logger with a specific context\n */\n child(context: string): ContextLogger {\n return new ContextLogger(this, context);\n }\n\n /**\n * Get current logger configuration\n */\n getConfig(): LoggerConfig {\n return { ...this.config };\n }\n}\n\n/**\n * Context logger that automatically includes context information\n */\nexport class ContextLogger {\n private logger: Logger;\n private context: string;\n\n constructor(logger: Logger, context: string) {\n this.logger = logger;\n this.context = context;\n }\n\n debug(message: string, metadata?: Record<string, any>): void {\n this.logger.debug(message, this.context, metadata);\n }\n\n info(message: string, metadata?: Record<string, any>): void {\n this.logger.info(message, this.context, metadata);\n }\n\n warn(message: string, metadata?: Record<string, any>): void {\n this.logger.warn(message, this.context, metadata);\n }\n\n error(message: string, metadata?: Record<string, any>): void {\n this.logger.error(message, this.context, metadata);\n }\n\n child(childContext: string): ContextLogger {\n return new ContextLogger(this.logger, `${this.context}:${childContext}`);\n }\n}\n\n// Default logger instance\nexport const defaultLogger = new Logger({\n level: getConfiguredLogLevel(),\n includeTimestamp: true,\n includeContext: true,\n prefix: 'GT',\n});\n\n// Convenience functions using the default logger\nexport const debug = (\n message: string,\n context?: string,\n metadata?: Record<string, any>\n) => defaultLogger.debug(message, context, metadata);\n\nexport const info = (\n message: string,\n context?: string,\n metadata?: Record<string, any>\n) => defaultLogger.info(message, context, metadata);\n\nexport const warn = (\n message: string,\n context?: string,\n metadata?: Record<string, any>\n) => defaultLogger.warn(message, context, metadata);\n\nexport const error = (\n message: string,\n context?: string,\n metadata?: Record<string, any>\n) => defaultLogger.error(message, context, metadata);\n\n// Create context-specific loggers for different parts of the system\nexport const fetchLogger = defaultLogger.child('fetch');\nexport const validationLogger = defaultLogger.child('validation');\nexport const formattingLogger = defaultLogger.child('formatting');\nexport const localeLogger = defaultLogger.child('locale');\nexport const gtInstanceLogger = defaultLogger.child('GT instance');\n\n// Export types and classes\nexport { Logger as GTLogger };\n","import { FormatVariables, I18nextMessage } from '../types';\nimport { intlCache } from '../cache/IntlCache';\nimport { libraryDefaultLocale } from '../settings/settings';\nimport { IntlMessageFormat } from 'intl-messageformat';\nimport { formatI18nextWarning, formatJsxWarning } from '../logging/warnings';\nimport { formattingLogger } from '../logging/logger';\nimport { JsxChildren } from '../types';\nimport { CutoffFormatOptions } from './custom-formats/CutoffFormat/types';\n\n/**\n * Formats a string value with cutoff behavior according to the specified locales and options.\n *\n * @param {Object} params - The parameters for the cutoff formatting.\n * @param {string} params.value - The string value to format with cutoff behavior.\n * @param {string | string[]} [params.locales='en'] - The locales to use for formatting.\n * @param {CutoffFormatOptions} [params.options={}] - Additional options for cutoff formatting.\n * @param {number} [params.options.maxChars] - The maximum number of characters to display.\n * @param {CutoffFormatStyle} [params.options.style='ellipsis'] - The style of the terminator.\n * @param {string} [params.options.terminator] - Optional override for the terminator to use.\n * @param {string} [params.options.separator] - Optional override for the separator between terminator and value.\n *\n * @returns {string} The formatted string with terminator applied if cutoff occurs.\n * @internal\n *\n * @example\n * _formatCutoff({ value: 'Hello, world!', options: { maxChars: 8 } }); // Returns 'Hello, w...'\n *\n * Will fallback to an empty string if formatting fails.\n */\nexport function _formatCutoff({\n value,\n locales = libraryDefaultLocale,\n options = {},\n}: {\n value: string;\n locales?: string | string[];\n options?: CutoffFormatOptions;\n}): string {\n return intlCache.get('CutoffFormat', locales, options).format(value);\n}\n\n/**\n * Formats a message according to the specified locales and options.\n *\n * @param {string} message - The message to format.\n * @param {string | string[]} [locales='en'] - The locales to use for formatting.\n * @param {Record<string, any>} [variables={}] - The variables to use for formatting.\n * @returns {string} The formatted message.\n * @internal\n *\n * Will fallback to an empty string\n * TODO: add this to custom formats\n */\nexport function _formatMessageICU(\n message: string,\n locales: string | string[] = libraryDefaultLocale,\n variables: FormatVariables = {}\n): string {\n const messageFormat = new IntlMessageFormat(message, locales);\n return messageFormat.format(variables)?.toString() ?? '';\n}\n\n/**\n * Returns the message as-is without any formatting.\n *\n * @param {string} message - The message to return.\n * @returns {string} The original message, unchanged.\n * @internal\n *\n * TODO: add this to custom formats\n */\nexport function _formatMessageString(message: string): string {\n return message;\n}\n\n/**\n * Formats a number according to the specified locales and options.\n *\n * @param {Object} params - The parameters for the number formatting.\n * @param {number} params.value - The number to format.\n * @param {string | string[]} [params.locales=['en']] - The locales to use for formatting.\n * @param {Intl.NumberFormatOptions} [params.options={}] - Additional options for number formatting.\n *\n * @returns {string} The formatted number.\n * @internal\n */\nexport function _formatNum({\n value,\n locales = [libraryDefaultLocale],\n options = {},\n}: {\n value: number;\n locales?: string | string[];\n options?: Intl.NumberFormatOptions;\n}): string {\n const res = intlCache\n .get('NumberFormat', locales, {\n numberingSystem: 'latn',\n ...options,\n })\n .format(value);\n return res;\n}\n\n/**\n * Formats a date according to the specified locales and options.\n *\n * @param {Object} params - The parameters for the date formatting.\n * @param {Date} params.value - The date to format.\n * @param {string | string[]} [params.locales='en'] - The locales to use for formatting.\n * @param {Intl.DateTimeFormatOptions} [params.options={}] - Additional options for date formatting.\n *\n * @returns {string} The formatted date.\n * @internal\n */\nexport function _formatDateTime({\n value,\n locales = [libraryDefaultLocale],\n options = {},\n}: {\n value: Date;\n locales?: string | string[];\n options?: Intl.DateTimeFormatOptions;\n}): string {\n return intlCache\n .get('DateTimeFormat', locales, {\n calendar: 'gregory',\n numberingSystem: 'latn',\n ...options,\n })\n .format(value);\n}\n\n/**\n * Formats a currency value according to the specified locales, currency, and options.\n *\n * @param {Object} params - The parameters for the currency formatting.\n * @param {number} params.value - The currency value to format.\n * @param {string} params.currency - The currency code (e.g., 'USD').\n * @param {string | string[]} [params.locales=['en']] - The locales to use for formatting.\n * @param {Intl.NumberFormatOptions} [params.options={}] - Additional options for currency formatting.\n *\n * @returns {string} The formatted currency value.\n * @internal\n */\n\nexport function _formatCurrency({\n value,\n locales = [libraryDefaultLocale],\n currency = 'USD',\n options = {},\n}: {\n value: number;\n currency?: string;\n locales?: string | string[];\n options?: Intl.NumberFormatOptions;\n}): string {\n return intlCache\n .get('NumberFormat', locales, {\n style: 'currency',\n currency,\n numberingSystem: 'latn',\n ...options,\n })\n .format(value);\n}\n\n/**\n * Formats a list of items according to the specified locales and options.\n *\n * @param {Object} params - The parameters for the list formatting.\n * @param {Array<string | number>} params.value - The list of items to format.\n * @param {string | string[]} [params.locales=['en']] - The locales to use for formatting.\n * @param {Intl.ListFormatOptions} [params.options={}] - Additional options for list formatting.\n *\n * @returns {string} The formatted list.\n * @internal\n */\nexport function _formatList({\n value,\n locales = [libraryDefaultLocale],\n options = {},\n}: {\n value: Array<any>;\n locales?: string | string[];\n options?: Intl.ListFormatOptions;\n}): string {\n return intlCache\n .get('ListFormat', locales, {\n type: 'conjunction', // Default type, can be overridden via options\n style: 'long', // Default style, can be overridden via options\n ...options,\n })\n .format(value);\n}\n\n/**\n * Formats a list of items according to the specified locales and options.\n * @param {Object} params - The parameters for the list formatting.\n * @param {Array<T>} params.value - The list of items to format.\n * @param {string | string[]} [params.locales=['en']] - The locales to use for formatting.\n * @param {Intl.ListFormatOptions} [params.options={}] - Additional options for list formatting.\n * @returns {Array<T | string>} The formatted list parts.\n * @internal\n */\nexport function _formatListToParts<T>({\n value,\n locales = [libraryDefaultLocale],\n options = {},\n}: {\n value: Array<T>;\n locales?: string | string[];\n options?: Intl.ListFormatOptions;\n}) {\n const formatListParts = intlCache\n .get('ListFormat', locales, {\n type: 'conjunction', // Default type, can be overridden via options\n style: 'long', // Default style, can be overridden via options\n ...options,\n })\n .formatToParts(value.map(() => '1'));\n let partIndex = 0;\n return formatListParts.map((part) => {\n if (part.type === 'element') return value[partIndex++];\n return part.value;\n });\n}\n\n/**\n * Selects the best unit and computes the value for relative time formatting\n * based on the difference between a date and a base date.\n * @param {Date} date - The target date.\n * @param {Date} baseDate - The base date to compute relative time from. Must be provided by the caller for hydration safety.\n * @returns {{ value: number, unit: Intl.RelativeTimeFormatUnit }} The computed value and unit.\n * @internal\n */\nexport function _selectRelativeTimeUnit(\n date: Date,\n baseDate: Date\n): {\n value: number;\n unit: Intl.RelativeTimeFormatUnit;\n} {\n const now = baseDate.getTime();\n const diffMs = date.getTime() - now;\n const absDiffMs = Math.abs(diffMs);\n const sign = diffMs < 0 ? -1 : 1;\n\n // Use Math.floor to avoid confusing jumps near boundaries\n // (e.g. 3.5 days rounding to \"1 week ago\" instead of \"3 days ago\")\n const seconds = Math.floor(absDiffMs / 1000);\n const minutes = Math.floor(absDiffMs / (1000 * 60));\n const hours = Math.floor(absDiffMs / (1000 * 60 * 60));\n const days = Math.floor(absDiffMs / (1000 * 60 * 60 * 24));\n const weeks = Math.floor(absDiffMs / (1000 * 60 * 60 * 24 * 7));\n const months = Math.floor(absDiffMs / (1000 * 60 * 60 * 24 * 30));\n const years = Math.floor(absDiffMs / (1000 * 60 * 60 * 24 * 365));\n\n if (seconds < 60) return { value: sign * seconds, unit: 'second' };\n if (minutes < 60) return { value: sign * minutes, unit: 'minute' };\n if (hours < 24) return { value: sign * hours, unit: 'hour' };\n if (days < 7) return { value: sign * days, unit: 'day' };\n if (days < 28) return { value: sign * weeks, unit: 'week' };\n if (months < 1) return { value: sign * weeks, unit: 'week' };\n if (months < 12) return { value: sign * months, unit: 'month' };\n if (years < 1) return { value: sign * months, unit: 'month' };\n return { value: sign * years, unit: 'year' };\n}\n\n/**\n * Formats a relative time from a Date, automatically selecting the best unit.\n * @internal\n */\nexport function _formatRelativeTimeFromDate({\n date,\n baseDate,\n locales = [libraryDefaultLocale],\n options = {},\n}: {\n date: Date;\n baseDate: Date;\n locales?: string | string[];\n options?: Intl.RelativeTimeFormatOptions;\n}): string {\n const { value, unit } = _selectRelativeTimeUnit(date, baseDate);\n return _formatRelativeTime({ value, unit, locales, options });\n}\n\n/**\n * Formats a relative time value according to the specified locales and options.\n *\n * @param {Object} params - The parameters for the relative time formatting.\n * @param {number} params.value - The relative time value to format.\n * @param {Intl.RelativeTimeFormatUnit} params.unit - The unit of time (e.g., 'second', 'minute', 'hour', 'day', 'week', 'month', 'year').\n * @param {string | string[]} [params.locales=['en']] - The locales to use for formatting.\n * @param {Intl.RelativeTimeFormatOptions} [params.options={}] - Additional options for relative time formatting.\n *\n * @returns {string} The formatted relative time string.\n * @internal\n */\nexport function _formatRelativeTime({\n value,\n unit,\n locales = [libraryDefaultLocale],\n options = {},\n}: {\n value: number;\n unit: Intl.RelativeTimeFormatUnit;\n locales?: string | string[];\n options?: Intl.RelativeTimeFormatOptions;\n}): string {\n return intlCache\n .get('RelativeTimeFormat', locales, {\n style: 'long',\n numeric: 'auto',\n ...options,\n })\n .format(value, unit);\n}\n\n/**\n * @experimental This function is not currently supported but will be implemented in a future version.\n * Use {@link _formatMessageICU} for current ICU message format support.\n * Formats an I18next message according to the specified locales and options.\n *\n * @param message - The I18next message to format.\n * @param variables - The variables to use for formatting.\n * @returns The formatted I18next message.\n * @internal\n */\nexport function _formatI18next(\n message: I18nextMessage,\n _variables: FormatVariables = {}\n): string {\n formattingLogger.warn(formatI18nextWarning);\n return message;\n}\n\n/**\n * @experimental This function is not currently supported but will be implemented in a future version.\n * Use {@link _formatMessageICU} for current ICU message format support.\n * Formats a JSX message according to the specified locales and options.\n *\n * @param message - The JSX message to format.\n * @param variables - The variables to use for formatting.\n * @returns The formatted JSX message.\n * @internal\n */\nexport function _formatJsx(\n message: JsxChildren,\n _variables: FormatVariables = {}\n): JsxChildren {\n formattingLogger.warn(formatJsxWarning);\n return message;\n}\n","import { intlCache } from '../cache/IntlCache';\nimport { libraryDefaultLocale } from '../settings/settings';\nimport {\n CustomMapping,\n getCustomProperty,\n shouldUseCanonicalLocale,\n} from './customLocaleMapping';\nimport { _standardizeLocale } from './isValidLocale';\n\n/**\n * Retrieves the display name(s) of locale code(s) using Intl.DisplayNames.\n *\n * @param {string} locale - A BCP-47 locale code.\n * @param {string} [defaultLocale=libraryDefaultLocale] - The locale for display names.\n * @returns {string} The display name(s) corresponding to the code(s), or empty string(s) if invalid.\n * @internal\n */\nexport function _getLocaleName(\n locale: string,\n defaultLocale: string = libraryDefaultLocale,\n customMapping?: CustomMapping\n): string {\n // Check for canonical locale\n const aliasedLocale = locale;\n if (customMapping && shouldUseCanonicalLocale(locale, customMapping)) {\n // Override locale with canonical locale\n locale = (customMapping[locale] as { code: string }).code;\n }\n\n defaultLocale ||= libraryDefaultLocale;\n try {\n const standardizedLocale = _standardizeLocale(locale);\n if (customMapping) {\n for (const l of [\n aliasedLocale,\n locale,\n standardizedLocale,\n intlCache.get('Locale', standardizedLocale).language,\n ]) {\n const customName = getCustomProperty(customMapping, l, 'name');\n if (customName) return customName;\n }\n }\n const displayNames = intlCache.get(\n 'DisplayNames',\n [defaultLocale, standardizedLocale, libraryDefaultLocale], // default locale order\n { type: 'language' }\n );\n return displayNames.of(standardizedLocale) || '';\n } catch {\n // In case Intl.DisplayNames construction fails, return empty string(s)\n return '';\n }\n}\n","import { intlCache } from '../cache/IntlCache';\nimport _getLocaleProperties from './getLocaleProperties';\n\n/**\n * Get the text direction for a given locale code using the Intl.Locale API.\n *\n * @param {string} code - The locale code to check.\n * @returns {string} - 'rtl' if the language is right-to-left, otherwise 'ltr'.\n * @internal\n */\nexport function _getLocaleDirection(code: string): 'ltr' | 'rtl' {\n // Extract via textInfo property\n try {\n const locale = intlCache.get('Locale', code);\n const textInfoDirection = extractDirectionWithTextInfo(locale);\n if (textInfoDirection) {\n return textInfoDirection;\n }\n } catch {\n // silent\n }\n\n // Fallback to simple heuristics\n const { scriptCode, languageCode } = _getLocaleProperties(code);\n\n // Handle RTL script or language\n if (scriptCode) return isRtlScript(scriptCode) ? 'rtl' : 'ltr';\n if (languageCode) return isRtlLanguage(languageCode) ? 'rtl' : 'ltr';\n\n return 'ltr';\n}\n\n// ===== HELPER CONSTANTS ===== //\n\nconst RTL_SCRIPTS = new Set([\n 'arab',\n 'adlm',\n 'hebr',\n 'nkoo',\n 'rohg',\n 'samr',\n 'syrc',\n 'thaa',\n 'yezi',\n]);\n\nconst RTL_LANGUAGES = new Set([\n 'ar',\n 'arc',\n 'ckb',\n 'dv',\n 'fa',\n 'he',\n 'iw',\n 'ku',\n 'lrc',\n 'nqo',\n 'ps',\n 'pnb',\n 'sd',\n 'syr',\n 'ug',\n 'ur',\n 'yi',\n]);\n\n// ===== HELPER FUNCTIONS ===== //\n\n/**\n * Handles extracting direction via textInfo property\n * @param Locale - Intl.Locale object\n * @returns {'ltr' | 'rtl'} - The direction of the locale\n *\n * Intl.Locale.prototype.getTextInfo() / textInfo property incorporated in ES2024 Specification.\n * This is not supported by all browsers yet.\n * See: {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo#browser_compatibility}\n */\nfunction extractDirectionWithTextInfo(\n locale: Intl.Locale\n): 'ltr' | 'rtl' | undefined {\n if (\n 'textInfo' in locale &&\n typeof locale.textInfo === 'object' &&\n locale.textInfo !== null &&\n 'direction' in locale.textInfo &&\n (locale.textInfo?.direction === 'rtl' ||\n locale.textInfo?.direction === 'ltr')\n ) {\n return locale.textInfo?.direction;\n }\n\n return undefined;\n}\n\nfunction isRtlScript(script: string | undefined): boolean {\n return script ? RTL_SCRIPTS.has(script.toLowerCase()) : false;\n}\n\nfunction isRtlLanguage(language: string | undefined): boolean {\n return language ? RTL_LANGUAGES.has(language.toLowerCase()) : false;\n}\n","import { intlCache } from '../cache/IntlCache';\nimport { _standardizeLocale } from './isValidLocale';\n\n/**\n * @internal\n */\nexport default function _isSupersetLocale(\n superLocale: string,\n subLocale: string\n): boolean {\n try {\n const {\n language: languageSuper,\n region: regionSuper,\n script: scriptSuper,\n } = intlCache.get('Locale', _standardizeLocale(superLocale));\n const {\n language: languageSub,\n region: regionSub,\n script: scriptSub,\n } = intlCache.get('Locale', _standardizeLocale(subLocale));\n\n if (languageSuper !== languageSub) return false;\n if (regionSuper && regionSuper !== regionSub) return false;\n if (scriptSuper && scriptSuper !== scriptSub) return false;\n\n return true;\n } catch (error) {\n console.error(error);\n return false;\n }\n}\n","import { CustomMapping } from './customLocaleMapping';\n\n/**\n * Resolves the alias locale for a given locale.\n * @param locale - The locale to resolve the alias locale for\n * @param customMapping - The custom mapping to use for resolving the alias locale\n * @returns The alias locale\n */\nexport function _resolveAliasLocale(\n locale: string,\n customMapping?: CustomMapping\n): string {\n let reverseCustomMapping: Record<string, string> | undefined;\n if (customMapping) {\n reverseCustomMapping = Object.fromEntries(\n Object.entries(customMapping)\n .filter(\n ([, value]) => value && typeof value === 'object' && 'code' in value\n )\n .map(([key, value]) => [(value as { code: string }).code, key])\n );\n }\n\n return reverseCustomMapping?.[locale] || locale;\n}\n","import { shouldUseCanonicalLocale } from './customLocaleMapping';\nimport { CustomMapping } from './customLocaleMapping';\n\n/**\n * Resolves the canonical locale for a given locale.\n * @param locale - The locale to resolve the canonical locale for\n * @param customMapping - The custom mapping to use for resolving the canonical locale\n * @returns The canonical locale\n */\nexport function _resolveCanonicalLocale(\n locale: string,\n customMapping?: CustomMapping\n): string {\n if (customMapping && shouldUseCanonicalLocale(locale, customMapping)) {\n return (customMapping[locale] as { code: string }).code;\n }\n\n return locale;\n}\n","import {\n _formatCurrency,\n _formatCutoff,\n _formatDateTime,\n _formatList,\n _formatListToParts,\n _formatMessageICU,\n _formatMessageString,\n _formatNum,\n _formatRelativeTime,\n _formatRelativeTimeFromDate,\n} from './formatting/format';\nimport _requiresTranslation from './locales/requiresTranslation';\nimport _determineLocale from './locales/determineLocale';\nimport _isSameLanguage from './locales/isSameLanguage';\nimport _getLocaleProperties from './locales/getLocaleProperties';\nimport _getLocaleEmoji from './locales/getLocaleEmoji';\nimport { _isValidLocale, _standardizeLocale } from './locales/isValidLocale';\nimport { _getLocaleName } from './locales/getLocaleName';\nimport { _getLocaleDirection } from './locales/getLocaleDirection';\nimport { libraryDefaultLocale } from './settings/settings';\nimport _isSameDialect from './locales/isSameDialect';\nimport _isSupersetLocale from './locales/isSupersetLocale';\nimport { CustomMapping, FormatVariables } from './types';\nimport { _resolveAliasLocale } from './locales/resolveAliasLocale';\nimport { _resolveCanonicalLocale } from './locales/resolveCanonicalLocale';\nimport { CutoffFormatOptions } from './formatting/custom-formats/CutoffFormat/types';\nimport { StringFormat } from './types-dir/jsx/content';\n\nexport type LocaleConfigConstructorParams = {\n defaultLocale?: string;\n locales?: string[];\n customMapping?: CustomMapping;\n};\n\ntype LocalesOption = {\n locales?: string | string[];\n};\n\ntype WithLocales<T = object> = T & LocalesOption;\n\n/**\n * LocaleConfig contains the locale and formatting primitives exposed through\n * the core entrypoint.\n *\n * It intentionally does not store project IDs, API keys, runtime URLs, or any\n * translation credentials. It only stores locale metadata needed to resolve\n * aliases, choose formatting fallbacks, and format values with Intl.\n */\nexport class LocaleConfig {\n readonly defaultLocale: string;\n readonly locales: string[];\n readonly customMapping?: CustomMapping;\n\n constructor({\n defaultLocale = libraryDefaultLocale,\n locales = [],\n customMapping,\n }: LocaleConfigConstructorParams = {}) {\n this.defaultLocale = defaultLocale;\n this.locales = locales;\n this.customMapping = customMapping;\n }\n\n private get translationLocales() {\n return this.locales.length ? this.locales : undefined;\n }\n\n private resolveCanonicalLocaleList(locales: string[]) {\n return locales.map((locale) => this.resolveCanonicalLocale(locale));\n }\n\n private resolveCanonicalLocaleArgs(locales: (string | string[])[]) {\n return locales.map((locale) =>\n Array.isArray(locale)\n ? this.resolveCanonicalLocaleList(locale)\n : this.resolveCanonicalLocale(locale)\n );\n }\n\n private toLocaleList(locales: string | string[]) {\n return Array.isArray(locales) ? locales : [locales];\n }\n\n private getFormattingLocales(\n targetLocale?: string,\n locales?: string | string[]\n ) {\n const localeList =\n locales !== undefined\n ? this.toLocaleList(locales)\n : [targetLocale, this.defaultLocale, libraryDefaultLocale];\n\n return localeList\n .filter((locale): locale is string => !!locale)\n .map((locale) => this.resolveCanonicalLocale(locale));\n }\n\n formatNum(\n value: number,\n targetLocale?: string,\n options: WithLocales<Intl.NumberFormatOptions> = {}\n ) {\n const { locales, ...intlOptions } = options;\n return _formatNum({\n value,\n locales: this.getFormattingLocales(targetLocale, locales),\n options: intlOptions,\n });\n }\n\n formatDateTime(\n value: Date,\n targetLocale?: string,\n options: WithLocales<Intl.DateTimeFormatOptions> = {}\n ) {\n const { locales, ...intlOptions } = options;\n return _formatDateTime({\n value,\n locales: this.getFormattingLocales(targetLocale, locales),\n options: intlOptions,\n });\n }\n\n formatCurrency(\n value: number,\n currency: string,\n targetLocale?: string,\n options: WithLocales<Intl.NumberFormatOptions> = {}\n ) {\n const { locales, ...intlOptions } = options;\n return _formatCurrency({\n value,\n currency,\n locales: this.getFormattingLocales(targetLocale, locales),\n options: intlOptions,\n });\n }\n\n formatRelativeTime(\n value: number,\n unit: Intl.RelativeTimeFormatUnit,\n targetLocale?: string,\n options: WithLocales<Intl.RelativeTimeFormatOptions> = {}\n ) {\n const { locales, ...intlOptions } = options;\n return _formatRelativeTime({\n value,\n unit,\n locales: this.getFormattingLocales(targetLocale, locales),\n options: intlOptions,\n });\n }\n\n formatRelativeTimeFromDate(\n date: Date,\n targetLocale?: string,\n options: WithLocales<\n Intl.RelativeTimeFormatOptions & { baseDate?: Date }\n > = {}\n ) {\n const { locales, baseDate, ...intlOptions } = options;\n return _formatRelativeTimeFromDate({\n date,\n baseDate: baseDate ?? new Date(),\n locales: this.getFormattingLocales(targetLocale, locales),\n options: intlOptions,\n });\n }\n\n formatCutoff(\n value: string,\n targetLocale?: string,\n options: WithLocales<CutoffFormatOptions> = {}\n ) {\n const { locales, ...formatOptions } = options;\n return _formatCutoff({\n value,\n locales: this.getFormattingLocales(targetLocale, locales),\n options: formatOptions,\n });\n }\n\n formatMessage(\n message: string,\n targetLocale?: string,\n options: WithLocales<{\n variables?: FormatVariables;\n dataFormat?: StringFormat;\n }> = {}\n ) {\n const { locales, variables, dataFormat } = options;\n if (dataFormat === 'STRING') return _formatMessageString(message);\n return _formatMessageICU(\n message,\n this.getFormattingLocales(targetLocale, locales),\n variables\n );\n }\n\n formatList(\n array: Array<string | number>,\n targetLocale?: string,\n options: WithLocales<Intl.ListFormatOptions> = {}\n ) {\n const { locales, ...intlOptions } = options;\n return _formatList({\n value: array,\n locales: this.getFormattingLocales(targetLocale, locales),\n options: intlOptions,\n });\n }\n\n formatListToParts<T>(\n array: Array<T>,\n targetLocale?: string,\n options: WithLocales<Intl.ListFormatOptions> = {}\n ) {\n const { locales, ...intlOptions } = options;\n return _formatListToParts<T>({\n value: array,\n locales: this.getFormattingLocales(targetLocale, locales),\n options: intlOptions,\n });\n }\n\n getLocaleName(locale: string) {\n return _getLocaleName(locale, this.defaultLocale, this.customMapping);\n }\n\n getLocaleEmoji(locale: string) {\n return _getLocaleEmoji(locale, this.customMapping);\n }\n\n getLocaleProperties(locale: string) {\n return _getLocaleProperties(locale, this.defaultLocale, this.customMapping);\n }\n\n requiresTranslation(\n targetLocale: string,\n sourceLocale: string = this.defaultLocale,\n approvedLocales: string[] | undefined = this.translationLocales\n ) {\n return _requiresTranslation(\n this.resolveCanonicalLocale(sourceLocale),\n this.resolveCanonicalLocale(targetLocale),\n approvedLocales\n ? this.resolveCanonicalLocaleList(approvedLocales)\n : undefined,\n this.customMapping\n );\n }\n\n determineLocale(\n locales: string | string[],\n approvedLocales: string[] = this.locales\n ) {\n const approvedLocalePairs = approvedLocales.map((locale) => ({\n locale,\n canonicalLocale: this.resolveCanonicalLocale(locale),\n }));\n const resolvedLocale = _determineLocale(\n Array.isArray(locales)\n ? this.resolveCanonicalLocaleList(locales)\n : this.resolveCanonicalLocale(locales),\n approvedLocalePairs.map(({ canonicalLocale }) => canonicalLocale),\n this.customMapping\n );\n if (!resolvedLocale) return undefined;\n return (\n approvedLocalePairs.find(\n ({ canonicalLocale }) => canonicalLocale === resolvedLocale\n )?.locale || this.resolveAliasLocale(resolvedLocale)\n );\n }\n\n getLocaleDirection(locale: string) {\n return _getLocaleDirection(this.resolveCanonicalLocale(locale));\n }\n\n isValidLocale(locale: string) {\n return _isValidLocale(locale, this.customMapping);\n }\n\n resolveCanonicalLocale(locale: string) {\n return _resolveCanonicalLocale(locale, this.customMapping);\n }\n\n resolveAliasLocale(locale: string) {\n return _resolveAliasLocale(locale, this.customMapping);\n }\n\n standardizeLocale(locale: string) {\n return _standardizeLocale(locale);\n }\n\n isSameDialect(...locales: (string | string[])[]) {\n return _isSameDialect(...this.resolveCanonicalLocaleArgs(locales));\n }\n\n isSameLanguage(...locales: (string | string[])[]) {\n return _isSameLanguage(...this.resolveCanonicalLocaleArgs(locales));\n }\n\n isSupersetLocale(superLocale: string, subLocale: string) {\n return _isSupersetLocale(\n this.resolveCanonicalLocale(superLocale),\n this.resolveCanonicalLocale(subLocale)\n );\n }\n}\n","import {\n _formatCutoff,\n _formatMessageICU,\n _formatMessageString,\n} from './formatting/format';\nimport type { CutoffFormatOptions } from './formatting/custom-formats/CutoffFormat/types';\nimport { _isValidLocale, _standardizeLocale } from './locales/isValidLocale';\nimport { _resolveCanonicalLocale } from './locales/resolveCanonicalLocale';\nimport type { CustomMapping, FormatVariables } from './types';\nimport type { StringFormat } from './types-dir/jsx/content';\n\nexport {\n LocaleConfig,\n type LocaleConfigConstructorParams,\n} from './LocaleConfig';\n\n/**\n * Core formatting and locale helpers.\n *\n * This entry point exposes deterministic locale and formatting primitives. It\n * does not export the GT service client, project credentials, network\n * translation methods, file APIs, or other server/service concerns from the\n * root `generaltranslation` facade.\n *\n * This entry point is intended for framework and shared packages that need\n * locale metadata or formatting behavior without pulling in the full\n * translation API surface.\n */\n\n/**\n * Formats a string with cutoff behavior, applying a terminator when the string exceeds the maximum character limit.\n *\n * This standalone function provides cutoff formatting functionality without requiring a GT instance.\n * The locales parameter is required for proper terminator selection based on the target language.\n *\n * @param {string} value - The string value to format with cutoff behavior.\n * @param {Object} [options] - Configuration options for cutoff formatting.\n * @param {string | string[]} [options.locales] - The locales to use for terminator selection.\n * @param {number} [options.maxChars] - The maximum number of characters to display.\n * - Undefined values are treated as no cutoff.\n * - Negative values follow .slice() behavior and terminator will be added before the value.\n * - 0 will result in an empty string.\n * - If cutoff results in an empty string, no terminator is added.\n * @param {CutoffFormatStyle} [options.style='ellipsis'] - The style of the terminator.\n * @param {string} [options.terminator] - Optional override the terminator to use.\n * @param {string} [options.separator] - Optional override the separator to use between the terminator and the value.\n * - If no terminator is provided, then separator is ignored.\n * @returns {string} The formatted string with terminator applied if cutoff occurs.\n *\n * @example\n * formatCutoff('Hello, world!', { locales: 'en-US', maxChars: 8 });\n * // Returns: 'Hello, …'\n *\n * @example\n * formatCutoff('Hello, world!', { locales: 'en-US', maxChars: -3 });\n * // Returns: '…d!'\n *\n * @example\n * formatCutoff('Very long text that needs cutting', {\n * locales: 'en-US',\n * maxChars: 15,\n * style: 'ellipsis',\n * separator: ' '\n * });\n * // Returns: 'Very long tex …'\n */\nexport function formatCutoff(\n value: string,\n options?: {\n locales?: string | string[];\n } & CutoffFormatOptions\n) {\n return _formatCutoff({ value, locales: options?.locales, options });\n}\n\n/**\n * Formats a message according to the specified locales and options.\n *\n * @param {string} message - The message to format.\n * @param {Object} [options] - Configuration options for message formatting.\n * @param {string | string[]} [options.locales] - The locales to use for formatting.\n * @param {FormatVariables} [options.variables] - The variables to use for formatting.\n * @param {StringFormat} [options.dataFormat='ICU'] - The format of the message. When STRING, the message is returned as is.\n * @returns {string} The formatted message.\n *\n * @example\n * formatMessage('Hello {name}', { variables: { name: 'John' } });\n * // Returns: \"Hello John\"\n *\n * @example\n * formatMessage('Hello {name}', {\n * locales: ['fr'],\n * variables: { name: 'John' }\n * });\n */\nexport function formatMessage(\n message: string,\n options?: {\n locales?: string | string[];\n variables?: FormatVariables;\n dataFormat?: StringFormat;\n }\n) {\n switch (options?.dataFormat) {\n case 'STRING':\n return _formatMessageString(message);\n default:\n return _formatMessageICU(message, options?.locales, options?.variables);\n }\n}\n\n/**\n * Checks if a given BCP 47 locale code is valid.\n *\n * @param {string} locale - The BCP 47 locale code to validate.\n * @param {CustomMapping} [customMapping] - The custom mapping to use for validation.\n * @returns {boolean} True if the BCP 47 code is valid, false otherwise.\n *\n * @example\n * isValidLocale('en-US');\n * // Returns: true\n *\n * @example\n * isValidLocale('en_US');\n * // Returns: false\n */\nexport function isValidLocale(locale: string, customMapping?: CustomMapping) {\n return _isValidLocale(locale, customMapping);\n}\n\n/**\n * Resolves the canonical locale for a given locale.\n *\n * @param {string} locale - The locale to resolve the canonical locale for.\n * @param {CustomMapping} [customMapping] - The custom mapping to use for resolving the canonical locale.\n * @returns {string} The canonical locale.\n *\n * @example\n * resolveCanonicalLocale('en-US');\n * // Returns: 'en-US'\n *\n * @example\n * resolveCanonicalLocale('en', { en: 'en-US' });\n * // Returns: 'en-US'\n */\nexport function resolveCanonicalLocale(\n locale: string,\n customMapping?: CustomMapping\n) {\n return _resolveCanonicalLocale(locale, customMapping);\n}\n\n/**\n * Standardizes a BCP 47 locale code to ensure correct formatting.\n *\n * @param {string} locale - The BCP 47 locale code to standardize.\n * @returns {string} The standardized BCP 47 locale code or an empty string if it is an invalid code.\n *\n * @example\n * standardizeLocale('en-us');\n * // Returns: 'en-US'\n *\n * @example\n * standardizeLocale('not a locale');\n * // Returns: ''\n */\nexport function standardizeLocale(locale: string) {\n return _standardizeLocale(locale);\n}\n"],"mappings":";;;AAIA,MAAM,mBAAmB;CAAC;CAAQ;CAAQ;CAAQ;CAAQ;CAAQ;CAAO;AAGzE,MAAM,oBAAoB,aAAqB;AAC7C,QAAO,YAAY,SAAS,YAAY;;;;;;;;;AAU1C,MAAa,kBACX,QACA,kBACY;AAEZ,KACE,gBAAgB,WAChB,OAAO,cAAc,YAAY,YACjC,UAAW,cAAc,WACxB,cAAc,QAA6B,KAE5C,UAAU,cAAc,QAA6B;AAGvD,KAAI;EACF,MAAM,EAAE,UAAU,QAAQ,WAAWA,kBAAAA,UAAU,IAAI,UAAU,OAAO;AACpE,MACE,OAAO,MAAM,IAAI,CAAC,kBACX;GACL,IAAI,YAAY;AAChB,OAAI,OAAQ,cAAa;AACzB,OAAI,OAAQ,cAAa;AACzB,UAAO;MACL,CAEJ,QAAO;AAQT,MAP6BA,kBAAAA,UAAU,IACrC,gBACA,CAAA,KAAsB,EACtB,EACE,MAAM,YACP,CAGmB,CAAC,GAAG,SAAS,KAAK,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AAU,wBAAwB,OAAO;AAC7D,MAAI,YAAa,QAAO;EAExB,MAAM,eAAe,aAAa,UAAU;AAE5C,SACE,WAAW,aAAa,aACxB,eAAe,aAAa,UAAU,GAAG;SAErC;AACN,SAAO;;;AAKX,MAAM,oBAAoB;AAC1B,MAAM,qBAAqB;AAC3B,MAAa,eAAe;AAG5B,MAAM,aAAa;CACjB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,KAAK;CACN;AAED,MAAM,sBAAsB;CAC1B,IAAI;CACJ,OAAO;CACR;AAGD,MAAM,cAAc,IAAI,IAAI;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,MAAM,0BAA0B,SAAU,IAAI,WAAW,EAAE;AAE3D,SAAgB,eAAe,QAAwB;AACrD,QAAO,wBAAwB,OAAO,IAAA;;AAGxC,SAAS,wBAAwB,QAAoC;CACnE,MAAM,mBAAmB,OAAO,aAAa;CAC7C,MAAM,eAAe,oBAAoB;AACzC,KAAI,aAAc,QAAO;AAEzB,KAAI,CAAC,YAAY,IAAI,iBAAiB,CAAE,QAAO,KAAA;AAE/C,QAAO,OAAO,cACZ,iBAAiB,WAAW,EAAE,GAAG,yBACjC,iBAAiB,WAAW,EAAE,GAAG,wBAClC;;;;;;;;;;;AC7RH,SAAgB,6BACd,QACA,eACuC;AACvC,KAAI,eAAe;EACjB,IAAI,SAAoC,EAAE;AAC1C,OAAK,MAAM,KAAK,QAAQ;GACtB,MAAM,QAAQ,cAAc;AAC5B,OAAI;QACE,OAAO,UAAU,SACnB,QAAO,SAAS;aACP,MACT,UAAS;KAAE,GAAG;KAAO,GAAG;KAAQ;;;AAItC,SAAO;;;;;;AAQX,SAAwB,qBACtB,QACA,gBAAA,MACA,eACkB;CAElB,MAAM,gBAAgB;AACtB,KAAI,iBAAiB,yBAAyB,QAAQ,cAAc,CAElE,UAAU,cAAc,QAA6B;AAGvD,mBAAA;AAEA,KAAI;EACF,MAAM,qBAAqB,mBAAmB,OAAO;EAErD,MAAM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B,QAAgB;AACrC,SAAO,wBAAwB,QAAQ,KAAK,cAAc;;CAG5D,mBAAmB,QAAgB;AACjC,SAAO,oBAAoB,QAAQ,KAAK,cAAc;;CAGxD,kBAAkB,QAAgB;AAChC,SAAO,mBAAmB,OAAO;;CAGnC,cAAc,GAAG,SAAgC;AAC/C,SAAO,eAAe,GAAG,KAAK,2BAA2B,QAAQ,CAAC;;CAGpE,eAAe,GAAG,SAAgC;AAChD,SAAO,gBAAgB,GAAG,KAAK,2BAA2B,QAAQ,CAAC;;CAGrE,iBAAiB,aAAqB,WAAmB;AACvD,SAAO,kBACL,KAAK,uBAAuB,YAAY,EACxC,KAAK,uBAAuB,UAAU,CACvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AClPL,SAAgB,aACd,OACA,SAGA;AACA,QAAO,cAAc;EAAE;EAAO,SAAS,SAAS;EAAS;EAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;AAuBrE,SAAgB,cACd,SACA,SAKA;AACA,SAAQ,SAAS,YAAjB;EACE,KAAK,SACH,QAAO,qBAAqB,QAAQ;EACtC,QACE,QAAO,kBAAkB,SAAS,SAAS,SAAS,SAAS,UAAU;;;;;;;;;;;;;;;;;;AAmB7E,SAAgB,cAAc,QAAgB,eAA+B;AAC3E,QAAO,eAAe,QAAQ,cAAc;;;;;;;;;;;;;;;;;AAkB9C,SAAgB,uBACd,QACA,eACA;AACA,QAAO,wBAAwB,QAAQ,cAAc;;;;;;;;;;;;;;;;AAiBvD,SAAgB,kBAAkB,QAAgB;AAChD,QAAO,mBAAmB,OAAO"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mt as LocaleProperties, Nt as CustomMapping, Ot as StringFormat, n as FormatVariables } from "./types-NKhpChvT.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/formatting/custom-formats/CutoffFormat/types.d.ts
|
|
4
4
|
/** Type of terminator */
|
|
@@ -206,4 +206,4 @@ declare function resolveCanonicalLocale(locale: string, customMapping?: CustomMa
|
|
|
206
206
|
declare function standardizeLocale(locale: string): string;
|
|
207
207
|
//#endregion
|
|
208
208
|
export { standardizeLocale as a, CutoffFormatOptions as c, resolveCanonicalLocale as i, formatMessage as n, LocaleConfig as o, isValidLocale as r, LocaleConfigConstructorParams as s, formatCutoff as t };
|
|
209
|
-
//# sourceMappingURL=core-
|
|
209
|
+
//# sourceMappingURL=core-6rY3oy32.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mt as LocaleProperties, Nt as CustomMapping, Ot as StringFormat, n as FormatVariables } from "./types-Cy8q2XZX.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/formatting/custom-formats/CutoffFormat/types.d.ts
|
|
4
4
|
/** Type of terminator */
|
|
@@ -206,4 +206,4 @@ declare function resolveCanonicalLocale(locale: string, customMapping?: CustomMa
|
|
|
206
206
|
declare function standardizeLocale(locale: string): string;
|
|
207
207
|
//#endregion
|
|
208
208
|
export { standardizeLocale as a, CutoffFormatOptions as c, resolveCanonicalLocale as i, formatMessage as n, LocaleConfig as o, isValidLocale as r, LocaleConfigConstructorParams as s, formatCutoff as t };
|
|
209
|
-
//# sourceMappingURL=core-
|
|
209
|
+
//# sourceMappingURL=core-BYVWty_t.d.mts.map
|