Skip to content

Commit b71c8c8

Browse files
committed
Fix the is_3166_1 dictionary according to the ISO norm. Add aliases
1 parent 09f3d3e commit b71c8c8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

app/utils/countrycodes.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Default country code.
22
default_code = "XX"
33

4-
# Mapping of country names to alpha-2 codes.
4+
# Mapping of country names to alpha-2 codes according to
5+
# https://en.wikipedia.org/wiki/ISO_3166-1.
6+
# As a reference see also https://github.com/TakahikoKawasaki/nv-i18n (in Java)
57
is_3166_1 = {
68
"Afghanistan" : "AF",
79
"Åland Islands" : "AX",
@@ -122,8 +124,7 @@
122124
"Kiribati" : "KI",
123125
"Korea, Democratic People's Republic of" : "KP",
124126
"Korea, Republic of" : "KR",
125-
# Introducing Kosovo may be controversial. I guess we need to bite the bullet.
126-
"Kosovo" : "XK",
127+
"Kosovo, Republic of" : "XK",
127128
"Kuwait" : "KW",
128129
"Kyrgyzstan" : "KG",
129130
"Lao People's Democratic Republic" : "LA",
@@ -218,7 +219,7 @@
218219
"Sudan" : "SD",
219220
"Suriname" : "SR",
220221
"Svalbard and Jan Mayen" : "SJ",
221-
"Swaziland" : "SZ",
222+
"Eswatini" : "SZ", # previous name "Swaziland"
222223
"Sweden" : "SE",
223224
"Switzerland" : "CH",
224225
"Syrian Arab Republic" : "SY",
@@ -340,6 +341,8 @@
340341
"Deutschland" : "Germany",
341342
"The Bahamas" : "Bahamas",
342343
"The Gambia" : "Gambia",
344+
"Kosovo" : "Kosovo, Republic of",
345+
"Swaziland" : "Eswatini",
343346
# "Others" has no mapping, i.e. the default val is used
344347
# "Cruise Ship" has no mapping, i.e. the default val is used
345348
}

0 commit comments

Comments
 (0)