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