@mailwoman/codex 7.2.0 → 7.2.1
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/address-system-conventions.ts +68 -0
- package/au/delivery-service.ts +179 -0
- package/au/index.ts +15 -0
- package/au/level-designator.ts +209 -0
- package/au/postcode.ts +51 -0
- package/au/state.ts +35 -0
- package/ca/index.ts +12 -0
- package/ca/postal-code.ts +121 -0
- package/ca/province.ts +99 -0
- package/ca/street-type.ts +167 -0
- package/country/codes.ts +534 -0
- package/country/country.ts +125 -0
- package/country/index.ts +14 -0
- package/country/names.ts +274 -0
- package/country/official-languages.ts +397 -0
- package/country/reference-data.ts +267 -0
- package/country/reference.ts +47 -0
- package/de/bundesland.ts +102 -0
- package/de/index.ts +12 -0
- package/de/postleitzahl.ts +91 -0
- package/de/street-type.ts +83 -0
- package/fr/cedex.ts +56 -0
- package/fr/code-postal.ts +105 -0
- package/fr/departement.ts +142 -0
- package/fr/index.ts +14 -0
- package/fr/region.ts +93 -0
- package/fr/voie.ts +98 -0
- package/gb/country.ts +74 -0
- package/gb/index.ts +14 -0
- package/gb/postcode-area.ts +107 -0
- package/gb/postcode.ts +109 -0
- package/gb/street-type.ts +90 -0
- package/index.ts +38 -0
- package/jp/address-unit.ts +87 -0
- package/jp/index.ts +13 -0
- package/jp/postal-code.ts +93 -0
- package/jp/prefecture.ts +173 -0
- package/level-semantics.ts +623 -0
- package/nz/delivery-service.ts +211 -0
- package/nz/index.ts +12 -0
- package/nz/postcode.ts +42 -0
- package/package.json +81 -37
- package/postcode-systems.ts +68 -0
- package/tools/build-country-surface-lexicon.ts +166 -0
- package/tools/export-country-surfaces.ts +46 -0
- package/tools/generate-country-reference.ts +153 -0
- package/tools/generate-official-languages.ts +188 -0
- package/tools/index.ts +12 -0
- package/us/floor-designator.ts +119 -0
- package/us/index.ts +19 -0
- package/us/military-address.ts +199 -0
- package/us/po-box.ts +82 -0
- package/us/state.ts +156 -0
- package/us/street-directional.ts +220 -0
- package/us/street-suffix.ts +345 -0
- package/us/unit-designator.ts +223 -0
- package/us/zipcode.ts +212 -0
package/country/names.ts
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software (ISO 3166-1 data salvaged from isp-nexus)
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* List of all countries in the world.
|
|
9
|
+
*
|
|
10
|
+
* @category Geographic
|
|
11
|
+
* @internal
|
|
12
|
+
* @see https://en.wikipedia.org/wiki/List_of_countries
|
|
13
|
+
*/
|
|
14
|
+
export const CountryNames = [
|
|
15
|
+
"Afghanistan",
|
|
16
|
+
"Albania",
|
|
17
|
+
"Algeria",
|
|
18
|
+
"American Samoa",
|
|
19
|
+
"Andorra",
|
|
20
|
+
"Angola",
|
|
21
|
+
"Anguilla",
|
|
22
|
+
"Antarctica",
|
|
23
|
+
"Antigua and Barbuda",
|
|
24
|
+
"Argentina",
|
|
25
|
+
"Armenia",
|
|
26
|
+
"Aruba",
|
|
27
|
+
"Australia",
|
|
28
|
+
"Austria",
|
|
29
|
+
"Azerbaijan",
|
|
30
|
+
"Bahamas",
|
|
31
|
+
"Bahrain",
|
|
32
|
+
"Bangladesh",
|
|
33
|
+
"Barbados",
|
|
34
|
+
"Belarus",
|
|
35
|
+
"Belgium",
|
|
36
|
+
"Belize",
|
|
37
|
+
"Benin",
|
|
38
|
+
"Bermuda",
|
|
39
|
+
"Bhutan",
|
|
40
|
+
"Bolivia",
|
|
41
|
+
"Bonaire, Sint Eustatius and Saba",
|
|
42
|
+
"Bosnia and Herzegovina",
|
|
43
|
+
"Botswana",
|
|
44
|
+
"Bouvet Island",
|
|
45
|
+
"Brazil",
|
|
46
|
+
"British Indian Ocean Territory",
|
|
47
|
+
"Brunei Darussalam",
|
|
48
|
+
"Bulgaria",
|
|
49
|
+
"Burkina Faso",
|
|
50
|
+
"Burundi",
|
|
51
|
+
"Cambodia",
|
|
52
|
+
"Cameroon",
|
|
53
|
+
"Canada",
|
|
54
|
+
"Cape Verde",
|
|
55
|
+
"Cayman Islands",
|
|
56
|
+
"Central African Republic",
|
|
57
|
+
"Chad",
|
|
58
|
+
"Chile",
|
|
59
|
+
"China",
|
|
60
|
+
"Christmas Island",
|
|
61
|
+
"Cocos (Keeling) Islands",
|
|
62
|
+
"Colombia",
|
|
63
|
+
"Comoros",
|
|
64
|
+
"Congo",
|
|
65
|
+
"Congo, the Democratic Republic of the",
|
|
66
|
+
"Cook Islands",
|
|
67
|
+
"Costa Rica",
|
|
68
|
+
"Cote DIvoire",
|
|
69
|
+
"Croatia",
|
|
70
|
+
"Cuba",
|
|
71
|
+
"Curaçao",
|
|
72
|
+
"Cyprus",
|
|
73
|
+
"Czech Republic",
|
|
74
|
+
"Denmark",
|
|
75
|
+
"Djibouti",
|
|
76
|
+
"Dominica",
|
|
77
|
+
"Dominican Republic",
|
|
78
|
+
"Ecuador",
|
|
79
|
+
"Egypt",
|
|
80
|
+
"El Salvador",
|
|
81
|
+
"Equatorial Guinea",
|
|
82
|
+
"Eritrea",
|
|
83
|
+
"Estonia",
|
|
84
|
+
"Ethiopia",
|
|
85
|
+
"Falkland Islands (Malvinas)",
|
|
86
|
+
"Faroe Islands",
|
|
87
|
+
"Fiji",
|
|
88
|
+
"Finland",
|
|
89
|
+
"France",
|
|
90
|
+
"French Guiana",
|
|
91
|
+
"French Polynesia",
|
|
92
|
+
"French Southern Territories",
|
|
93
|
+
"Gabon",
|
|
94
|
+
"Gambia",
|
|
95
|
+
"Georgia",
|
|
96
|
+
"Germany",
|
|
97
|
+
"Ghana",
|
|
98
|
+
"Gibraltar",
|
|
99
|
+
"Greece",
|
|
100
|
+
"Greenland",
|
|
101
|
+
"Grenada",
|
|
102
|
+
"Guadeloupe",
|
|
103
|
+
"Guam",
|
|
104
|
+
"Guatemala",
|
|
105
|
+
"Guernsey",
|
|
106
|
+
"Guinea",
|
|
107
|
+
"Guinea-Bissau",
|
|
108
|
+
"Guyana",
|
|
109
|
+
"Haiti",
|
|
110
|
+
"Heard Island and Mcdonald Islands",
|
|
111
|
+
"Holy See (Vatican City State)",
|
|
112
|
+
"Honduras",
|
|
113
|
+
"Hong Kong",
|
|
114
|
+
"Hungary",
|
|
115
|
+
"Iceland",
|
|
116
|
+
"India",
|
|
117
|
+
"Indonesia",
|
|
118
|
+
"Iran, Islamic Republic of",
|
|
119
|
+
"Iraq",
|
|
120
|
+
"Ireland",
|
|
121
|
+
"Isle of Man",
|
|
122
|
+
"Israel",
|
|
123
|
+
"Italy",
|
|
124
|
+
"Jamaica",
|
|
125
|
+
"Japan",
|
|
126
|
+
"Jersey",
|
|
127
|
+
"Jordan",
|
|
128
|
+
"Kazakhstan",
|
|
129
|
+
"Kenya",
|
|
130
|
+
"Kiribati",
|
|
131
|
+
"Korea, Democratic People's Republic of",
|
|
132
|
+
"Korea, Republic of",
|
|
133
|
+
"Kuwait",
|
|
134
|
+
"Kyrgyzstan",
|
|
135
|
+
"Lao People's Democratic Republic",
|
|
136
|
+
"Latvia",
|
|
137
|
+
"Lebanon",
|
|
138
|
+
"Lesotho",
|
|
139
|
+
"Liberia",
|
|
140
|
+
"Libya",
|
|
141
|
+
"Liechtenstein",
|
|
142
|
+
"Lithuania",
|
|
143
|
+
"Luxembourg",
|
|
144
|
+
"Macao",
|
|
145
|
+
"Macedonia, the Former Yugoslav Republic of",
|
|
146
|
+
"Madagascar",
|
|
147
|
+
"Malawi",
|
|
148
|
+
"Malaysia",
|
|
149
|
+
"Maldives",
|
|
150
|
+
"Mali",
|
|
151
|
+
"Malta",
|
|
152
|
+
"Marshall Islands",
|
|
153
|
+
"Martinique",
|
|
154
|
+
"Mauritania",
|
|
155
|
+
"Mauritius",
|
|
156
|
+
"Mayotte",
|
|
157
|
+
"Mexico",
|
|
158
|
+
"Micronesia, Federated States of",
|
|
159
|
+
"Moldova, Republic of",
|
|
160
|
+
"Monaco",
|
|
161
|
+
"Mongolia",
|
|
162
|
+
"Montenegro",
|
|
163
|
+
"Montserrat",
|
|
164
|
+
"Morocco",
|
|
165
|
+
"Mozambique",
|
|
166
|
+
"Myanmar",
|
|
167
|
+
"Namibia",
|
|
168
|
+
"Nauru",
|
|
169
|
+
"Nepal",
|
|
170
|
+
"Netherlands",
|
|
171
|
+
"New Caledonia",
|
|
172
|
+
"New Zealand",
|
|
173
|
+
"Nicaragua",
|
|
174
|
+
"Niger",
|
|
175
|
+
"Nigeria",
|
|
176
|
+
"Niue",
|
|
177
|
+
"Norfolk Island",
|
|
178
|
+
"Northern Mariana Islands",
|
|
179
|
+
"Norway",
|
|
180
|
+
"Oman",
|
|
181
|
+
"Pakistan",
|
|
182
|
+
"Palau",
|
|
183
|
+
"Palestine, State of",
|
|
184
|
+
"Panama",
|
|
185
|
+
"Papua New Guinea",
|
|
186
|
+
"Paraguay",
|
|
187
|
+
"Peru",
|
|
188
|
+
"Philippines",
|
|
189
|
+
"Pitcairn",
|
|
190
|
+
"Poland",
|
|
191
|
+
"Portugal",
|
|
192
|
+
"Puerto Rico",
|
|
193
|
+
"Qatar",
|
|
194
|
+
"Reunion",
|
|
195
|
+
"Romania",
|
|
196
|
+
"Russian Federation",
|
|
197
|
+
"Rwanda",
|
|
198
|
+
"Saint Barthélemy",
|
|
199
|
+
"Saint Helena, Ascension and Tristan da Cunha",
|
|
200
|
+
"Saint Kitts and Nevis",
|
|
201
|
+
"Saint Lucia",
|
|
202
|
+
"Saint Martin (French part)",
|
|
203
|
+
"Saint Pierre and Miquelon",
|
|
204
|
+
"Saint Vincent and the Grenadines",
|
|
205
|
+
"Samoa",
|
|
206
|
+
"San Marino",
|
|
207
|
+
"Sao Tome and Principe",
|
|
208
|
+
"Saudi Arabia",
|
|
209
|
+
"Senegal",
|
|
210
|
+
"Serbia",
|
|
211
|
+
"Seychelles",
|
|
212
|
+
"Sierra Leone",
|
|
213
|
+
"Singapore",
|
|
214
|
+
"Sint Maarten (Dutch part)",
|
|
215
|
+
"Slovakia",
|
|
216
|
+
"Slovenia",
|
|
217
|
+
"Solomon Islands",
|
|
218
|
+
"Somalia",
|
|
219
|
+
"South Africa",
|
|
220
|
+
"South Georgia and the South Sandwich Islands",
|
|
221
|
+
"South Sudan",
|
|
222
|
+
"Spain",
|
|
223
|
+
"Sri Lanka",
|
|
224
|
+
"Sudan",
|
|
225
|
+
"Suriname",
|
|
226
|
+
"Svalbard and Jan Mayen",
|
|
227
|
+
"Swaziland",
|
|
228
|
+
"Sweden",
|
|
229
|
+
"Switzerland",
|
|
230
|
+
"Syrian Arab Republic",
|
|
231
|
+
"Taiwan (Province of China)",
|
|
232
|
+
"Tajikistan",
|
|
233
|
+
"Tanzania, United Republic of",
|
|
234
|
+
"Thailand",
|
|
235
|
+
"Timor-Leste",
|
|
236
|
+
"Togo",
|
|
237
|
+
"Tokelau",
|
|
238
|
+
"Tonga",
|
|
239
|
+
"Trinidad and Tobago",
|
|
240
|
+
"Tunisia",
|
|
241
|
+
"Turkey",
|
|
242
|
+
"Turkmenistan",
|
|
243
|
+
"Turks and Caicos Islands",
|
|
244
|
+
"Tuvalu",
|
|
245
|
+
"Uganda",
|
|
246
|
+
"Ukraine",
|
|
247
|
+
"United Arab Emirates",
|
|
248
|
+
"United Kingdom",
|
|
249
|
+
"United States",
|
|
250
|
+
"United States Minor Outlying Islands",
|
|
251
|
+
"Uruguay",
|
|
252
|
+
"Uzbekistan",
|
|
253
|
+
"Vanuatu",
|
|
254
|
+
"Venezuela",
|
|
255
|
+
"Viet Nam",
|
|
256
|
+
"Virgin Islands (British)",
|
|
257
|
+
"Virgin Islands (U.S.)",
|
|
258
|
+
"Wallis and Futuna",
|
|
259
|
+
"Western Sahara",
|
|
260
|
+
"Yemen",
|
|
261
|
+
"Zambia",
|
|
262
|
+
"Zimbabwe",
|
|
263
|
+
"Åland Islands",
|
|
264
|
+
] as const satisfies readonly string[]
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Name of a country in the world.
|
|
268
|
+
*
|
|
269
|
+
* @category Geographic
|
|
270
|
+
* @category Country
|
|
271
|
+
* @title Country Name
|
|
272
|
+
* @public
|
|
273
|
+
*/
|
|
274
|
+
export type CountryName = (typeof CountryNames)[number]
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* GENERATED — do not edit by hand. Official languages per ISO 3166-1 territory, derived from
|
|
7
|
+
* Unicode CLDR 47.0.0 supplemental territoryInfo (`_officialStatus`). `official` merges
|
|
8
|
+
* CLDR's `official` + `de_facto_official`; `regional` is `official_regional` (kept separate —
|
|
9
|
+
* the #936 probe showed it pulls in cross-border quirks like Korean-in-CN, so consumers opt in).
|
|
10
|
+
* Every language appears under each ISO-639 spelling CLDR aliases to it (fi AND fin) so WOF
|
|
11
|
+
* 639-3 tags, Overture BCP-47 keys, and GeoNames codes all match without mapping.
|
|
12
|
+
* Regenerate with: mailwoman dev generate official-languages
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** Official-language spellings for one territory. */
|
|
16
|
+
export interface OfficialLanguageEntry {
|
|
17
|
+
/** CLDR `official` + `de_facto_official`, in every ISO-639 spelling. */
|
|
18
|
+
official: readonly string[]
|
|
19
|
+
/** CLDR `official_regional` (e.g. Catalan in ES) — opt-in for consumers. */
|
|
20
|
+
regional?: readonly string[]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** ISO 3166-1 alpha-2 → official languages. */
|
|
24
|
+
export const OFFICIAL_LANGUAGES: Record<string, OfficialLanguageEntry> = {
|
|
25
|
+
AD: { official: ["ca", "cat"] },
|
|
26
|
+
AE: { official: ["ar", "ara", "arb"] },
|
|
27
|
+
AF: { official: ["fa", "fas", "pbu", "per", "pes", "ps", "pus"], regional: ["tk", "tuk", "uz", "uzb", "uzn"] },
|
|
28
|
+
AG: { official: ["en", "eng"] },
|
|
29
|
+
AI: { official: ["en", "eng"] },
|
|
30
|
+
AL: { official: ["alb", "als", "sq", "sqi"] },
|
|
31
|
+
AM: { official: ["arm", "hy", "hye"] },
|
|
32
|
+
AO: { official: ["por", "pt"] },
|
|
33
|
+
AR: { official: ["es", "spa"] },
|
|
34
|
+
AS: { official: ["en", "eng", "sm", "smo"] },
|
|
35
|
+
AT: { official: ["de", "deu", "ger"], regional: ["hr", "hrv", "hu", "hun", "scr", "sl", "slv"] },
|
|
36
|
+
AU: { official: ["en", "eng"] },
|
|
37
|
+
AW: { official: ["dut", "nl", "nld", "pap"] },
|
|
38
|
+
AX: { official: ["sv", "swe"] },
|
|
39
|
+
AZ: { official: ["az", "aze", "azj"] },
|
|
40
|
+
BA: { official: ["bos", "bs", "hr", "hrv", "scc", "scr", "sr", "srp"] },
|
|
41
|
+
BB: { official: ["en", "eng"] },
|
|
42
|
+
BD: { official: ["ben", "bn"] },
|
|
43
|
+
BE: { official: ["de", "deu", "dut", "fr", "fra", "fre", "ger", "nl", "nld"] },
|
|
44
|
+
BF: { official: ["fr", "fra", "fre"] },
|
|
45
|
+
BG: { official: ["bg", "bul"] },
|
|
46
|
+
BH: { official: ["ar", "ara", "arb"] },
|
|
47
|
+
BI: { official: ["en", "eng", "fr", "fra", "fre", "rn", "run"] },
|
|
48
|
+
BJ: { official: ["fr", "fra", "fre"] },
|
|
49
|
+
BL: { official: ["fr", "fra", "fre"] },
|
|
50
|
+
BM: { official: ["en", "eng"] },
|
|
51
|
+
BN: { official: ["may", "ms", "msa", "zsm"] },
|
|
52
|
+
BO: { official: ["ay", "aym", "ayr", "es", "qu", "que", "quz", "spa"] },
|
|
53
|
+
BQ: { official: ["dut", "nl", "nld"] },
|
|
54
|
+
BR: { official: ["por", "pt"], regional: ["vec"] },
|
|
55
|
+
BS: { official: ["en", "eng"] },
|
|
56
|
+
BT: { official: ["adp", "dz", "dzo"] },
|
|
57
|
+
BW: { official: ["en", "eng", "tn", "tsn"] },
|
|
58
|
+
BY: { official: ["be", "bel", "ru", "rus"] },
|
|
59
|
+
BZ: { official: ["en", "eng"] },
|
|
60
|
+
CA: {
|
|
61
|
+
official: ["en", "eng", "fr", "fra", "fre"],
|
|
62
|
+
regional: ["chp", "crk", "den", "dgr", "gwi", "ike", "iku", "iu", "xsl"],
|
|
63
|
+
},
|
|
64
|
+
CC: { official: ["en", "eng"] },
|
|
65
|
+
CD: { official: ["fr", "fra", "fre"], regional: ["kg", "kng", "kon", "lin", "ln", "lua", "sw", "swa", "swh"] },
|
|
66
|
+
CF: { official: ["fr", "fra", "fre", "sag", "sg"] },
|
|
67
|
+
CG: { official: ["fr", "fra", "fre"] },
|
|
68
|
+
CH: { official: ["de", "deu", "fr", "fra", "fre", "ger", "gsw", "it", "ita"], regional: ["rm", "roh"] },
|
|
69
|
+
CI: { official: ["fr", "fra", "fre"] },
|
|
70
|
+
CK: { official: ["en", "eng"] },
|
|
71
|
+
CL: { official: ["es", "spa"] },
|
|
72
|
+
CM: { official: ["en", "eng", "fr", "fra", "fre"] },
|
|
73
|
+
CN: {
|
|
74
|
+
official: ["chi", "cmn", "zh", "zho"],
|
|
75
|
+
regional: ["bo", "bod", "drh", "khk", "ko", "kor", "mn", "mon", "tib", "ug", "uig", "za", "zha", "zyb"],
|
|
76
|
+
},
|
|
77
|
+
CO: { official: ["es", "spa"] },
|
|
78
|
+
CQ: { official: ["en", "eng"] },
|
|
79
|
+
CR: { official: ["es", "spa"] },
|
|
80
|
+
CU: { official: ["es", "spa"] },
|
|
81
|
+
CV: { official: ["por", "pt"] },
|
|
82
|
+
CW: { official: ["dut", "nl", "nld", "pap"] },
|
|
83
|
+
CX: { official: ["en", "eng"] },
|
|
84
|
+
CY: { official: ["el", "ell", "gre", "tr", "tur"] },
|
|
85
|
+
CZ: { official: ["ces", "cs", "cze"] },
|
|
86
|
+
DE: { official: ["de", "deu", "ger"], regional: ["frr"] },
|
|
87
|
+
DG: { official: ["en", "eng"] },
|
|
88
|
+
DJ: { official: ["ar", "ara", "arb", "fr", "fra", "fre"] },
|
|
89
|
+
DK: { official: ["da", "dan"], regional: ["de", "deu", "ger", "kal", "kl"] },
|
|
90
|
+
DM: { official: ["en", "eng"] },
|
|
91
|
+
DO: { official: ["es", "spa"] },
|
|
92
|
+
DZ: { official: ["ar", "ara", "arb", "fr", "fra", "fre"] },
|
|
93
|
+
EA: { official: ["es", "spa"] },
|
|
94
|
+
EC: { official: ["es", "qu", "que", "quz", "spa"] },
|
|
95
|
+
EE: { official: ["ekk", "est", "et"] },
|
|
96
|
+
EG: { official: ["ar", "ara", "arb"] },
|
|
97
|
+
EH: { official: ["ar", "ara", "arb"] },
|
|
98
|
+
ER: { official: ["ar", "ara", "arb", "en", "eng", "ti", "tir"] },
|
|
99
|
+
ES: { official: ["es", "spa"], regional: ["ast", "baq", "ca", "cat", "eu", "eus", "gl", "glg", "oc", "oci"] },
|
|
100
|
+
ET: { official: ["am", "amh"] },
|
|
101
|
+
FI: { official: ["fi", "fin", "sv", "swe"], regional: ["sms"] },
|
|
102
|
+
FJ: { official: ["en", "eng", "fij", "fj", "hif"] },
|
|
103
|
+
FK: { official: ["en", "eng"] },
|
|
104
|
+
FM: { official: ["en", "eng"] },
|
|
105
|
+
FO: { official: ["fao", "fo"] },
|
|
106
|
+
FR: { official: ["fr", "fra", "fre"] },
|
|
107
|
+
GA: { official: ["fr", "fra", "fre"] },
|
|
108
|
+
GB: { official: ["en", "eng"], regional: ["cy", "cym", "ga", "gd", "gla", "gle", "wel"] },
|
|
109
|
+
GD: { official: ["en", "eng"] },
|
|
110
|
+
GE: { official: ["geo", "ka", "kat"], regional: ["ab", "abk", "os", "oss"] },
|
|
111
|
+
GF: { official: ["fr", "fra", "fre"] },
|
|
112
|
+
GG: { official: ["en", "eng"] },
|
|
113
|
+
GH: { official: ["en", "eng"], regional: ["ak", "aka", "ee", "ewe", "fat", "gaa", "tw", "twi"] },
|
|
114
|
+
GI: { official: ["en", "eng"] },
|
|
115
|
+
GL: { official: ["kal", "kl"] },
|
|
116
|
+
GM: { official: ["en", "eng"] },
|
|
117
|
+
GN: { official: ["fr", "fra", "fre"] },
|
|
118
|
+
GP: { official: ["fr", "fra", "fre"] },
|
|
119
|
+
GQ: { official: ["es", "fr", "fra", "fre", "por", "pt", "spa"] },
|
|
120
|
+
GR: { official: ["el", "ell", "gre"] },
|
|
121
|
+
GS: { official: ["en", "eng"] },
|
|
122
|
+
GT: { official: ["es", "spa"], regional: ["quc"] },
|
|
123
|
+
GU: { official: ["ch", "cha", "en", "eng"] },
|
|
124
|
+
GW: { official: ["por", "pt"] },
|
|
125
|
+
GY: { official: ["en", "eng"] },
|
|
126
|
+
HK: { official: ["chi", "cmn", "en", "eng", "zh", "zho"] },
|
|
127
|
+
HN: { official: ["es", "spa"] },
|
|
128
|
+
HR: { official: ["hr", "hrv", "scr"], regional: ["it", "ita", "vec"] },
|
|
129
|
+
HT: { official: ["fr", "fra", "fre", "hat", "ht"] },
|
|
130
|
+
HU: { official: ["hu", "hun"] },
|
|
131
|
+
IC: { official: ["es", "spa"] },
|
|
132
|
+
ID: { official: ["id", "in", "ind"] },
|
|
133
|
+
IE: { official: ["en", "eng", "ga", "gle"] },
|
|
134
|
+
IL: { official: ["ar", "ara", "arb", "he", "heb", "iw"] },
|
|
135
|
+
IM: { official: ["en", "eng", "glv", "gv"] },
|
|
136
|
+
IN: {
|
|
137
|
+
official: ["en", "eng", "hi", "hin"],
|
|
138
|
+
regional: [
|
|
139
|
+
"as",
|
|
140
|
+
"asm",
|
|
141
|
+
"ben",
|
|
142
|
+
"bn",
|
|
143
|
+
"cls",
|
|
144
|
+
"gom",
|
|
145
|
+
"gu",
|
|
146
|
+
"guj",
|
|
147
|
+
"kan",
|
|
148
|
+
"kas",
|
|
149
|
+
"kha",
|
|
150
|
+
"kn",
|
|
151
|
+
"kok",
|
|
152
|
+
"ks",
|
|
153
|
+
"mai",
|
|
154
|
+
"mal",
|
|
155
|
+
"mar",
|
|
156
|
+
"ml",
|
|
157
|
+
"mr",
|
|
158
|
+
"ne",
|
|
159
|
+
"nep",
|
|
160
|
+
"npi",
|
|
161
|
+
"or",
|
|
162
|
+
"ori",
|
|
163
|
+
"ory",
|
|
164
|
+
"pa",
|
|
165
|
+
"pan",
|
|
166
|
+
"prp",
|
|
167
|
+
"sa",
|
|
168
|
+
"san",
|
|
169
|
+
"sat",
|
|
170
|
+
"sd",
|
|
171
|
+
"snd",
|
|
172
|
+
"ta",
|
|
173
|
+
"tam",
|
|
174
|
+
"te",
|
|
175
|
+
"tel",
|
|
176
|
+
"ur",
|
|
177
|
+
"urd",
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
IO: { official: ["en", "eng"] },
|
|
181
|
+
IQ: { official: ["ar", "ara", "arb"], regional: ["az", "aze", "azj", "ckb"] },
|
|
182
|
+
IR: { official: ["fa", "fas", "per", "pes"] },
|
|
183
|
+
IS: { official: ["ice", "is", "isl"] },
|
|
184
|
+
IT: { official: ["it", "ita"], regional: ["fr", "fra", "fre", "vec"] },
|
|
185
|
+
JE: { official: ["en", "eng"] },
|
|
186
|
+
JM: { official: ["en", "eng"] },
|
|
187
|
+
JO: { official: ["ar", "ara", "arb"] },
|
|
188
|
+
JP: { official: ["ja", "jpn"] },
|
|
189
|
+
KE: { official: ["en", "eng", "sw", "swa", "swh"] },
|
|
190
|
+
KG: { official: ["kir", "ky", "ru", "rus"] },
|
|
191
|
+
KH: { official: ["khm", "km"] },
|
|
192
|
+
KI: { official: ["en", "eng", "gil"] },
|
|
193
|
+
KM: { official: ["ar", "ara", "arb", "fr", "fra", "fre", "wni", "zdj"] },
|
|
194
|
+
KN: { official: ["en", "eng"] },
|
|
195
|
+
KP: { official: ["ko", "kor"] },
|
|
196
|
+
KR: { official: ["ko", "kor"] },
|
|
197
|
+
KW: { official: ["ar", "ara", "arb"] },
|
|
198
|
+
KY: { official: ["en", "eng"] },
|
|
199
|
+
KZ: { official: ["kaz", "kk", "ru", "rus"] },
|
|
200
|
+
LA: { official: ["lao", "lo"] },
|
|
201
|
+
LB: { official: ["ar", "ara", "arb"] },
|
|
202
|
+
LC: { official: ["en", "eng"] },
|
|
203
|
+
LI: { official: ["de", "deu", "ger", "gsw"] },
|
|
204
|
+
LK: { official: ["si", "sin", "ta", "tam"] },
|
|
205
|
+
LR: { official: ["en", "eng"] },
|
|
206
|
+
LS: { official: ["en", "eng", "sot", "st"] },
|
|
207
|
+
LT: { official: ["lit", "lt"] },
|
|
208
|
+
LU: { official: ["de", "deu", "fr", "fra", "fre", "ger", "lb", "ltz"] },
|
|
209
|
+
LV: { official: ["lav", "lv", "lvs"] },
|
|
210
|
+
LY: { official: ["ar", "ara", "arb"] },
|
|
211
|
+
MA: { official: ["ar", "ara", "arb", "fr", "fra", "fre", "tzm"] },
|
|
212
|
+
MC: { official: ["fr", "fra", "fre"] },
|
|
213
|
+
MD: { official: ["mo", "mol", "ro", "ron", "rum"] },
|
|
214
|
+
ME: { official: ["scc", "sr", "srp"] },
|
|
215
|
+
MF: { official: ["fr", "fra", "fre"] },
|
|
216
|
+
MG: { official: ["en", "eng", "fr", "fra", "fre", "mg", "mlg", "plt"] },
|
|
217
|
+
MH: { official: ["en", "eng", "mah", "mh"] },
|
|
218
|
+
MK: { official: ["mac", "mk", "mkd"], regional: ["alb", "als", "sq", "sqi"] },
|
|
219
|
+
ML: { official: ["fr", "fra", "fre"] },
|
|
220
|
+
MM: { official: ["bur", "my", "mya"] },
|
|
221
|
+
MN: { official: ["drh", "khk", "mn", "mon"] },
|
|
222
|
+
MO: { official: ["chi", "cmn", "por", "pt", "yue", "zh", "zho"] },
|
|
223
|
+
MP: { official: ["en", "eng"] },
|
|
224
|
+
MQ: { official: ["fr", "fra", "fre"] },
|
|
225
|
+
MR: { official: ["ar", "ara", "arb"] },
|
|
226
|
+
MS: { official: ["en", "eng"] },
|
|
227
|
+
MT: { official: ["en", "eng", "mlt", "mt"] },
|
|
228
|
+
MU: { official: ["en", "eng", "fr", "fra", "fre"] },
|
|
229
|
+
MV: { official: ["div", "dv"] },
|
|
230
|
+
MW: { official: ["en", "eng", "ny", "nya"] },
|
|
231
|
+
MX: { official: ["es", "spa"] },
|
|
232
|
+
MY: { official: ["may", "ms", "msa", "zsm"] },
|
|
233
|
+
MZ: { official: ["por", "pt"] },
|
|
234
|
+
NA: { official: ["en", "eng"] },
|
|
235
|
+
NC: { official: ["fr", "fra", "fre"] },
|
|
236
|
+
NE: { official: ["fr", "fra", "fre"] },
|
|
237
|
+
NF: { official: ["en", "eng"] },
|
|
238
|
+
NG: { official: ["en", "eng", "yo", "yor"] },
|
|
239
|
+
NI: { official: ["es", "spa"] },
|
|
240
|
+
NL: { official: ["dut", "nl", "nld"], regional: ["fry", "fy"] },
|
|
241
|
+
NO: { official: ["nb", "nn", "nno", "no", "nob", "nor"], regional: ["se", "sme"] },
|
|
242
|
+
NP: { official: ["ne", "nep", "npi"] },
|
|
243
|
+
NR: { official: ["en", "eng", "na", "nau"] },
|
|
244
|
+
NU: { official: ["en", "eng", "niu"] },
|
|
245
|
+
NZ: { official: ["en", "eng", "mao", "mi", "mri"] },
|
|
246
|
+
OM: { official: ["ar", "ara", "arb"] },
|
|
247
|
+
PA: { official: ["es", "spa"] },
|
|
248
|
+
PE: { official: ["es", "qu", "que", "quz", "spa"] },
|
|
249
|
+
PF: { official: ["fr", "fra", "fre", "tah", "ty"] },
|
|
250
|
+
PG: { official: ["en", "eng", "hmo", "ho", "tpi"] },
|
|
251
|
+
PH: { official: ["en", "eng", "fil", "tgl", "tl"], regional: ["ceb", "hil", "ilo", "mdh", "pag", "tsg", "war"] },
|
|
252
|
+
PK: { official: ["en", "eng", "ur", "urd"] },
|
|
253
|
+
PL: { official: ["pl", "pol"], regional: ["csb", "de", "deu", "ger", "lit", "lt"] },
|
|
254
|
+
PM: { official: ["fr", "fra", "fre"] },
|
|
255
|
+
PN: { official: ["en", "eng"] },
|
|
256
|
+
PR: { official: ["en", "eng", "es", "spa"] },
|
|
257
|
+
PS: { official: ["ar", "ara", "arb"] },
|
|
258
|
+
PT: { official: ["por", "pt"] },
|
|
259
|
+
PW: { official: ["en", "eng", "pau"] },
|
|
260
|
+
PY: { official: ["es", "gn", "grn", "gug", "spa"] },
|
|
261
|
+
QA: { official: ["ar", "ara", "arb"] },
|
|
262
|
+
RE: { official: ["fr", "fra", "fre"] },
|
|
263
|
+
RO: { official: ["mo", "mol", "ro", "ron", "rum"] },
|
|
264
|
+
RS: {
|
|
265
|
+
official: ["scc", "sr", "srp"],
|
|
266
|
+
regional: ["hr", "hrv", "hu", "hun", "mo", "mol", "ro", "ron", "rum", "scr", "sk", "slk", "slo", "uk", "ukr"],
|
|
267
|
+
},
|
|
268
|
+
RU: {
|
|
269
|
+
official: ["ru", "rus"],
|
|
270
|
+
regional: [
|
|
271
|
+
"ady",
|
|
272
|
+
"av",
|
|
273
|
+
"ava",
|
|
274
|
+
"az",
|
|
275
|
+
"aze",
|
|
276
|
+
"azj",
|
|
277
|
+
"ba",
|
|
278
|
+
"bak",
|
|
279
|
+
"ce",
|
|
280
|
+
"che",
|
|
281
|
+
"inh",
|
|
282
|
+
"kbd",
|
|
283
|
+
"koi",
|
|
284
|
+
"kom",
|
|
285
|
+
"kpv",
|
|
286
|
+
"krc",
|
|
287
|
+
"kum",
|
|
288
|
+
"kv",
|
|
289
|
+
"lbe",
|
|
290
|
+
"lez",
|
|
291
|
+
"mdf",
|
|
292
|
+
"myv",
|
|
293
|
+
"sah",
|
|
294
|
+
"tat",
|
|
295
|
+
"tt",
|
|
296
|
+
"tyv",
|
|
297
|
+
"udm",
|
|
298
|
+
],
|
|
299
|
+
},
|
|
300
|
+
RW: { official: ["en", "eng", "fr", "fra", "fre", "kin", "rw"] },
|
|
301
|
+
SA: { official: ["ar", "ara", "arb"] },
|
|
302
|
+
SB: { official: ["en", "eng"] },
|
|
303
|
+
SC: { official: ["en", "eng", "fr", "fra", "fre"] },
|
|
304
|
+
SD: { official: ["ar", "ara", "arb", "en", "eng"] },
|
|
305
|
+
SE: { official: ["sv", "swe"], regional: ["fi", "fin"] },
|
|
306
|
+
SG: { official: ["chi", "cmn", "en", "eng", "may", "ms", "msa", "ta", "tam", "zh", "zho", "zsm"] },
|
|
307
|
+
SH: { official: ["en", "eng"] },
|
|
308
|
+
SI: { official: ["sl", "slv"], regional: ["vec"] },
|
|
309
|
+
SJ: { official: ["nb", "nob"] },
|
|
310
|
+
SK: { official: ["sk", "slk", "slo"] },
|
|
311
|
+
SL: { official: ["en", "eng"] },
|
|
312
|
+
SM: { official: ["it", "ita"] },
|
|
313
|
+
SN: {
|
|
314
|
+
official: ["fr", "fra", "fre", "wo", "wol"],
|
|
315
|
+
regional: ["bjt", "bsc", "dyo", "ff", "fuc", "ful", "knf", "mey", "mfv", "sav", "snf", "srr", "tnr"],
|
|
316
|
+
},
|
|
317
|
+
SO: { official: ["ar", "ara", "arb", "so", "som"] },
|
|
318
|
+
SR: { official: ["dut", "nl", "nld"] },
|
|
319
|
+
SS: { official: ["en", "eng"] },
|
|
320
|
+
ST: { official: ["por", "pt"] },
|
|
321
|
+
SV: { official: ["es", "spa"] },
|
|
322
|
+
SX: { official: ["dut", "en", "eng", "nl", "nld"] },
|
|
323
|
+
SY: { official: ["ar", "ara", "arb"] },
|
|
324
|
+
SZ: { official: ["en", "eng", "ss", "ssw"] },
|
|
325
|
+
TC: { official: ["en", "eng"] },
|
|
326
|
+
TD: { official: ["ar", "ara", "arb", "fr", "fra", "fre"] },
|
|
327
|
+
TG: { official: ["fr", "fra", "fre"] },
|
|
328
|
+
TH: { official: ["th", "tha"] },
|
|
329
|
+
TJ: { official: ["tg", "tgk"] },
|
|
330
|
+
TK: { official: ["en", "eng", "tkl"] },
|
|
331
|
+
TL: { official: ["por", "pt", "tet"] },
|
|
332
|
+
TM: { official: ["tk", "tuk"] },
|
|
333
|
+
TN: { official: ["ar", "ara", "arb", "fr", "fra", "fre"] },
|
|
334
|
+
TO: { official: ["en", "eng", "to", "ton"] },
|
|
335
|
+
TR: { official: ["tr", "tur"] },
|
|
336
|
+
TT: { official: ["en", "eng"] },
|
|
337
|
+
TV: { official: ["en", "eng", "tvl"] },
|
|
338
|
+
TW: { official: ["chi", "cmn", "hak", "nan", "zh", "zho"] },
|
|
339
|
+
TZ: { official: ["en", "eng", "sw", "swa", "swh"] },
|
|
340
|
+
UA: { official: ["ru", "rus", "uk", "ukr"] },
|
|
341
|
+
UG: { official: ["en", "eng", "sw", "swa", "swh"] },
|
|
342
|
+
UM: { official: ["en", "eng"] },
|
|
343
|
+
US: { official: ["en", "eng"], regional: ["es", "haw", "spa"] },
|
|
344
|
+
UY: { official: ["es", "spa"] },
|
|
345
|
+
UZ: { official: ["uz", "uzb", "uzn"] },
|
|
346
|
+
VA: { official: ["it", "ita"] },
|
|
347
|
+
VC: { official: ["en", "eng"] },
|
|
348
|
+
VE: { official: ["es", "spa"] },
|
|
349
|
+
VG: { official: ["en", "eng"] },
|
|
350
|
+
VI: { official: ["en", "eng"] },
|
|
351
|
+
VN: { official: ["vi", "vie"] },
|
|
352
|
+
VU: { official: ["bi", "bis", "en", "eng", "fr", "fra", "fre"] },
|
|
353
|
+
WF: { official: ["fr", "fra", "fre"] },
|
|
354
|
+
WS: { official: ["en", "eng", "sm", "smo"] },
|
|
355
|
+
XK: { official: ["alb", "als", "scc", "sq", "sqi", "sr", "srp"] },
|
|
356
|
+
YE: { official: ["ar", "ara", "arb"] },
|
|
357
|
+
YT: { official: ["fr", "fra", "fre"] },
|
|
358
|
+
ZA: {
|
|
359
|
+
official: ["en", "eng"],
|
|
360
|
+
regional: [
|
|
361
|
+
"af",
|
|
362
|
+
"afr",
|
|
363
|
+
"nbl",
|
|
364
|
+
"nr",
|
|
365
|
+
"nso",
|
|
366
|
+
"sot",
|
|
367
|
+
"ss",
|
|
368
|
+
"ssw",
|
|
369
|
+
"st",
|
|
370
|
+
"tn",
|
|
371
|
+
"ts",
|
|
372
|
+
"tsn",
|
|
373
|
+
"tso",
|
|
374
|
+
"ve",
|
|
375
|
+
"ven",
|
|
376
|
+
"xh",
|
|
377
|
+
"xho",
|
|
378
|
+
"zu",
|
|
379
|
+
"zul",
|
|
380
|
+
],
|
|
381
|
+
},
|
|
382
|
+
ZM: { official: ["en", "eng"] },
|
|
383
|
+
ZW: { official: ["en", "eng", "nd", "nde", "sn", "sna"] },
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Is `language` (any ISO-639 spelling: "sv", "swe", …) an official language of `country` (ISO 3166-1 alpha-2)?
|
|
388
|
+
* Regional-official languages count only with `includeRegional`.
|
|
389
|
+
*/
|
|
390
|
+
export function isOfficialLanguage(country: string, language: string, includeRegional = false): boolean {
|
|
391
|
+
const entry = OFFICIAL_LANGUAGES[country.toUpperCase()]
|
|
392
|
+
|
|
393
|
+
if (!entry) return false
|
|
394
|
+
const lang = language.toLowerCase()
|
|
395
|
+
|
|
396
|
+
return entry.official.includes(lang) || (includeRegional && (entry.regional?.includes(lang) ?? false))
|
|
397
|
+
}
|