Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix the is_3166_1 dictionary according to the ISO norm. Add aliases
  • Loading branch information
BostX committed Mar 19, 2020
commit b71c8c88fb56cdb980abedcd13c5ecbf163ecad3
11 changes: 7 additions & 4 deletions app/utils/countrycodes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Default country code.
default_code = "XX"

# Mapping of country names to alpha-2 codes.
# Mapping of country names to alpha-2 codes according to
# https://en.wikipedia.org/wiki/ISO_3166-1.
# As a reference see also https://github.com/TakahikoKawasaki/nv-i18n (in Java)
is_3166_1 = {
"Afghanistan" : "AF",
"Åland Islands" : "AX",
Expand Down Expand Up @@ -122,8 +124,7 @@
"Kiribati" : "KI",
"Korea, Democratic People's Republic of" : "KP",
"Korea, Republic of" : "KR",
# Introducing Kosovo may be controversial. I guess we need to bite the bullet.
"Kosovo" : "XK",
"Kosovo, Republic of" : "XK",
"Kuwait" : "KW",
"Kyrgyzstan" : "KG",
"Lao People's Democratic Republic" : "LA",
Expand Down Expand Up @@ -218,7 +219,7 @@
"Sudan" : "SD",
"Suriname" : "SR",
"Svalbard and Jan Mayen" : "SJ",
"Swaziland" : "SZ",
"Eswatini" : "SZ", # previous name "Swaziland"
"Sweden" : "SE",
"Switzerland" : "CH",
"Syrian Arab Republic" : "SY",
Expand Down Expand Up @@ -340,6 +341,8 @@
"Deutschland" : "Germany",
"The Bahamas" : "Bahamas",
"The Gambia" : "Gambia",
"Kosovo" : "Kosovo, Republic of",
"Swaziland" : "Eswatini",
# "Others" has no mapping, i.e. the default val is used
# "Cruise Ship" has no mapping, i.e. the default val is used
}
Expand Down