generaltranslation 8.2.13 → 8.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/{ApiError-IYfaOR30.mjs → ApiError-0DxxIHLp.mjs} +1 -1
- package/dist/{ApiError-CZ45tkW6.cjs.map → ApiError-0DxxIHLp.mjs.map} +1 -1
- package/dist/{ApiError-CZ45tkW6.cjs → ApiError-D-IBuHj6.cjs} +1 -1
- package/dist/{ApiError-IYfaOR30.mjs.map → ApiError-D-IBuHj6.cjs.map} +1 -1
- package/dist/LocaleConfig.d.ts +1 -59
- package/dist/LocaleConfig.js +1 -225
- package/dist/{base64-2fu94Klt.cjs → base64-C6BHySOc.cjs} +17 -1
- package/dist/base64-C6BHySOc.cjs.map +1 -0
- package/dist/{base64-DH0STixb.mjs → base64-CWITCfhU.mjs} +6 -2
- package/dist/base64-CWITCfhU.mjs.map +1 -0
- package/dist/core.cjs +9 -8
- package/dist/core.d.cts +1 -2
- package/dist/core.d.mts +1 -2
- package/dist/core.d.ts +1 -128
- package/dist/core.js +1 -137
- package/dist/core.mjs +2 -2
- package/dist/derive/indexVars.d.ts +1 -1
- package/dist/errors.cjs +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/id/types.d.ts +1 -1
- package/dist/{id-CyiXsQrY.cjs → id-C2orn1MA.cjs} +2 -2
- package/dist/{id-CyiXsQrY.cjs.map → id-C2orn1MA.cjs.map} +1 -1
- package/dist/{id-DbD7K-HL.mjs → id-DEaFhGqX.mjs} +2 -2
- package/dist/{id-DbD7K-HL.mjs.map → id-DEaFhGqX.mjs.map} +1 -1
- package/dist/id.cjs +1 -1
- package/dist/id.d.cts +1 -1
- package/dist/id.d.mts +1 -1
- package/dist/id.mjs +1 -1
- package/dist/index.cjs +368 -385
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -242
- package/dist/index.d.mts +4 -242
- package/dist/index.d.ts +5 -238
- package/dist/index.js +3 -322
- package/dist/index.mjs +215 -352
- package/dist/index.mjs.map +1 -1
- package/dist/internal.cjs +6 -6
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +6 -5
- package/dist/internal.d.mts +6 -5
- package/dist/internal.mjs +4 -4
- package/dist/internal.mjs.map +1 -1
- package/dist/{isVariable-B08mggBy.cjs → isVariable-Ba1gLXdB.cjs} +1 -1
- package/dist/{isVariable-B08mggBy.cjs.map → isVariable-Ba1gLXdB.cjs.map} +1 -1
- package/dist/{isVariable-CYsKFHvR.mjs → isVariable-fAKEB7gF.mjs} +1 -1
- package/dist/{isVariable-CYsKFHvR.mjs.map → isVariable-fAKEB7gF.mjs.map} +1 -1
- package/dist/locales/getPluralForm.js +2 -2
- package/dist/logging/logger.d.ts +0 -3
- package/dist/logging/logger.js +0 -3
- package/dist/{types-AHtYZIP-.d.mts → types-73XFwmhH.d.mts} +7 -106
- package/dist/{types-Bf8_Apq_.d.cts → types-YrrGRHBP.d.cts} +7 -106
- package/dist/types-dir/api/enqueueEntries.d.ts +1 -1
- package/dist/types-dir/api/enqueueFiles.d.ts +1 -1
- package/dist/types-dir/api/fetchTranslations.d.ts +1 -1
- package/dist/types-dir/api/file.d.ts +1 -1
- package/dist/types-dir/api/translate.d.ts +1 -1
- package/dist/types-dir/api/uploadFiles.d.ts +1 -1
- package/dist/types.cjs +7 -16
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/dist/types.d.ts +10 -12
- package/dist/types.js +1 -2
- package/dist/types.mjs +1 -15
- package/package.json +3 -2
- package/dist/IntlCache-CAW8tKhd.cjs +0 -212
- package/dist/IntlCache-CAW8tKhd.cjs.map +0 -1
- package/dist/IntlCache-WZk0rKvj.mjs +0 -195
- package/dist/IntlCache-WZk0rKvj.mjs.map +0 -1
- package/dist/base64-2fu94Klt.cjs.map +0 -1
- package/dist/base64-DH0STixb.mjs.map +0 -1
- package/dist/cache/IntlCache.d.ts +0 -26
- package/dist/cache/IntlCache.js +0 -84
- package/dist/cache/types.d.ts +0 -32
- package/dist/cache/types.js +0 -1
- package/dist/core-7RP541eY.cjs +0 -1677
- package/dist/core-7RP541eY.cjs.map +0 -1
- package/dist/core-I9pWGafA.d.mts +0 -209
- package/dist/core-TLJoDpJP.d.cts +0 -209
- package/dist/core-isLphYAZ.mjs +0 -1498
- package/dist/core-isLphYAZ.mjs.map +0 -1
- package/dist/errors/formattingErrors.d.ts +0 -1
- package/dist/errors/formattingErrors.js +0 -3
- package/dist/formatting/custom-formats/CutoffFormat/CutoffFormat.d.ts +0 -59
- package/dist/formatting/custom-formats/CutoffFormat/CutoffFormat.js +0 -147
- package/dist/formatting/custom-formats/CutoffFormat/constants.d.ts +0 -4
- package/dist/formatting/custom-formats/CutoffFormat/constants.js +0 -30
- package/dist/formatting/custom-formats/CutoffFormat/types.d.ts +0 -48
- package/dist/formatting/custom-formats/CutoffFormat/types.js +0 -2
- package/dist/formatting/format.d.ts +0 -1
- package/dist/formatting/format.js +0 -257
- package/dist/locales/customLocaleMapping.d.ts +0 -11
- package/dist/locales/customLocaleMapping.js +0 -23
- package/dist/locales/determineLocale.d.ts +0 -1
- package/dist/locales/determineLocale.js +0 -72
- package/dist/locales/getLocaleDirection.d.ts +0 -1
- package/dist/locales/getLocaleDirection.js +0 -89
- package/dist/locales/getLocaleEmoji.d.ts +0 -2
- package/dist/locales/getLocaleEmoji.js +0 -319
- package/dist/locales/getLocaleName.d.ts +0 -1
- package/dist/locales/getLocaleName.js +0 -45
- package/dist/locales/getLocaleProperties.d.ts +0 -32
- package/dist/locales/getLocaleProperties.js +0 -220
- package/dist/locales/getRegionProperties.d.ts +0 -7
- package/dist/locales/getRegionProperties.js +0 -61
- package/dist/locales/isSameDialect.d.ts +0 -1
- package/dist/locales/isSameDialect.js +0 -41
- package/dist/locales/isSameLanguage.d.ts +0 -1
- package/dist/locales/isSameLanguage.js +0 -20
- package/dist/locales/isSupersetLocale.d.ts +0 -1
- package/dist/locales/isSupersetLocale.js +0 -22
- package/dist/locales/isValidLocale.d.ts +0 -1
- package/dist/locales/isValidLocale.js +0 -75
- package/dist/locales/requiresTranslation.d.ts +0 -1
- package/dist/locales/requiresTranslation.js +0 -32
- package/dist/locales/resolveAliasLocale.d.ts +0 -8
- package/dist/locales/resolveAliasLocale.js +0 -21
- package/dist/locales/resolveCanonicalLocale.d.ts +0 -8
- package/dist/locales/resolveCanonicalLocale.js +0 -13
- package/dist/logging/warnings.d.ts +0 -2
- package/dist/logging/warnings.js +0 -2
- package/dist/types-dir/jsx/content.d.ts +0 -61
- package/dist/types-dir/jsx/content.js +0 -11
- package/dist/types-dir/jsx/variables.d.ts +0 -9
- package/dist/types-dir/jsx/variables.js +0 -1
- package/dist/types.cjs.map +0 -1
- package/dist/types.mjs.map +0 -1
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
import { intlCache } from '../cache/IntlCache';
|
|
2
|
-
import { getCustomProperty, shouldUseCanonicalLocale, } from './customLocaleMapping';
|
|
3
|
-
import { _standardizeLocale } from './isValidLocale';
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export default function _getLocaleEmoji(locale, customMapping) {
|
|
8
|
-
var aliasedLocale = locale;
|
|
9
|
-
if (customMapping && shouldUseCanonicalLocale(locale, customMapping)) {
|
|
10
|
-
locale = customMapping[locale].code;
|
|
11
|
-
}
|
|
12
|
-
try {
|
|
13
|
-
var standardizedLocale = _standardizeLocale(locale);
|
|
14
|
-
var localeObject = intlCache.get('Locale', standardizedLocale);
|
|
15
|
-
var language = localeObject.language, region = localeObject.region;
|
|
16
|
-
if (customMapping) {
|
|
17
|
-
for (var _i = 0, _a = [aliasedLocale, locale, standardizedLocale, language]; _i < _a.length; _i++) {
|
|
18
|
-
var l = _a[_i];
|
|
19
|
-
var customEmoji = getCustomProperty(customMapping, l, 'emoji');
|
|
20
|
-
if (customEmoji)
|
|
21
|
-
return customEmoji;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
var regionEmoji = region && getSupportedRegionEmoji(region);
|
|
25
|
-
if (regionEmoji)
|
|
26
|
-
return regionEmoji;
|
|
27
|
-
var extrapolated = localeObject.maximize();
|
|
28
|
-
return (exceptions[extrapolated.language] ||
|
|
29
|
-
getRegionEmoji(extrapolated.region || ''));
|
|
30
|
-
}
|
|
31
|
-
catch (_b) {
|
|
32
|
-
return defaultEmoji;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
// Default language emoji for when none else can be found
|
|
36
|
-
var europeAfricaGlobe = '🌍';
|
|
37
|
-
var asiaAustraliaGlobe = '🌏';
|
|
38
|
-
export var defaultEmoji = europeAfricaGlobe;
|
|
39
|
-
// Exceptions to better reflect linguistic and cultural identities
|
|
40
|
-
var exceptions = {
|
|
41
|
-
ca: europeAfricaGlobe,
|
|
42
|
-
eu: europeAfricaGlobe,
|
|
43
|
-
ku: europeAfricaGlobe,
|
|
44
|
-
bo: asiaAustraliaGlobe,
|
|
45
|
-
ug: asiaAustraliaGlobe,
|
|
46
|
-
gd: '🏴',
|
|
47
|
-
cy: '🏴',
|
|
48
|
-
gv: '🇮🇲',
|
|
49
|
-
grc: '🏺',
|
|
50
|
-
};
|
|
51
|
-
var specialRegionEmojis = {
|
|
52
|
-
EU: '🇪🇺',
|
|
53
|
-
'419': '🌎',
|
|
54
|
-
};
|
|
55
|
-
// Regions with Unicode regional-indicator flag sequences.
|
|
56
|
-
var flagRegions = new Set([
|
|
57
|
-
'AF', // Afghanistan
|
|
58
|
-
'AX', // Åland Islands
|
|
59
|
-
'AL', // Albania
|
|
60
|
-
'DZ', // Algeria
|
|
61
|
-
'AS', // American Samoa
|
|
62
|
-
'AD', // Andorra
|
|
63
|
-
'AO', // Angola
|
|
64
|
-
'AI', // Anguilla
|
|
65
|
-
'AQ', // Antarctica
|
|
66
|
-
'AG', // Antigua and Barbuda
|
|
67
|
-
'AR', // Argentina
|
|
68
|
-
'AM', // Armenia
|
|
69
|
-
'AW', // Aruba
|
|
70
|
-
'AU', // Australia
|
|
71
|
-
'AT', // Austria
|
|
72
|
-
'AZ', // Azerbaijan
|
|
73
|
-
'BS', // Bahamas
|
|
74
|
-
'BH', // Bahrain
|
|
75
|
-
'BD', // Bangladesh
|
|
76
|
-
'BB', // Barbados
|
|
77
|
-
'BY', // Belarus
|
|
78
|
-
'BE', // Belgium
|
|
79
|
-
'BZ', // Belize
|
|
80
|
-
'BJ', // Benin
|
|
81
|
-
'BM', // Bermuda
|
|
82
|
-
'BT', // Bhutan
|
|
83
|
-
'BO', // Bolivia
|
|
84
|
-
'BQ', // Bonaire, Sint Eustatius and Saba
|
|
85
|
-
'BA', // Bosnia and Herzegovina
|
|
86
|
-
'BW', // Botswana
|
|
87
|
-
'BV', // Bouvet Island
|
|
88
|
-
'BR', // Brazil
|
|
89
|
-
'IO', // British Indian Ocean Territory
|
|
90
|
-
'BN', // Brunei Darussalam
|
|
91
|
-
'BG', // Bulgaria
|
|
92
|
-
'BF', // Burkina Faso
|
|
93
|
-
'BI', // Burundi
|
|
94
|
-
'CV', // Cabo Verde
|
|
95
|
-
'KH', // Cambodia
|
|
96
|
-
'CM', // Cameroon
|
|
97
|
-
'CA', // Canada
|
|
98
|
-
'KY', // Cayman Islands
|
|
99
|
-
'CF', // Central African Republic
|
|
100
|
-
'TD', // Chad
|
|
101
|
-
'CL', // Chile
|
|
102
|
-
'CN', // China
|
|
103
|
-
'CX', // Christmas Island
|
|
104
|
-
'CC', // Cocos (Keeling) Islands
|
|
105
|
-
'CO', // Colombia
|
|
106
|
-
'KM', // Comoros
|
|
107
|
-
'CD', // Congo (Democratic Republic)
|
|
108
|
-
'CG', // Congo (Republic)
|
|
109
|
-
'CK', // Cook Islands
|
|
110
|
-
'CR', // Costa Rica
|
|
111
|
-
'CI', // Côte d'Ivoire
|
|
112
|
-
'HR', // Croatia
|
|
113
|
-
'CU', // Cuba
|
|
114
|
-
'CW', // Curaçao
|
|
115
|
-
'CY', // Cyprus
|
|
116
|
-
'CZ', // Czechia
|
|
117
|
-
'DK', // Denmark
|
|
118
|
-
'DJ', // Djibouti
|
|
119
|
-
'DM', // Dominica
|
|
120
|
-
'DO', // Dominican Republic
|
|
121
|
-
'EC', // Ecuador
|
|
122
|
-
'EG', // Egypt
|
|
123
|
-
'SV', // El Salvador
|
|
124
|
-
'GQ', // Equatorial Guinea
|
|
125
|
-
'ER', // Eritrea
|
|
126
|
-
'EE', // Estonia
|
|
127
|
-
'SZ', // Eswatini
|
|
128
|
-
'ET', // Ethiopia
|
|
129
|
-
'FK', // Falkland Islands
|
|
130
|
-
'FO', // Faroe Islands
|
|
131
|
-
'FJ', // Fiji
|
|
132
|
-
'FI', // Finland
|
|
133
|
-
'FR', // France
|
|
134
|
-
'GF', // French Guiana
|
|
135
|
-
'PF', // French Polynesia
|
|
136
|
-
'TF', // French Southern Territories
|
|
137
|
-
'GA', // Gabon
|
|
138
|
-
'GM', // Gambia
|
|
139
|
-
'GE', // Georgia
|
|
140
|
-
'DE', // Germany
|
|
141
|
-
'GH', // Ghana
|
|
142
|
-
'GI', // Gibraltar
|
|
143
|
-
'GR', // Greece
|
|
144
|
-
'GL', // Greenland
|
|
145
|
-
'GD', // Grenada
|
|
146
|
-
'GP', // Guadeloupe
|
|
147
|
-
'GU', // Guam
|
|
148
|
-
'GT', // Guatemala
|
|
149
|
-
'GG', // Guernsey
|
|
150
|
-
'GN', // Guinea
|
|
151
|
-
'GW', // Guinea-Bissau
|
|
152
|
-
'GY', // Guyana
|
|
153
|
-
'HT', // Haiti
|
|
154
|
-
'HM', // Heard Island and McDonald Islands
|
|
155
|
-
'VA', // Holy See
|
|
156
|
-
'HN', // Honduras
|
|
157
|
-
'HK', // Hong Kong
|
|
158
|
-
'HU', // Hungary
|
|
159
|
-
'IS', // Iceland
|
|
160
|
-
'IN', // India
|
|
161
|
-
'ID', // Indonesia
|
|
162
|
-
'IR', // Iran
|
|
163
|
-
'IQ', // Iraq
|
|
164
|
-
'IE', // Ireland
|
|
165
|
-
'IM', // Isle of Man
|
|
166
|
-
'IL', // Israel
|
|
167
|
-
'IT', // Italy
|
|
168
|
-
'JM', // Jamaica
|
|
169
|
-
'JP', // Japan
|
|
170
|
-
'JE', // Jersey
|
|
171
|
-
'JO', // Jordan
|
|
172
|
-
'KZ', // Kazakhstan
|
|
173
|
-
'KE', // Kenya
|
|
174
|
-
'KI', // Kiribati
|
|
175
|
-
'KP', // Korea (North)
|
|
176
|
-
'KR', // Korea (South)
|
|
177
|
-
'KW', // Kuwait
|
|
178
|
-
'KG', // Kyrgyzstan
|
|
179
|
-
'LA', // Laos
|
|
180
|
-
'LV', // Latvia
|
|
181
|
-
'LB', // Lebanon
|
|
182
|
-
'LS', // Lesotho
|
|
183
|
-
'LR', // Liberia
|
|
184
|
-
'LY', // Libya
|
|
185
|
-
'LI', // Liechtenstein
|
|
186
|
-
'LT', // Lithuania
|
|
187
|
-
'LU', // Luxembourg
|
|
188
|
-
'MO', // Macao
|
|
189
|
-
'MG', // Madagascar
|
|
190
|
-
'MW', // Malawi
|
|
191
|
-
'MY', // Malaysia
|
|
192
|
-
'MV', // Maldives
|
|
193
|
-
'ML', // Mali
|
|
194
|
-
'MT', // Malta
|
|
195
|
-
'MH', // Marshall Islands
|
|
196
|
-
'MQ', // Martinique
|
|
197
|
-
'MR', // Mauritania
|
|
198
|
-
'MU', // Mauritius
|
|
199
|
-
'YT', // Mayotte
|
|
200
|
-
'MX', // Mexico
|
|
201
|
-
'FM', // Micronesia
|
|
202
|
-
'MD', // Moldova
|
|
203
|
-
'MC', // Monaco
|
|
204
|
-
'MN', // Mongolia
|
|
205
|
-
'ME', // Montenegro
|
|
206
|
-
'MS', // Montserrat
|
|
207
|
-
'MA', // Morocco
|
|
208
|
-
'MZ', // Mozambique
|
|
209
|
-
'MM', // Myanmar
|
|
210
|
-
'NA', // Namibia
|
|
211
|
-
'NR', // Nauru
|
|
212
|
-
'NP', // Nepal
|
|
213
|
-
'NL', // Netherlands
|
|
214
|
-
'NC', // New Caledonia
|
|
215
|
-
'NZ', // New Zealand
|
|
216
|
-
'NI', // Nicaragua
|
|
217
|
-
'NE', // Niger
|
|
218
|
-
'NG', // Nigeria
|
|
219
|
-
'NU', // Niue
|
|
220
|
-
'NF', // Norfolk Island
|
|
221
|
-
'MK', // North Macedonia
|
|
222
|
-
'MP', // Northern Mariana Islands
|
|
223
|
-
'NO', // Norway
|
|
224
|
-
'OM', // Oman
|
|
225
|
-
'PK', // Pakistan
|
|
226
|
-
'PW', // Palau
|
|
227
|
-
'PS', // Palestine, State of
|
|
228
|
-
'PA', // Panama
|
|
229
|
-
'PG', // Papua New Guinea
|
|
230
|
-
'PY', // Paraguay
|
|
231
|
-
'PE', // Peru
|
|
232
|
-
'PH', // Philippines
|
|
233
|
-
'PN', // Pitcairn
|
|
234
|
-
'PL', // Poland
|
|
235
|
-
'PT', // Portugal
|
|
236
|
-
'PR', // Puerto Rico
|
|
237
|
-
'QA', // Qatar
|
|
238
|
-
'RE', // Réunion
|
|
239
|
-
'RO', // Romania
|
|
240
|
-
'RU', // Russian Federation
|
|
241
|
-
'RW', // Rwanda
|
|
242
|
-
'BL', // Saint Barthélemy
|
|
243
|
-
'SH', // Saint Helena, Ascension and Tristan da Cunha
|
|
244
|
-
'KN', // Saint Kitts and Nevis
|
|
245
|
-
'LC', // Saint Lucia
|
|
246
|
-
'MF', // Saint Martin (French part)
|
|
247
|
-
'PM', // Saint Pierre and Miquelon
|
|
248
|
-
'VC', // Saint Vincent and the Grenadines
|
|
249
|
-
'WS', // Samoa
|
|
250
|
-
'SM', // San Marino
|
|
251
|
-
'ST', // São Tomé and Príncipe
|
|
252
|
-
'SA', // Saudi Arabia
|
|
253
|
-
'SN', // Senegal
|
|
254
|
-
'RS', // Serbia
|
|
255
|
-
'SC', // Seychelles
|
|
256
|
-
'SL', // Sierra Leone
|
|
257
|
-
'SG', // Singapore
|
|
258
|
-
'SX', // Sint Maarten (Dutch part)
|
|
259
|
-
'SK', // Slovakia
|
|
260
|
-
'SI', // Slovenia
|
|
261
|
-
'SB', // Solomon Islands
|
|
262
|
-
'SO', // Somalia
|
|
263
|
-
'ZA', // South Africa
|
|
264
|
-
'GS', // South Georgia and the South Sandwich Islands
|
|
265
|
-
'SS', // South Sudan
|
|
266
|
-
'ES', // Spain
|
|
267
|
-
'LK', // Sri Lanka
|
|
268
|
-
'SD', // Sudan
|
|
269
|
-
'SR', // Suriname
|
|
270
|
-
'SJ', // Svalbard and Jan Mayen
|
|
271
|
-
'SE', // Sweden
|
|
272
|
-
'CH', // Switzerland
|
|
273
|
-
'SY', // Syrian Arab Republic
|
|
274
|
-
'TW', // Taiwan
|
|
275
|
-
'TJ', // Tajikistan
|
|
276
|
-
'TZ', // Tanzania
|
|
277
|
-
'TH', // Thailand
|
|
278
|
-
'TL', // Timor-Leste
|
|
279
|
-
'TG', // Togo
|
|
280
|
-
'TK', // Tokelau
|
|
281
|
-
'TO', // Tonga
|
|
282
|
-
'TT', // Trinidad and Tobago
|
|
283
|
-
'TN', // Tunisia
|
|
284
|
-
'TR', // Türkiye
|
|
285
|
-
'TM', // Turkmenistan
|
|
286
|
-
'TC', // Turks and Caicos Islands
|
|
287
|
-
'TV', // Tuvalu
|
|
288
|
-
'UG', // Uganda
|
|
289
|
-
'UA', // Ukraine
|
|
290
|
-
'AE', // United Arab Emirates
|
|
291
|
-
'GB', // United Kingdom
|
|
292
|
-
'US', // United States of America
|
|
293
|
-
'UM', // United States Minor Outlying Islands
|
|
294
|
-
'UY', // Uruguay
|
|
295
|
-
'UZ', // Uzbekistan
|
|
296
|
-
'VU', // Vanuatu
|
|
297
|
-
'VE', // Venezuela
|
|
298
|
-
'VN', // Viet Nam
|
|
299
|
-
'VG', // Virgin Islands (British)
|
|
300
|
-
'VI', // Virgin Islands (U.S.)
|
|
301
|
-
'WF', // Wallis and Futuna
|
|
302
|
-
'EH', // Western Sahara
|
|
303
|
-
'YE', // Yemen
|
|
304
|
-
'ZM', // Zambia
|
|
305
|
-
'ZW', // Zimbabwe
|
|
306
|
-
]);
|
|
307
|
-
var regionalIndicatorOffset = 0x1f1e6 - 'A'.charCodeAt(0);
|
|
308
|
-
export function getRegionEmoji(region) {
|
|
309
|
-
return getSupportedRegionEmoji(region) || defaultEmoji;
|
|
310
|
-
}
|
|
311
|
-
function getSupportedRegionEmoji(region) {
|
|
312
|
-
var normalizedRegion = region.toUpperCase();
|
|
313
|
-
var specialEmoji = specialRegionEmojis[normalizedRegion];
|
|
314
|
-
if (specialEmoji)
|
|
315
|
-
return specialEmoji;
|
|
316
|
-
if (!flagRegions.has(normalizedRegion))
|
|
317
|
-
return undefined;
|
|
318
|
-
return String.fromCodePoint(normalizedRegion.charCodeAt(0) + regionalIndicatorOffset, normalizedRegion.charCodeAt(1) + regionalIndicatorOffset);
|
|
319
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { intlCache } from '../cache/IntlCache';
|
|
2
|
-
import { libraryDefaultLocale } from '../settings/settings';
|
|
3
|
-
import { getCustomProperty, shouldUseCanonicalLocale, } from './customLocaleMapping';
|
|
4
|
-
import { _standardizeLocale } from './isValidLocale';
|
|
5
|
-
/**
|
|
6
|
-
* Retrieves the display name(s) of locale code(s) using Intl.DisplayNames.
|
|
7
|
-
*
|
|
8
|
-
* @param {string} locale - A BCP-47 locale code.
|
|
9
|
-
* @param {string} [defaultLocale=libraryDefaultLocale] - The locale for display names.
|
|
10
|
-
* @returns {string} The display name(s) corresponding to the code(s), or empty string(s) if invalid.
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
export function _getLocaleName(locale, defaultLocale, customMapping) {
|
|
14
|
-
if (defaultLocale === void 0) { defaultLocale = libraryDefaultLocale; }
|
|
15
|
-
// Check for canonical locale
|
|
16
|
-
var aliasedLocale = locale;
|
|
17
|
-
if (customMapping && shouldUseCanonicalLocale(locale, customMapping)) {
|
|
18
|
-
// Override locale with canonical locale
|
|
19
|
-
locale = customMapping[locale].code;
|
|
20
|
-
}
|
|
21
|
-
defaultLocale || (defaultLocale = libraryDefaultLocale);
|
|
22
|
-
try {
|
|
23
|
-
var standardizedLocale = _standardizeLocale(locale);
|
|
24
|
-
if (customMapping) {
|
|
25
|
-
for (var _i = 0, _a = [
|
|
26
|
-
aliasedLocale,
|
|
27
|
-
locale,
|
|
28
|
-
standardizedLocale,
|
|
29
|
-
intlCache.get('Locale', standardizedLocale).language,
|
|
30
|
-
]; _i < _a.length; _i++) {
|
|
31
|
-
var l = _a[_i];
|
|
32
|
-
var customName = getCustomProperty(customMapping, l, 'name');
|
|
33
|
-
if (customName)
|
|
34
|
-
return customName;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
var displayNames = intlCache.get('DisplayNames', [defaultLocale, standardizedLocale, libraryDefaultLocale], // default locale order
|
|
38
|
-
{ type: 'language' });
|
|
39
|
-
return displayNames.of(standardizedLocale) || '';
|
|
40
|
-
}
|
|
41
|
-
catch (_b) {
|
|
42
|
-
// In case Intl.DisplayNames construction fails, return empty string(s)
|
|
43
|
-
return '';
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { CustomMapping } from './customLocaleMapping';
|
|
2
|
-
export type LocaleProperties = {
|
|
3
|
-
code: string;
|
|
4
|
-
name: string;
|
|
5
|
-
nativeName: string;
|
|
6
|
-
languageCode: string;
|
|
7
|
-
languageName: string;
|
|
8
|
-
nativeLanguageName: string;
|
|
9
|
-
nameWithRegionCode: string;
|
|
10
|
-
nativeNameWithRegionCode: string;
|
|
11
|
-
regionCode: string;
|
|
12
|
-
regionName: string;
|
|
13
|
-
nativeRegionName: string;
|
|
14
|
-
scriptCode: string;
|
|
15
|
-
scriptName: string;
|
|
16
|
-
nativeScriptName: string;
|
|
17
|
-
maximizedCode: string;
|
|
18
|
-
maximizedName: string;
|
|
19
|
-
nativeMaximizedName: string;
|
|
20
|
-
minimizedCode: string;
|
|
21
|
-
minimizedName: string;
|
|
22
|
-
nativeMinimizedName: string;
|
|
23
|
-
emoji: string;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Creates a set of custom locale properties from a custom mapping.
|
|
27
|
-
*
|
|
28
|
-
* @param lArray - An array of locale codes to search for in the custom mapping.
|
|
29
|
-
* @param customMapping - Optional custom mapping of locale codes to names.
|
|
30
|
-
* @returns A partial set of locale properties, or undefined if no custom mapping is provided.
|
|
31
|
-
*/
|
|
32
|
-
export declare function createCustomLocaleProperties(lArray: string[], customMapping?: CustomMapping): Partial<LocaleProperties> | undefined;
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { libraryDefaultLocale } from '../settings/settings';
|
|
13
|
-
import { defaultEmoji } from './getLocaleEmoji';
|
|
14
|
-
import { _isValidLocale, _standardizeLocale } from './isValidLocale';
|
|
15
|
-
import _getLocaleEmoji from './getLocaleEmoji';
|
|
16
|
-
import { intlCache } from '../cache/IntlCache';
|
|
17
|
-
import { shouldUseCanonicalLocale } from './customLocaleMapping';
|
|
18
|
-
/**
|
|
19
|
-
* Creates a set of custom locale properties from a custom mapping.
|
|
20
|
-
*
|
|
21
|
-
* @param lArray - An array of locale codes to search for in the custom mapping.
|
|
22
|
-
* @param customMapping - Optional custom mapping of locale codes to names.
|
|
23
|
-
* @returns A partial set of locale properties, or undefined if no custom mapping is provided.
|
|
24
|
-
*/
|
|
25
|
-
export function createCustomLocaleProperties(lArray, customMapping) {
|
|
26
|
-
if (customMapping) {
|
|
27
|
-
var merged = {};
|
|
28
|
-
for (var _i = 0, lArray_1 = lArray; _i < lArray_1.length; _i++) {
|
|
29
|
-
var l = lArray_1[_i];
|
|
30
|
-
var value = customMapping[l];
|
|
31
|
-
if (value) {
|
|
32
|
-
if (typeof value === 'string') {
|
|
33
|
-
merged.name || (merged.name = value);
|
|
34
|
-
}
|
|
35
|
-
else if (value) {
|
|
36
|
-
merged = __assign(__assign({}, value), merged);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return merged;
|
|
41
|
-
}
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
export default function _getLocaleProperties(locale, defaultLocale, customMapping) {
|
|
48
|
-
if (defaultLocale === void 0) { defaultLocale = libraryDefaultLocale; }
|
|
49
|
-
// Check for canonical locale
|
|
50
|
-
var aliasedLocale = locale;
|
|
51
|
-
if (customMapping && shouldUseCanonicalLocale(locale, customMapping)) {
|
|
52
|
-
// Override locale with canonical locale
|
|
53
|
-
locale = customMapping[locale].code;
|
|
54
|
-
}
|
|
55
|
-
defaultLocale || (defaultLocale = libraryDefaultLocale);
|
|
56
|
-
try {
|
|
57
|
-
var standardizedLocale = _standardizeLocale(locale); // "de-AT"
|
|
58
|
-
var localeObject = intlCache.get('Locale', locale);
|
|
59
|
-
var languageCode = localeObject.language; // "de"
|
|
60
|
-
var customLocaleProperties = createCustomLocaleProperties([aliasedLocale, locale, standardizedLocale, languageCode], customMapping);
|
|
61
|
-
var baseRegion = localeObject.region; // "AT"
|
|
62
|
-
var maximizedLocale = localeObject.maximize();
|
|
63
|
-
var maximizedCode = maximizedLocale.toString(); // "de-Latn-AT"
|
|
64
|
-
var regionCode = localeObject.region ||
|
|
65
|
-
(customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.regionCode) ||
|
|
66
|
-
maximizedLocale.region ||
|
|
67
|
-
''; // "AT"
|
|
68
|
-
var scriptCode = localeObject.script ||
|
|
69
|
-
(customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.scriptCode) ||
|
|
70
|
-
maximizedLocale.script ||
|
|
71
|
-
''; // "Latn"
|
|
72
|
-
var minimizedLocale = localeObject.minimize();
|
|
73
|
-
var minimizedCode = minimizedLocale.toString(); // "de-AT"
|
|
74
|
-
// Language names (default and native)
|
|
75
|
-
var defaultLanguageOrder = [defaultLocale, locale, libraryDefaultLocale];
|
|
76
|
-
var nativeLanguageOrder = [locale, defaultLocale, libraryDefaultLocale];
|
|
77
|
-
var languageNames = intlCache.get('DisplayNames', defaultLanguageOrder, {
|
|
78
|
-
type: 'language',
|
|
79
|
-
});
|
|
80
|
-
var nativeLanguageNames = intlCache.get('DisplayNames', nativeLanguageOrder, { type: 'language' });
|
|
81
|
-
var customName = customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.name;
|
|
82
|
-
var customNativeName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.nativeName) || (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.name);
|
|
83
|
-
var name = customName || languageNames.of(locale) || locale; // "Austrian German"
|
|
84
|
-
var nativeName = customNativeName || nativeLanguageNames.of(locale) || locale; // "Österreichisches Deutsch"
|
|
85
|
-
var maximizedName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.maximizedName) ||
|
|
86
|
-
customName ||
|
|
87
|
-
languageNames.of(maximizedCode) ||
|
|
88
|
-
locale; // "Austrian German (Latin)"
|
|
89
|
-
var nativeMaximizedName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.nativeMaximizedName) ||
|
|
90
|
-
customNativeName ||
|
|
91
|
-
nativeLanguageNames.of(maximizedCode) ||
|
|
92
|
-
locale; // "Österreichisches Deutsch (Lateinisch)"
|
|
93
|
-
var minimizedName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.minimizedName) ||
|
|
94
|
-
customName ||
|
|
95
|
-
languageNames.of(minimizedCode) ||
|
|
96
|
-
locale; // "Austrian German", but for "de-DE" would just be "German"
|
|
97
|
-
var nativeMinimizedName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.nativeMinimizedName) ||
|
|
98
|
-
customNativeName ||
|
|
99
|
-
nativeLanguageNames.of(minimizedCode) ||
|
|
100
|
-
locale; // "Österreichisches Deutsch", but for "de-DE" would just be "Deutsch"
|
|
101
|
-
var languageName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.languageName) ||
|
|
102
|
-
customName ||
|
|
103
|
-
languageNames.of(languageCode) ||
|
|
104
|
-
locale; // "German"
|
|
105
|
-
var nativeLanguageName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.nativeLanguageName) ||
|
|
106
|
-
customNativeName ||
|
|
107
|
-
nativeLanguageNames.of(languageCode) ||
|
|
108
|
-
locale; // "Deutsch"
|
|
109
|
-
var nameWithRegionCode = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.nameWithRegionCode) || baseRegion
|
|
110
|
-
? "".concat(languageName, " (").concat(baseRegion, ")")
|
|
111
|
-
: name; // German (AT)
|
|
112
|
-
var nativeNameWithRegionCode = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.nativeNameWithRegionCode) ||
|
|
113
|
-
(baseRegion ? "".concat(nativeLanguageName, " (").concat(baseRegion, ")") : nativeName) ||
|
|
114
|
-
nameWithRegionCode; // "Deutsch (AT)"
|
|
115
|
-
// Region names (default and native)
|
|
116
|
-
var regionNames = intlCache.get('DisplayNames', defaultLanguageOrder, {
|
|
117
|
-
type: 'region',
|
|
118
|
-
});
|
|
119
|
-
var nativeRegionNames = intlCache.get('DisplayNames', nativeLanguageOrder, { type: 'region' });
|
|
120
|
-
var regionName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.regionName) ||
|
|
121
|
-
(regionCode ? regionNames.of(regionCode) : '') ||
|
|
122
|
-
''; // "Austria"
|
|
123
|
-
var nativeRegionName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.nativeRegionName) ||
|
|
124
|
-
(regionCode ? nativeRegionNames.of(regionCode) : '') ||
|
|
125
|
-
''; // "Österreich"
|
|
126
|
-
// Script names (default and native)
|
|
127
|
-
var scriptNames = intlCache.get('DisplayNames', defaultLanguageOrder, {
|
|
128
|
-
type: 'script',
|
|
129
|
-
});
|
|
130
|
-
var nativeScriptNames = intlCache.get('DisplayNames', nativeLanguageOrder, { type: 'script' });
|
|
131
|
-
var scriptName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.scriptName) ||
|
|
132
|
-
(scriptCode ? scriptNames.of(scriptCode) : '') ||
|
|
133
|
-
''; // "Latin"
|
|
134
|
-
var nativeScriptName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.nativeScriptName) ||
|
|
135
|
-
(scriptCode ? nativeScriptNames.of(scriptCode) : '') ||
|
|
136
|
-
''; // "Lateinisch"
|
|
137
|
-
// Emoji
|
|
138
|
-
var emoji = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.emoji) ||
|
|
139
|
-
_getLocaleEmoji(standardizedLocale, customMapping);
|
|
140
|
-
return {
|
|
141
|
-
code: standardizedLocale,
|
|
142
|
-
name: name,
|
|
143
|
-
nativeName: nativeName,
|
|
144
|
-
maximizedCode: maximizedCode,
|
|
145
|
-
maximizedName: maximizedName,
|
|
146
|
-
nativeMaximizedName: nativeMaximizedName,
|
|
147
|
-
minimizedCode: minimizedCode,
|
|
148
|
-
minimizedName: minimizedName,
|
|
149
|
-
nativeMinimizedName: nativeMinimizedName,
|
|
150
|
-
languageCode: languageCode,
|
|
151
|
-
languageName: languageName,
|
|
152
|
-
nativeLanguageName: nativeLanguageName,
|
|
153
|
-
nameWithRegionCode: nameWithRegionCode,
|
|
154
|
-
nativeNameWithRegionCode: nativeNameWithRegionCode,
|
|
155
|
-
regionCode: regionCode,
|
|
156
|
-
regionName: regionName,
|
|
157
|
-
nativeRegionName: nativeRegionName,
|
|
158
|
-
scriptCode: scriptCode,
|
|
159
|
-
scriptName: scriptName,
|
|
160
|
-
nativeScriptName: nativeScriptName,
|
|
161
|
-
emoji: emoji,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
catch (_a) {
|
|
165
|
-
var code = _isValidLocale(locale) ? _standardizeLocale(locale) : locale;
|
|
166
|
-
var codeParts = code === null || code === void 0 ? void 0 : code.split('-');
|
|
167
|
-
var languageCode = (codeParts === null || codeParts === void 0 ? void 0 : codeParts[0]) || code || '';
|
|
168
|
-
var regionCode = codeParts.length > 2 ? codeParts === null || codeParts === void 0 ? void 0 : codeParts[2] : (codeParts === null || codeParts === void 0 ? void 0 : codeParts[1]) || '';
|
|
169
|
-
var scriptCode = (codeParts === null || codeParts === void 0 ? void 0 : codeParts[3]) || '';
|
|
170
|
-
var customLocaleProperties = createCustomLocaleProperties([code, languageCode], customMapping);
|
|
171
|
-
code = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.code) || code;
|
|
172
|
-
var name = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.name) || code;
|
|
173
|
-
var nativeName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.nativeName) || name;
|
|
174
|
-
var maximizedCode = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.maximizedCode) || code;
|
|
175
|
-
var maximizedName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.maximizedName) || name;
|
|
176
|
-
var nativeMaximizedName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.nativeMaximizedName) || nativeName;
|
|
177
|
-
var minimizedCode = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.minimizedCode) || code;
|
|
178
|
-
var minimizedName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.minimizedName) || name;
|
|
179
|
-
var nativeMinimizedName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.nativeMinimizedName) || nativeName;
|
|
180
|
-
languageCode = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.languageCode) || languageCode;
|
|
181
|
-
var languageName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.languageName) || name;
|
|
182
|
-
var nativeLanguageName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.nativeLanguageName) || nativeName;
|
|
183
|
-
regionCode = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.regionCode) || regionCode;
|
|
184
|
-
var regionName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.regionName) || '';
|
|
185
|
-
var nativeRegionName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.nativeRegionName) || '';
|
|
186
|
-
scriptCode = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.scriptCode) || scriptCode;
|
|
187
|
-
var scriptName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.scriptName) || '';
|
|
188
|
-
var nativeScriptName = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.nativeScriptName) || '';
|
|
189
|
-
var nameWithRegionCode = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.nameWithRegionCode) ||
|
|
190
|
-
(regionName ? "".concat(languageName, " (").concat(regionName, ")") : name);
|
|
191
|
-
var nativeNameWithRegionCode = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.nativeNameWithRegionCode) ||
|
|
192
|
-
(nativeRegionName
|
|
193
|
-
? "".concat(nativeLanguageName, " (").concat(nativeRegionName, ")")
|
|
194
|
-
: nativeName);
|
|
195
|
-
var emoji = (customLocaleProperties === null || customLocaleProperties === void 0 ? void 0 : customLocaleProperties.emoji) || defaultEmoji;
|
|
196
|
-
return {
|
|
197
|
-
code: code,
|
|
198
|
-
name: name,
|
|
199
|
-
nativeName: nativeName,
|
|
200
|
-
maximizedCode: maximizedCode,
|
|
201
|
-
maximizedName: maximizedName,
|
|
202
|
-
nativeMaximizedName: nativeMaximizedName,
|
|
203
|
-
minimizedCode: minimizedCode,
|
|
204
|
-
minimizedName: minimizedName,
|
|
205
|
-
nativeMinimizedName: nativeMinimizedName,
|
|
206
|
-
languageCode: languageCode,
|
|
207
|
-
languageName: languageName,
|
|
208
|
-
nativeLanguageName: nativeLanguageName,
|
|
209
|
-
nameWithRegionCode: nameWithRegionCode,
|
|
210
|
-
nativeNameWithRegionCode: nativeNameWithRegionCode,
|
|
211
|
-
regionCode: regionCode,
|
|
212
|
-
regionName: regionName,
|
|
213
|
-
nativeRegionName: nativeRegionName,
|
|
214
|
-
scriptCode: scriptCode,
|
|
215
|
-
scriptName: scriptName,
|
|
216
|
-
nativeScriptName: nativeScriptName,
|
|
217
|
-
emoji: emoji,
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
}
|