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