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