xref: /webtrees/app/Statistics/Service/CountryService.php (revision 05ff6595cf61d6551a1740456e8272b8c07ae493)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2023 webtrees development team
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18declare(strict_types=1);
19
20namespace Fisharebest\Webtrees\Statistics\Service;
21
22use Fisharebest\Webtrees\I18N;
23
24/**
25 * Functions for managing country codes and names.
26 */
27class CountryService
28{
29    /**
30     * Country codes and names
31     *
32     * @return array<string>
33     */
34    public function getAllCountries(): array
35    {
36        return [
37            /* I18N: Name of a country or state */
38            '???' => I18N::translate('Unknown'),
39            /* I18N: Name of a country or state */
40            'ABW' => I18N::translate('Aruba'),
41            /* I18N: Name of a country or state */
42            'AFG' => I18N::translate('Afghanistan'),
43            /* I18N: Name of a country or state */
44            'AGO' => I18N::translate('Angola'),
45            /* I18N: Name of a country or state */
46            'AIA' => I18N::translate('Anguilla'),
47            /* I18N: Name of a country or state */
48            'ALA' => I18N::translate('Åland Islands'),
49            /* I18N: Name of a country or state */
50            'ALB' => I18N::translate('Albania'),
51            /* I18N: Name of a country or state */
52            'AND' => I18N::translate('Andorra'),
53            /* I18N: Name of a country or state */
54            'ARE' => I18N::translate('United Arab Emirates'),
55            /* I18N: Name of a country or state */
56            'ARG' => I18N::translate('Argentina'),
57            /* I18N: Name of a country or state */
58            'ARM' => I18N::translate('Armenia'),
59            /* I18N: Name of a country or state */
60            'ASM' => I18N::translate('American Samoa'),
61            /* I18N: Name of a country or state */
62            'ATA' => I18N::translate('Antarctica'),
63            /* I18N: Name of a country or state */
64            'ATF' => I18N::translate('French Southern Territories'),
65            /* I18N: Name of a country or state */
66            'ATG' => I18N::translate('Antigua and Barbuda'),
67            /* I18N: Name of a country or state */
68            'AUS' => I18N::translate('Australia'),
69            /* I18N: Name of a country or state */
70            'AUT' => I18N::translate('Austria'),
71            /* I18N: Name of a country or state */
72            'AZE' => I18N::translate('Azerbaijan'),
73            /* I18N: Name of a country or state */
74            'AZR' => I18N::translate('Azores'),
75            /* I18N: Name of a country or state */
76            'BDI' => I18N::translate('Burundi'),
77            /* I18N: Name of a country or state */
78            'BEL' => I18N::translate('Belgium'),
79            /* I18N: Name of a country or state */
80            'BEN' => I18N::translate('Benin'),
81            // BES => Bonaire, Sint Eustatius and Saba
82            /* I18N: Name of a country or state */
83            'BFA' => I18N::translate('Burkina Faso'),
84            /* I18N: Name of a country or state */
85            'BGD' => I18N::translate('Bangladesh'),
86            /* I18N: Name of a country or state */
87            'BGR' => I18N::translate('Bulgaria'),
88            /* I18N: Name of a country or state */
89            'BHR' => I18N::translate('Bahrain'),
90            /* I18N: Name of a country or state */
91            'BHS' => I18N::translate('Bahamas'),
92            /* I18N: Name of a country or state */
93            'BIH' => I18N::translate('Bosnia and Herzegovina'),
94            // BLM => Saint Barthélemy
95            'BLM' => I18N::translate('Saint Barthélemy'),
96            /* I18N: Name of a country or state */
97            'BLR' => I18N::translate('Belarus'),
98            /* I18N: Name of a country or state */
99            'BLZ' => I18N::translate('Belize'),
100            /* I18N: Name of a country or state */
101            'BMU' => I18N::translate('Bermuda'),
102            /* I18N: Name of a country or state */
103            'BOL' => I18N::translate('Bolivia'),
104            /* I18N: Name of a country or state */
105            'BRA' => I18N::translate('Brazil'),
106            /* I18N: Name of a country or state */
107            'BRB' => I18N::translate('Barbados'),
108            /* I18N: Name of a country or state */
109            'BRN' => I18N::translate('Brunei Darussalam'),
110            /* I18N: Name of a country or state */
111            'BTN' => I18N::translate('Bhutan'),
112            /* I18N: Name of a country or state */
113            'BVT' => I18N::translate('Bouvet Island'),
114            /* I18N: Name of a country or state */
115            'BWA' => I18N::translate('Botswana'),
116            /* I18N: Name of a country or state */
117            'CAF' => I18N::translate('Central African Republic'),
118            /* I18N: Name of a country or state */
119            'CAN' => I18N::translate('Canada'),
120            /* I18N: Name of a country or state */
121            'CCK' => I18N::translate('Cocos (Keeling) Islands'),
122            /* I18N: Name of a country or state */
123            'CHE' => I18N::translate('Switzerland'),
124            /* I18N: Name of a country or state */
125            'CHL' => I18N::translate('Chile'),
126            /* I18N: Name of a country or state */
127            'CHN' => I18N::translate('China'),
128            /* I18N: Name of a country or state */
129            'CIV' => I18N::translate('Côte d’Ivoire'),
130            /* I18N: Name of a country or state */
131            'CMR' => I18N::translate('Cameroon'),
132            /* I18N: Name of a country or state */
133            'COD' => I18N::translate('Democratic Republic of the Congo'),
134            /* I18N: Name of a country or state */
135            'COG' => I18N::translate('Republic of the Congo'),
136            /* I18N: Name of a country or state */
137            'COK' => I18N::translate('Cook Islands'),
138            /* I18N: Name of a country or state */
139            'COL' => I18N::translate('Colombia'),
140            /* I18N: Name of a country or state */
141            'COM' => I18N::translate('Comoros'),
142            /* I18N: Name of a country or state */
143            'CPV' => I18N::translate('Cape Verde'),
144            /* I18N: Name of a country or state */
145            'CRI' => I18N::translate('Costa Rica'),
146            /* I18N: Name of a country or state */
147            'CUB' => I18N::translate('Cuba'),
148            /* I18N: Name of a country or state */
149            'CUW' => I18N::translate('Curaçao'),
150            /* I18N: Name of a country or state */
151            'CXR' => I18N::translate('Christmas Island'),
152            /* I18N: Name of a country or state */
153            'CYM' => I18N::translate('Cayman Islands'),
154            /* I18N: Name of a country or state */
155            'CYP' => I18N::translate('Cyprus'),
156            /* I18N: Name of a country or state */
157            'CZE' => I18N::translate('Czech Republic'),
158            /* I18N: Name of a country or state */
159            'DEU' => I18N::translate('Germany'),
160            /* I18N: Name of a country or state */
161            'DJI' => I18N::translate('Djibouti'),
162            /* I18N: Name of a country or state */
163            'DMA' => I18N::translate('Dominica'),
164            /* I18N: Name of a country or state */
165            'DNK' => I18N::translate('Denmark'),
166            /* I18N: Name of a country or state */
167            'DOM' => I18N::translate('Dominican Republic'),
168            /* I18N: Name of a country or state */
169            'DZA' => I18N::translate('Algeria'),
170            /* I18N: Name of a country or state */
171            'ECU' => I18N::translate('Ecuador'),
172            /* I18N: Name of a country or state */
173            'EGY' => I18N::translate('Egypt'),
174            /* I18N: Name of a country or state */
175            'ENG' => I18N::translate('England'),
176            /* I18N: Name of a country or state */
177            'ERI' => I18N::translate('Eritrea'),
178            /* I18N: Name of a country or state */
179            'ESH' => I18N::translate('Western Sahara'),
180            /* I18N: Name of a country or state */
181            'ESP' => I18N::translate('Spain'),
182            /* I18N: Name of a country or state */
183            'EST' => I18N::translate('Estonia'),
184            /* I18N: Name of a country or state */
185            'ETH' => I18N::translate('Ethiopia'),
186            /* I18N: Name of a country or state */
187            'FIN' => I18N::translate('Finland'),
188            /* I18N: Name of a country or state */
189            'FJI' => I18N::translate('Fiji'),
190            /* I18N: Name of a country or state */
191            'FLD' => I18N::translate('Flanders'),
192            /* I18N: Name of a country or state */
193            'FLK' => I18N::translate('Falkland Islands'),
194            /* I18N: Name of a country or state */
195            'FRA' => I18N::translate('France'),
196            /* I18N: Name of a country or state */
197            'FRO' => I18N::translate('Faroe Islands'),
198            /* I18N: Name of a country or state */
199            'FSM' => I18N::translate('Micronesia'),
200            /* I18N: Name of a country or state */
201            'GAB' => I18N::translate('Gabon'),
202            /* I18N: Name of a country or state */
203            'GBR' => I18N::translate('United Kingdom'),
204            /* I18N: Name of a country or state */
205            'GEO' => I18N::translate('Georgia'),
206            /* I18N: Name of a country or state */
207            'GGY' => I18N::translate('Guernsey'),
208            /* I18N: Name of a country or state */
209            'GHA' => I18N::translate('Ghana'),
210            /* I18N: Name of a country or state */
211            'GIB' => I18N::translate('Gibraltar'),
212            /* I18N: Name of a country or state */
213            'GIN' => I18N::translate('Guinea'),
214            /* I18N: Name of a country or state */
215            'GLP' => I18N::translate('Guadeloupe'),
216            /* I18N: Name of a country or state */
217            'GMB' => I18N::translate('Gambia'),
218            /* I18N: Name of a country or state */
219            'GNB' => I18N::translate('Guinea-Bissau'),
220            /* I18N: Name of a country or state */
221            'GNQ' => I18N::translate('Equatorial Guinea'),
222            /* I18N: Name of a country or state */
223            'GRC' => I18N::translate('Greece'),
224            /* I18N: Name of a country or state */
225            'GRD' => I18N::translate('Grenada'),
226            /* I18N: Name of a country or state */
227            'GRL' => I18N::translate('Greenland'),
228            /* I18N: Name of a country or state */
229            'GTM' => I18N::translate('Guatemala'),
230            /* I18N: Name of a country or state */
231            'GUF' => I18N::translate('French Guiana'),
232            /* I18N: Name of a country or state */
233            'GUM' => I18N::translate('Guam'),
234            /* I18N: Name of a country or state */
235            'GUY' => I18N::translate('Guyana'),
236            /* I18N: Name of a country or state */
237            'HKG' => I18N::translate('Hong Kong'),
238            /* I18N: Name of a country or state */
239            'HMD' => I18N::translate('Heard Island and McDonald Islands'),
240            /* I18N: Name of a country or state */
241            'HND' => I18N::translate('Honduras'),
242            /* I18N: Name of a country or state */
243            'HRV' => I18N::translate('Croatia'),
244            /* I18N: Name of a country or state */
245            'HTI' => I18N::translate('Haiti'),
246            /* I18N: Name of a country or state */
247            'HUN' => I18N::translate('Hungary'),
248            /* I18N: Name of a country or state */
249            'IDN' => I18N::translate('Indonesia'),
250            /* I18N: Name of a country or state */
251            'IND' => I18N::translate('India'),
252            /* I18N: Name of a country or state */
253            'IOM' => I18N::translate('Isle of Man'),
254            /* I18N: Name of a country or state */
255            'IOT' => I18N::translate('British Indian Ocean Territory'),
256            /* I18N: Name of a country or state */
257            'IRL' => I18N::translate('Ireland'),
258            /* I18N: Name of a country or state */
259            'IRN' => I18N::translate('Iran'),
260            /* I18N: Name of a country or state */
261            'IRQ' => I18N::translate('Iraq'),
262            /* I18N: Name of a country or state */
263            'ISL' => I18N::translate('Iceland'),
264            /* I18N: Name of a country or state */
265            'ISR' => I18N::translate('Israel'),
266            /* I18N: Name of a country or state */
267            'ITA' => I18N::translate('Italy'),
268            /* I18N: Name of a country or state */
269            'JAM' => I18N::translate('Jamaica'),
270            //'JEY' => Jersey
271            /* I18N: Name of a country or state */
272            'JOR' => I18N::translate('Jordan'),
273            /* I18N: Name of a country or state */
274            'JPN' => I18N::translate('Japan'),
275            /* I18N: Name of a country or state */
276            'KAZ' => I18N::translate('Kazakhstan'),
277            /* I18N: Name of a country or state */
278            'KEN' => I18N::translate('Kenya'),
279            /* I18N: Name of a country or state */
280            'KGZ' => I18N::translate('Kyrgyzstan'),
281            /* I18N: Name of a country or state */
282            'KHM' => I18N::translate('Cambodia'),
283            /* I18N: Name of a country or state */
284            'KIR' => I18N::translate('Kiribati'),
285            /* I18N: Name of a country or state */
286            'KNA' => I18N::translate('Saint Kitts and Nevis'),
287            /* I18N: Name of a country or state */
288            'KOR' => I18N::translate('Korea'),
289            /* I18N: Name of a country or state */
290            'KWT' => I18N::translate('Kuwait'),
291            /* I18N: Name of a country or state */
292            'LAO' => I18N::translate('Laos'),
293            /* I18N: Name of a country or state */
294            'LBN' => I18N::translate('Lebanon'),
295            /* I18N: Name of a country or state */
296            'LBR' => I18N::translate('Liberia'),
297            /* I18N: Name of a country or state */
298            'LBY' => I18N::translate('Libya'),
299            /* I18N: Name of a country or state */
300            'LCA' => I18N::translate('Saint Lucia'),
301            /* I18N: Name of a country or state */
302            'LIE' => I18N::translate('Liechtenstein'),
303            /* I18N: Name of a country or state */
304            'LKA' => I18N::translate('Sri Lanka'),
305            /* I18N: Name of a country or state */
306            'LSO' => I18N::translate('Lesotho'),
307            /* I18N: Name of a country or state */
308            'LTU' => I18N::translate('Lithuania'),
309            /* I18N: Name of a country or state */
310            'LUX' => I18N::translate('Luxembourg'),
311            /* I18N: Name of a country or state */
312            'LVA' => I18N::translate('Latvia'),
313            /* I18N: Name of a country or state */
314            'MAC' => I18N::translate('Macau'),
315            // MAF => Saint Martin
316            /* I18N: Name of a country or state */
317            'MAR' => I18N::translate('Morocco'),
318            /* I18N: Name of a country or state */
319            'MCO' => I18N::translate('Monaco'),
320            /* I18N: Name of a country or state */
321            'MDA' => I18N::translate('Moldova'),
322            /* I18N: Name of a country or state */
323            'MDG' => I18N::translate('Madagascar'),
324            /* I18N: Name of a country or state */
325            'MDV' => I18N::translate('Maldives'),
326            /* I18N: Name of a country or state */
327            'MEX' => I18N::translate('Mexico'),
328            /* I18N: Name of a country or state */
329            'MHL' => I18N::translate('Marshall Islands'),
330            /* I18N: Name of a country or state */
331            'MKD' => I18N::translate('Macedonia'),
332            /* I18N: Name of a country or state */
333            'MLI' => I18N::translate('Mali'),
334            /* I18N: Name of a country or state */
335            'MLT' => I18N::translate('Malta'),
336            /* I18N: Name of a country or state */
337            'MMR' => I18N::translate('Myanmar'),
338            /* I18N: Name of a country or state */
339            'MNG' => I18N::translate('Mongolia'),
340            /* I18N: Name of a country or state */
341            'MNP' => I18N::translate('Northern Mariana Islands'),
342            /* I18N: Name of a country or state */
343            'MNT' => I18N::translate('Montenegro'),
344            /* I18N: Name of a country or state */
345            'MOZ' => I18N::translate('Mozambique'),
346            /* I18N: Name of a country or state */
347            'MRT' => I18N::translate('Mauritania'),
348            /* I18N: Name of a country or state */
349            'MSR' => I18N::translate('Montserrat'),
350            /* I18N: Name of a country or state */
351            'MTQ' => I18N::translate('Martinique'),
352            /* I18N: Name of a country or state */
353            'MUS' => I18N::translate('Mauritius'),
354            /* I18N: Name of a country or state */
355            'MWI' => I18N::translate('Malawi'),
356            /* I18N: Name of a country or state */
357            'MYS' => I18N::translate('Malaysia'),
358            /* I18N: Name of a country or state */
359            'MYT' => I18N::translate('Mayotte'),
360            /* I18N: Name of a country or state */
361            'NAM' => I18N::translate('Namibia'),
362            /* I18N: Name of a country or state */
363            'NCL' => I18N::translate('New Caledonia'),
364            /* I18N: Name of a country or state */
365            'NER' => I18N::translate('Niger'),
366            /* I18N: Name of a country or state */
367            'NFK' => I18N::translate('Norfolk Island'),
368            /* I18N: Name of a country or state */
369            'NGA' => I18N::translate('Nigeria'),
370            /* I18N: Name of a country or state */
371            'NIC' => I18N::translate('Nicaragua'),
372            /* I18N: Name of a country or state */
373            'NIR' => I18N::translate('Northern Ireland'),
374            /* I18N: Name of a country or state */
375            'NIU' => I18N::translate('Niue'),
376            /* I18N: Name of a country or state */
377            'NLD' => I18N::translate('Netherlands'),
378            /* I18N: Name of a country or state */
379            'NOR' => I18N::translate('Norway'),
380            /* I18N: Name of a country or state */
381            'NPL' => I18N::translate('Nepal'),
382            /* I18N: Name of a country or state */
383            'NRU' => I18N::translate('Nauru'),
384            /* I18N: Name of a country or state */
385            'NZL' => I18N::translate('New Zealand'),
386            /* I18N: Name of a country or state */
387            'OMN' => I18N::translate('Oman'),
388            /* I18N: Name of a country or state */
389            'PAK' => I18N::translate('Pakistan'),
390            /* I18N: Name of a country or state */
391            'PAN' => I18N::translate('Panama'),
392            /* I18N: Name of a country or state */
393            'PCN' => I18N::translate('Pitcairn'),
394            /* I18N: Name of a country or state */
395            'PER' => I18N::translate('Peru'),
396            /* I18N: Name of a country or state */
397            'PHL' => I18N::translate('Philippines'),
398            /* I18N: Name of a country or state */
399            'PLW' => I18N::translate('Palau'),
400            /* I18N: Name of a country or state */
401            'PNG' => I18N::translate('Papua New Guinea'),
402            /* I18N: Name of a country or state */
403            'POL' => I18N::translate('Poland'),
404            /* I18N: Name of a country or state */
405            'PRI' => I18N::translate('Puerto Rico'),
406            /* I18N: Name of a country or state */
407            'PRK' => I18N::translate('North Korea'),
408            /* I18N: Name of a country or state */
409            'PRT' => I18N::translate('Portugal'),
410            /* I18N: Name of a country or state */
411            'PRY' => I18N::translate('Paraguay'),
412            /* I18N: Name of a country or state */
413            'PSE' => I18N::translate('Occupied Palestinian Territory'),
414            /* I18N: Name of a country or state */
415            'PYF' => I18N::translate('French Polynesia'),
416            /* I18N: Name of a country or state */
417            'QAT' => I18N::translate('Qatar'),
418            /* I18N: Name of a country or state */
419            'REU' => I18N::translate('Réunion'),
420            /* I18N: Name of a country or state */
421            'ROM' => I18N::translate('Romania'),
422            /* I18N: Name of a country or state */
423            'RUS' => I18N::translate('Russia'),
424            /* I18N: Name of a country or state */
425            'RWA' => I18N::translate('Rwanda'),
426            /* I18N: Name of a country or state */
427            'SAU' => I18N::translate('Saudi Arabia'),
428            /* I18N: Name of a country or state */
429            'SCT' => I18N::translate('Scotland'),
430            /* I18N: Name of a country or state */
431            'SDN' => I18N::translate('Sudan'),
432            /* I18N: Name of a country or state */
433            'SEA' => I18N::translate('At sea'),
434            /* I18N: Name of a country or state */
435            'SEN' => I18N::translate('Senegal'),
436            /* I18N: Name of a country or state */
437            'SER' => I18N::translate('Serbia'),
438            /* I18N: Name of a country or state */
439            'SGP' => I18N::translate('Singapore'),
440            /* I18N: Name of a country or state */
441            'SGS' => I18N::translate('South Georgia and the South Sandwich Islands'),
442            /* I18N: Name of a country or state */
443            'SHN' => I18N::translate('Saint Helena'),
444            /* I18N: Name of a country or state */
445            'SJM' => I18N::translate('Svalbard and Jan Mayen'),
446            /* I18N: Name of a country or state */
447            'SLB' => I18N::translate('Solomon Islands'),
448            /* I18N: Name of a country or state */
449            'SLE' => I18N::translate('Sierra Leone'),
450            /* I18N: Name of a country or state */
451            'SLV' => I18N::translate('El Salvador'),
452            /* I18N: Name of a country or state */
453            'SMR' => I18N::translate('San Marino'),
454            /* I18N: Name of a country or state */
455            'SOM' => I18N::translate('Somalia'),
456            /* I18N: Name of a country or state */
457            'SPM' => I18N::translate('Saint Pierre and Miquelon'),
458            /* I18N: Name of a country or state */
459            'SSD' => I18N::translate('South Sudan'),
460            /* I18N: Name of a country or state */
461            'STP' => I18N::translate('Sao Tome and Principe'),
462            /* I18N: Name of a country or state */
463            'SUR' => I18N::translate('Suriname'),
464            /* I18N: Name of a country or state */
465            'SVK' => I18N::translate('Slovakia'),
466            /* I18N: Name of a country or state */
467            'SVN' => I18N::translate('Slovenia'),
468            /* I18N: Name of a country or state */
469            'SWE' => I18N::translate('Sweden'),
470            /* I18N: Name of a country or state */
471            'SWZ' => I18N::translate('Swaziland'),
472            // SXM => Sint Maarten
473            /* I18N: Name of a country or state */
474            'SYC' => I18N::translate('Seychelles'),
475            /* I18N: Name of a country or state */
476            'SYR' => I18N::translate('Syria'),
477            /* I18N: Name of a country or state */
478            'TCA' => I18N::translate('Turks and Caicos Islands'),
479            /* I18N: Name of a country or state */
480            'TCD' => I18N::translate('Chad'),
481            /* I18N: Name of a country or state */
482            'TGO' => I18N::translate('Togo'),
483            /* I18N: Name of a country or state */
484            'THA' => I18N::translate('Thailand'),
485            /* I18N: Name of a country or state */
486            'TJK' => I18N::translate('Tajikistan'),
487            /* I18N: Name of a country or state */
488            'TKL' => I18N::translate('Tokelau'),
489            /* I18N: Name of a country or state */
490            'TKM' => I18N::translate('Turkmenistan'),
491            /* I18N: Name of a country or state */
492            'TLS' => I18N::translate('Timor-Leste'),
493            /* I18N: Name of a country or state */
494            'TON' => I18N::translate('Tonga'),
495            /* I18N: Name of a country or state */
496            'TTO' => I18N::translate('Trinidad and Tobago'),
497            /* I18N: Name of a country or state */
498            'TUN' => I18N::translate('Tunisia'),
499            /* I18N: Name of a country or state */
500            'TUR' => I18N::translate('Turkey'),
501            /* I18N: Name of a country or state */
502            'TUV' => I18N::translate('Tuvalu'),
503            /* I18N: Name of a country or state */
504            'TWN' => I18N::translate('Taiwan'),
505            /* I18N: Name of a country or state */
506            'TZA' => I18N::translate('Tanzania'),
507            /* I18N: Name of a country or state */
508            'UGA' => I18N::translate('Uganda'),
509            /* I18N: Name of a country or state */
510            'UKR' => I18N::translate('Ukraine'),
511            /* I18N: Name of a country or state */
512            'UMI' => I18N::translate('US Minor Outlying Islands'),
513            /* I18N: Name of a country or state */
514            'URY' => I18N::translate('Uruguay'),
515            /* I18N: Name of a country or state */
516            'USA' => I18N::translate('United States'),
517            /* I18N: Name of a country or state */
518            'UZB' => I18N::translate('Uzbekistan'),
519            /* I18N: Name of a country or state */
520            'VAT' => I18N::translate('Vatican City'),
521            /* I18N: Name of a country or state */
522            'VCT' => I18N::translate('Saint Vincent and the Grenadines'),
523            /* I18N: Name of a country or state */
524            'VEN' => I18N::translate('Venezuela'),
525            /* I18N: Name of a country or state */
526            'VGB' => I18N::translate('British Virgin Islands'),
527            /* I18N: Name of a country or state */
528            'VIR' => I18N::translate('US Virgin Islands'),
529            /* I18N: Name of a country or state */
530            'VNM' => I18N::translate('Vietnam'),
531            /* I18N: Name of a country or state */
532            'VUT' => I18N::translate('Vanuatu'),
533            /* I18N: Name of a country or state */
534            'WLF' => I18N::translate('Wallis and Futuna'),
535            /* I18N: Name of a country or state */
536            'WLS' => I18N::translate('Wales'),
537            /* I18N: Name of a country or state */
538            'WSM' => I18N::translate('Samoa'),
539            /* I18N: Name of a country or state */
540            'YEM' => I18N::translate('Yemen'),
541            /* I18N: Name of a country or state */
542            'ZAF' => I18N::translate('South Africa'),
543            /* I18N: Name of a country or state */
544            'ZMB' => I18N::translate('Zambia'),
545            /* I18N: Name of a country or state */
546            'ZWE' => I18N::translate('Zimbabwe'),
547        ];
548    }
549
550    /**
551     * ISO3166 3 letter codes, with their 2 letter equivalent.
552     * NOTE: this is not 1:1. ENG/SCO/WAL/NIR => GB
553     * NOTE: this also includes chapman codes and others. Should it?
554     *
555     * @return array<string>
556     */
557    public function iso3166(): array
558    {
559        return [
560            'GBR' => 'GB', // Must come before ENG, NIR, SCT and WLS
561            'ABW' => 'AW',
562            'AFG' => 'AF',
563            'AGO' => 'AO',
564            'AIA' => 'AI',
565            'ALA' => 'AX',
566            'ALB' => 'AL',
567            'AND' => 'AD',
568            'ARE' => 'AE',
569            'ARG' => 'AR',
570            'ARM' => 'AM',
571            'ASM' => 'AS',
572            'ATA' => 'AQ',
573            'ATF' => 'TF',
574            'ATG' => 'AG',
575            'AUS' => 'AU',
576            'AUT' => 'AT',
577            'AZE' => 'AZ',
578            'BDI' => 'BI',
579            'BEL' => 'BE',
580            'BEN' => 'BJ',
581            'BFA' => 'BF',
582            'BGD' => 'BD',
583            'BGR' => 'BG',
584            'BHR' => 'BH',
585            'BHS' => 'BS',
586            'BIH' => 'BA',
587            'BLR' => 'BY',
588            'BLZ' => 'BZ',
589            'BMU' => 'BM',
590            'BOL' => 'BO',
591            'BRA' => 'BR',
592            'BRB' => 'BB',
593            'BRN' => 'BN',
594            'BTN' => 'BT',
595            'BVT' => 'BV',
596            'BWA' => 'BW',
597            'CAF' => 'CF',
598            'CAN' => 'CA',
599            'CCK' => 'CC',
600            'CHE' => 'CH',
601            'CHL' => 'CL',
602            'CHN' => 'CN',
603            'CIV' => 'CI',
604            'CMR' => 'CM',
605            'COD' => 'CD',
606            'COG' => 'CG',
607            'COK' => 'CK',
608            'COL' => 'CO',
609            'COM' => 'KM',
610            'CPV' => 'CV',
611            'CRI' => 'CR',
612            'CUB' => 'CU',
613            'CXR' => 'CX',
614            'CYM' => 'KY',
615            'CYP' => 'CY',
616            'CZE' => 'CZ',
617            'DEU' => 'DE',
618            'DJI' => 'DJ',
619            'DMA' => 'DM',
620            'DNK' => 'DK',
621            'DOM' => 'DO',
622            'DZA' => 'DZ',
623            'ECU' => 'EC',
624            'EGY' => 'EG',
625            'ENG' => 'GB',
626            'ERI' => 'ER',
627            'ESH' => 'EH',
628            'ESP' => 'ES',
629            'EST' => 'EE',
630            'ETH' => 'ET',
631            'FIN' => 'FI',
632            'FJI' => 'FJ',
633            'FLK' => 'FK',
634            'FRA' => 'FR',
635            'FRO' => 'FO',
636            'FSM' => 'FM',
637            'GAB' => 'GA',
638            'GEO' => 'GE',
639            'GHA' => 'GH',
640            'GIB' => 'GI',
641            'GIN' => 'GN',
642            'GLP' => 'GP',
643            'GMB' => 'GM',
644            'GNB' => 'GW',
645            'GNQ' => 'GQ',
646            'GRC' => 'GR',
647            'GRD' => 'GD',
648            'GRL' => 'GL',
649            'GTM' => 'GT',
650            'GUF' => 'GF',
651            'GUM' => 'GU',
652            'GUY' => 'GY',
653            'HKG' => 'HK',
654            'HMD' => 'HM',
655            'HND' => 'HN',
656            'HRV' => 'HR',
657            'HTI' => 'HT',
658            'HUN' => 'HU',
659            'IDN' => 'ID',
660            'IND' => 'IN',
661            'IOT' => 'IO',
662            'IRL' => 'IE',
663            'IRN' => 'IR',
664            'IRQ' => 'IQ',
665            'ISL' => 'IS',
666            'ISR' => 'IL',
667            'ITA' => 'IT',
668            'JAM' => 'JM',
669            'JOR' => 'JO',
670            'JPN' => 'JP',
671            'KAZ' => 'KZ',
672            'KEN' => 'KE',
673            'KGZ' => 'KG',
674            'KHM' => 'KH',
675            'KIR' => 'KI',
676            'KNA' => 'KN',
677            'KOR' => 'KO',
678            'KWT' => 'KW',
679            'LAO' => 'LA',
680            'LBN' => 'LB',
681            'LBR' => 'LR',
682            'LBY' => 'LY',
683            'LCA' => 'LC',
684            'LIE' => 'LI',
685            'LKA' => 'LK',
686            'LSO' => 'LS',
687            'LTU' => 'LT',
688            'LUX' => 'LU',
689            'LVA' => 'LV',
690            'MAC' => 'MO',
691            'MAR' => 'MA',
692            'MCO' => 'MC',
693            'MDA' => 'MD',
694            'MDG' => 'MG',
695            'MDV' => 'MV',
696            'MEX' => 'MX',
697            'MHL' => 'MH',
698            'MKD' => 'MK',
699            'MLI' => 'ML',
700            'MLT' => 'MT',
701            'MMR' => 'MM',
702            'MNG' => 'MN',
703            'MNP' => 'MP',
704            'MNT' => 'ME',
705            'MOZ' => 'MZ',
706            'MRT' => 'MR',
707            'MSR' => 'MS',
708            'MTQ' => 'MQ',
709            'MUS' => 'MU',
710            'MWI' => 'MW',
711            'MYS' => 'MY',
712            'MYT' => 'YT',
713            'NAM' => 'NA',
714            'NCL' => 'NC',
715            'NER' => 'NE',
716            'NFK' => 'NF',
717            'NGA' => 'NG',
718            'NIC' => 'NI',
719            'NIR' => 'GB',
720            'NIU' => 'NU',
721            'NLD' => 'NL',
722            'NOR' => 'NO',
723            'NPL' => 'NP',
724            'NRU' => 'NR',
725            'NZL' => 'NZ',
726            'OMN' => 'OM',
727            'PAK' => 'PK',
728            'PAN' => 'PA',
729            'PCN' => 'PN',
730            'PER' => 'PE',
731            'PHL' => 'PH',
732            'PLW' => 'PW',
733            'PNG' => 'PG',
734            'POL' => 'PL',
735            'PRI' => 'PR',
736            'PRK' => 'KP',
737            'PRT' => 'PT',
738            'PRY' => 'PY',
739            'PSE' => 'PS',
740            'PYF' => 'PF',
741            'QAT' => 'QA',
742            'REU' => 'RE',
743            'ROM' => 'RO',
744            'RUS' => 'RU',
745            'RWA' => 'RW',
746            'SAU' => 'SA',
747            'SCT' => 'GB',
748            'SDN' => 'SD',
749            'SEN' => 'SN',
750            'SER' => 'RS',
751            'SGP' => 'SG',
752            'SGS' => 'GS',
753            'SHN' => 'SH',
754            'SJM' => 'SJ',
755            'SLB' => 'SB',
756            'SLE' => 'SL',
757            'SLV' => 'SV',
758            'SMR' => 'SM',
759            'SOM' => 'SO',
760            'SPM' => 'PM',
761            'STP' => 'ST',
762            'SUR' => 'SR',
763            'SVK' => 'SK',
764            'SVN' => 'SI',
765            'SWE' => 'SE',
766            'SWZ' => 'SZ',
767            'SYC' => 'SC',
768            'SYR' => 'SY',
769            'TCA' => 'TC',
770            'TCD' => 'TD',
771            'TGO' => 'TG',
772            'THA' => 'TH',
773            'TJK' => 'TJ',
774            'TKL' => 'TK',
775            'TKM' => 'TM',
776            'TLS' => 'TL',
777            'TON' => 'TO',
778            'TTO' => 'TT',
779            'TUN' => 'TN',
780            'TUR' => 'TR',
781            'TUV' => 'TV',
782            'TWN' => 'TW',
783            'TZA' => 'TZ',
784            'UGA' => 'UG',
785            'UKR' => 'UA',
786            'UMI' => 'UM',
787            'URY' => 'UY',
788            'USA' => 'US',
789            'UZB' => 'UZ',
790            'VAT' => 'VA',
791            'VCT' => 'VC',
792            'VEN' => 'VE',
793            'VGB' => 'VG',
794            'VIR' => 'VI',
795            'VNM' => 'VN',
796            'VUT' => 'VU',
797            'WLF' => 'WF',
798            'WLS' => 'GB',
799            'WSM' => 'WS',
800            'YEM' => 'YE',
801            'ZAF' => 'ZA',
802            'ZMB' => 'ZM',
803            'ZWE' => 'ZW',
804        ];
805    }
806
807    /**
808     * Returns the translated country name based on the given two letter country code.
809     *
810     * @param string $twoLetterCode The two letter country code
811     *
812     * @return string
813     */
814    public function mapTwoLetterToName(string $twoLetterCode): string
815    {
816        $threeLetterCode = array_search($twoLetterCode, $this->iso3166(), true);
817        $threeLetterCode = $threeLetterCode ?: '???';
818
819        return $this->getAllCountries()[$threeLetterCode];
820    }
821}
822