-
-
Save henrik/1688572 to your computer and use it in GitHub Desktop.
# Note: VAT identification numbers for Greece use "EL", not "GR". | |
COUNTRY_CODES_EU = %w[ | |
AT BE BG CY CZ DK EE FI FR DE GR HU IE IT | |
LV LT LU MT NL PL PT RO SK SI ES SE GB | |
] |
At least for the GDPR you should also consider "VA", "SM", "MT", "MK", "MC", "FO"
In case anyone would ever need them (as I just needed them) (in CSV format though, sorry):
- A list of European countries (within and outside the EU) with their alpha-2 codes (Kosovo is only partially recognised, its country code is temporarily set to XK):
Albania,AL
Andorra,AD
Austria,AT
Azerbaijan,AZ
Belarus,BY
Belgium,BE
Bosnia and Herzegovina,BA
Bulgaria,BG
Croatia,HR
Cyprus,CY
Czech Republic,CZ
Denmark,DK
Estonia,EE
Finland,FI
France,FR
Georgia,GE
Germany,DE
Greece,GR
Hungary,HU
Iceland,IS
Ireland,IE
Italy,IT
Kazakhstan,KZ
Kosovo,XK
Latvia,LV
Liechtenstein,LI
Lithuania,LT
Luxembourg,LU
Macedonia,MK
Malta,MT
Moldova,MD
Monaco,MC
Montenegro,ME
Netherlands,NL
Norway,NO
Poland,PL
Portugal,PT
Romania,RO
Russia,RU
San Marino,SM
Serbia,RS
Slovakia,SK
Slovenia,SI
Spain,ES
Sweden,SE
Switzerland,CH
Turkey,TR
Ukraine,UA
United Kingdom,GB
Vatican City,VA
Has anyone got the complete list of European Union country codes? I'm trying to piece together the comments here but I'm getting a bit lost. This what I have so far.
EU 28:
AT, Austria
BE, Belgium
BG, Bulgaria
HR, Croatia
CY, Cyprus
CZ, Czech Republic
DK, Denmark
EE, Estonia
FI, Finland
FR, France
DE, Germany
GR, Greece
HU, Hungary
IE, Ireland, Republic of (EIRE)
IT, Italy
LV, Latvia
LT, Lithuania
LU, Luxembourg
MT, Malta
NL, Netherlands
PL, Poland
PT, Portugal
RO, Romania
SK, Slovakia
SI, Slovenia
ES, Spain
SE, Sweden
GB, United Kingdom (Great Britain)
Outermost Regions (OMR)
https://en.wikipedia.org/wiki/Special_member_state_territories_and_the_European_Union#Outermost_regions
GF, French Guiana
GP, Guadeloupe
MQ, Martinique
ME, Montenegro
YT, Mayotte
RE, Réunion
MF, Saint Martin
No Code, Azores
No Code, Canary Islands
No Code, Madeira
Special Cases: Part of EU
https://en.wikipedia.org/wiki/Special_member_state_territories_and_the_European_Union#Special_cases_in_Europe
GI, Gibraltar
AX, Åland Islands
No Code, Büsingen am Hochrhein
No Code, Campione d'Italia and Livigno
No Code, Ceuta and Melilla
No Code, UN Buffer Zone in Cyprus
No Code, Helgoland
No Code, Mount Athos
Overseas Countries and Territories (OCT)
https://en.wikipedia.org/wiki/Special_member_state_territories_and_the_European_Union#Overseas_countries_and_territories
PM, Saint Pierre and Miquelon
GL, Greenland
BL, Saint Bartelemey
SX, Sint Maarten
AW, Aruba
CW, Curacao
WF, Wallis and Futuna
PF, French Polynesia
NC, New Caledonia
TF, French Southern Territories
AI, Anguilla
BM, Bermuda
IO, British Indian Ocean Territory
VG, Virgin Islands, British
KY, Cayman Islands
FK, Falkland Islands (Malvinas)
MS, Montserrat
PN, Pitcairn
SH, Saint Helena
GS, South Georgia and the South Sandwich Islands
TC, Turks and Caicos Islands
Microstates
https://en.wikipedia.org/wiki/Microstates_and_the_European_Union
AD, Andorra
LI, Liechtenstein
MC, Monaco
SM, San Marino
VA, Vatican City
Other (Not sure how these fit in)
JE, Jersey
GG, Guernsey
GI, Gibraltar
Here's a JS parsable array; and some snippet to convert it into a countries = [{code, name}]
collection.
const list = [
// EU 28:
"AT", "Austria",
"BE", "Belgium",
"BG", "Bulgaria",
"HR", "Croatia",
"CY", "Cyprus",
"CZ", "Czech Republic",
"DK", "Denmark",
"EE", "Estonia",
"FI", "Finland",
"FR", "France",
"DE", "Germany",
"GR", "Greece",
"HU", "Hungary",
"IE", "Ireland, Republic of (EIRE)",
"IT", "Italy",
"LV", "Latvia",
"LT", "Lithuania",
"LU", "Luxembourg",
"MT", "Malta",
"NL", "Netherlands",
"PL", "Poland",
"PT", "Portugal",
"RO", "Romania",
"SK", "Slovakia",
"SI", "Slovenia",
"ES", "Spain",
"SE", "Sweden",
"GB", "United Kingdom (Great Britain)",
// Outermost Regions (OMR)
// https://en.wikipedia.org/wiki/Special_member_state_territories_and_the_European_Union#Outermost_regions
"GF", "French Guiana",
"GP", "Guadeloupe",
"MQ", "Martinique",
"ME", "Montenegro",
"YT", "Mayotte",
"RE", "Réunion",
"MF", "Saint Martin",
// No Code, Azores
// No Code, Canary Islands
// No Code, Madeira
// Special Cases: Part of EU
// https://en.wikipedia.org/wiki/Special_member_state_territories_and_the_European_Union#Special_cases_in_Europe
"GI", "Gibraltar",
"AX", "Åland Islands",
// No Code, Büsingen am Hochrhein
// No Code, Campione d'Italia and Livigno
// No Code, Ceuta and Melilla
// No Code, UN Buffer Zone in Cyprus
// No Code, Helgoland
// No Code, Mount Athos
// Overseas Countries and Territories (OCT)
// https://en.wikipedia.org/wiki/Special_member_state_territories_and_the_European_Union#Overseas_countries_and_territories
"PM", "Saint Pierre and Miquelon",
"GL", "Greenland",
"BL", "Saint Bartelemey",
"SX", "Sint Maarten",
"AW", "Aruba",
"CW", "Curacao",
"WF", "Wallis and Futuna",
"PF", "French Polynesia",
"NC", "New Caledonia",
"TF", "French Southern Territories",
"AI", "Anguilla",
"BM", "Bermuda",
"IO", "British Indian Ocean Territory",
"VG", "Virgin Islands, British",
"KY", "Cayman Islands",
"FK", "Falkland Islands (Malvinas)",
"MS", "Montserrat",
"PN", "Pitcairn",
"SH", "Saint Helena",
"GS", "South Georgia and the South Sandwich Islands",
"TC", "Turks and Caicos Islands",
// Microstates
// https://en.wikipedia.org/wiki/Microstates_and_the_European_Union
"AD", "Andorra",
"LI", "Liechtenstein",
"MC", "Monaco",
"SM", "San Marino",
"VA", "Vatican City",
// Other (Not sure how these fit in)
"JE", "Jersey",
"GG", "Guernsey",
"GI", "Gibraltar"
]
const countries = []
for (var i = 0; i < list.length; i +=2) countries.push({ code: list[i], name: list[i+1]})
Thanks!
This was super helpful, thanks!
Apparently, Switzerland is not subject to GDPR, as it is not an EEA state (https://planit.legal/blog/en/the-applicability-of-the-gdpr-within-the-eea/).
Same information added by @glesperance in json format:
[
{"isoCode": "AT", "name": "Austria"},
{"isoCode": "BE", "name": "Belgium"},
{"isoCode": "BG", "name": "Bulgaria"},
{"isoCode": "HR", "name": "Croatia"},
{"isoCode": "CY", "name": "Cyprus"},
{"isoCode": "CZ", "name": "Czech Republic"},
{"isoCode": "DK", "name": "Denmark"},
{"isoCode": "EE", "name": "Estonia"},
{"isoCode": "FI", "name": "Finland"},
{"isoCode": "FR", "name": "France"},
{"isoCode": "DE", "name": "Germany"},
{"isoCode": "GR", "name": "Greece"},
{"isoCode": "HU", "name": "Hungary"},
{"isoCode": "IE", "name": "Ireland, Republic of (EIRE)"},
{"isoCode": "IT", "name": "Italy"},
{"isoCode": "LV", "name": "Latvia"},
{"isoCode": "LT", "name": "Lithuania"},
{"isoCode": "LU", "name": "Luxembourg"},
{"isoCode": "MT", "name": "Malta"},
{"isoCode": "NL", "name": "Netherlands"},
{"isoCode": "PL", "name": "Poland"},
{"isoCode": "PT", "name": "Portugal"},
{"isoCode": "RO", "name": "Romania"},
{"isoCode": "SK", "name": "Slovakia"},
{"isoCode": "SI", "name": "Slovenia"},
{"isoCode": "ES", "name": "Spain"},
{"isoCode": "SE", "name": "Sweden"},
{"isoCode": "GB", "name": "United Kingdom (Great Britain)"},
{"isoCode": "GF", "name": "French Guiana"},
{"isoCode": "GP", "name": "Guadeloupe"},
{"isoCode": "MQ", "name": "Martinique"},
{"isoCode": "ME", "name": "Montenegro"},
{"isoCode": "YT", "name": "Mayotte"},
{"isoCode": "RE", "name": "Réunion"},
{"isoCode": "MF", "name": "Saint Martin"},
{"isoCode": "GI", "name": "Gibraltar"},
{"isoCode": "AX", "name": "Åland Islands"},
{"isoCode": "PM", "name": "Saint Pierre and Miquelon"},
{"isoCode": "GL", "name": "Greenland"},
{"isoCode": "BL", "name": "Saint Bartelemey"},
{"isoCode": "SX", "name": "Sint Maarten"},
{"isoCode": "AW", "name": "Aruba"},
{"isoCode": "CW", "name": "Curacao"},
{"isoCode": "WF", "name": "Wallis and Futuna"},
{"isoCode": "PF", "name": "French Polynesia"},
{"isoCode": "NC", "name": "New Caledonia"},
{"isoCode": "TF", "name": "French Southern Territories"},
{"isoCode": "AI", "name": "Anguilla"},
{"isoCode": "BM", "name": "Bermuda"},
{"isoCode": "IO", "name": "British Indian Ocean Territory"},
{"isoCode": "VG", "name": "Virgin Islands, British"},
{"isoCode": "KY", "name": "Cayman Islands"},
{"isoCode": "FK", "name": "Falkland Islands (Malvinas)"},
{"isoCode": "MS", "name": "Montserrat"},
{"isoCode": "PN", "name": "Pitcairn"},
{"isoCode": "SH", "name": "Saint Helena"},
{"isoCode": "GS", "name": "South Georgia and the South Sandwich Islands"},
{"isoCode": "TC", "name": "Turks and Caicos Islands"},
{"isoCode": "AD", "name": "Andorra"},
{"isoCode": "LI", "name": "Liechtenstein"},
{"isoCode": "MC", "name": "Monaco"},
{"isoCode": "SM", "name": "San Marino"},
{"isoCode": "VA", "name": "Vatican City"},
{"isoCode": "JE", "name": "Jersey"},
{"isoCode": "GG", "name": "Guernsey"},
{"isoCode": "GI", "name": "Gibraltar"}
]
Here's the same as @nicocavello as an object, for quick lookups by country code:
{
"AT": {"isoCode": "AT", "name": "Austria"},
"BE": {"isoCode": "BE", "name": "Belgium"},
"BG": {"isoCode": "BG", "name": "Bulgaria"},
"HR": {"isoCode": "HR", "name": "Croatia"},
"CY": {"isoCode": "CY", "name": "Cyprus"},
"CZ": {"isoCode": "CZ", "name": "Czech Republic"},
"DK": {"isoCode": "DK", "name": "Denmark"},
"EE": {"isoCode": "EE", "name": "Estonia"},
"FI": {"isoCode": "FI", "name": "Finland"},
"FR": {"isoCode": "FR", "name": "France"},
"DE": {"isoCode": "DE", "name": "Germany"},
"GR": {"isoCode": "GR", "name": "Greece"},
"HU": {"isoCode": "HU", "name": "Hungary"},
"IE": {"isoCode": "IE", "name": "Ireland, Republic of (EIRE)"},
"IT": {"isoCode": "IT", "name": "Italy"},
"LV": {"isoCode": "LV", "name": "Latvia"},
"LT": {"isoCode": "LT", "name": "Lithuania"},
"LU": {"isoCode": "LU", "name": "Luxembourg"},
"MT": {"isoCode": "MT", "name": "Malta"},
"NL": {"isoCode": "NL", "name": "Netherlands"},
"PL": {"isoCode": "PL", "name": "Poland"},
"PT": {"isoCode": "PT", "name": "Portugal"},
"RO": {"isoCode": "RO", "name": "Romania"},
"SK": {"isoCode": "SK", "name": "Slovakia"},
"SI": {"isoCode": "SI", "name": "Slovenia"},
"ES": {"isoCode": "ES", "name": "Spain"},
"SE": {"isoCode": "SE", "name": "Sweden"},
"GB": {"isoCode": "GB", "name": "United Kingdom (Great Britain)"},
"GF": {"isoCode": "GF", "name": "French Guiana"},
"GP": {"isoCode": "GP", "name": "Guadeloupe"},
"MQ": {"isoCode": "MQ", "name": "Martinique"},
"ME": {"isoCode": "ME", "name": "Montenegro"},
"YT": {"isoCode": "YT", "name": "Mayotte"},
"RE": {"isoCode": "RE", "name": "Réunion"},
"MF": {"isoCode": "MF", "name": "Saint Martin"},
"GI": {"isoCode": "GI", "name": "Gibraltar"},
"AX": {"isoCode": "AX", "name": "Åland Islands"},
"PM": {"isoCode": "PM", "name": "Saint Pierre and Miquelon"},
"GL": {"isoCode": "GL", "name": "Greenland"},
"BL": {"isoCode": "BL", "name": "Saint Bartelemey"},
"SX": {"isoCode": "SX", "name": "Sint Maarten"},
"AW": {"isoCode": "AW", "name": "Aruba"},
"CW": {"isoCode": "CW", "name": "Curacao"},
"WF": {"isoCode": "WF", "name": "Wallis and Futuna"},
"PF": {"isoCode": "PF", "name": "French Polynesia"},
"NC": {"isoCode": "NC", "name": "New Caledonia"},
"TF": {"isoCode": "TF", "name": "French Southern Territories"},
"AI": {"isoCode": "AI", "name": "Anguilla"},
"BM": {"isoCode": "BM", "name": "Bermuda"},
"IO": {"isoCode": "IO", "name": "British Indian Ocean Territory"},
"VG": {"isoCode": "VG", "name": "Virgin Islands, British"},
"KY": {"isoCode": "KY", "name": "Cayman Islands"},
"FK": {"isoCode": "FK", "name": "Falkland Islands (Malvinas)"},
"MS": {"isoCode": "MS", "name": "Montserrat"},
"PN": {"isoCode": "PN", "name": "Pitcairn"},
"SH": {"isoCode": "SH", "name": "Saint Helena"},
"GS": {"isoCode": "GS", "name": "South Georgia and the South Sandwich Islands"},
"TC": {"isoCode": "TC", "name": "Turks and Caicos Islands"},
"AD": {"isoCode": "AD", "name": "Andorra"},
"LI": {"isoCode": "LI", "name": "Liechtenstein"},
"MC": {"isoCode": "MC", "name": "Monaco"},
"SM": {"isoCode": "SM", "name": "San Marino"},
"VA": {"isoCode": "VA", "name": "Vatican City"},
"JE": {"isoCode": "JE", "name": "Jersey"},
"GG": {"isoCode": "GG", "name": "Guernsey"},
"GI": {"isoCode": "GI", "name": "Gibraltar"}
}
For those omitting Switzerland, that's a business decision you may wish to discuss with your lawyers. Be aware that Switzerland is generally pretty in sync with the rest of Europe in things like data privacy and they are expected to come out with their own version of the GDPR in the near future. For the company I work for, we have decided to consider Switzerland as a GDPR country because there is not a compelling reason not to. Better safe than sorry is our thinking.
This is the list I'm using (the list above with Switzerland added then formatted as a compact javascript array):
const EUCountries = [ 'AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'GB', 'GF', 'GP', 'MQ', 'ME', 'YT', 'RE', 'MF', 'GI', 'AX', 'PM', 'GL', 'BL', 'SX', 'AW', 'CW', 'WF', 'PF', 'NC', 'TF', 'AI', 'BM', 'IO', 'VG', 'KY', 'FK', 'MS', 'PN', 'SH', 'GS', 'TC', 'AD', 'LI', 'MC', 'SM', 'VA', 'JE', 'GG', 'GI', 'CH', ];
Is there a reason that no one's including the Isle of Man in these lists? There may be something that I'm missing, but I'd imagine that if we're including Jersey and Guernsey, we should also be including the Isle of Man (code IM
).
Not sure if the OP is being updated, but if so it should have 'HR' (Croatia) before Cyprus
Here's a list in javascript array :
const europeArray = ['AL','AD','AT','AZ','BY','BE','BA','BG','HR','CY','CZ','DK','EE','FI','FR','GE','DE','GR','HU','IS','IE', 'IT','KZ','XK','LV','LI','LT','LU','MK','MT','MD','MC','ME','NL','NO','PL','PT','RO','RU','SM','RS','SK', 'SI','ES','SE','CH','TR','UA','GB','VA' ];
This is great! Here's a list that can be used with AMP:
["al","ad","at","az","by","be","ba","bg","hr","cy","cz","dk","ee","fi","fr","ge","de","gr","hu","is","ie", "it","kz","xk","lv","li","lt","lu","mk","mt","md","mc","me","nl","no","pl","pt","ro","ru","sm","rs","sk", "si","es","se","ch","tr","ua","gb","va"]
-
Why isn't this discussion just referenceing ISO-3166 alpha-2? Is the idea that you want to be able to tell from the code whether a jurisdiction is "in" the EU?, and where, for example, "Ceuta and Melilla" == "EA"
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Current_codes -
Would including "EU" blow people's minds? I ask because I'd be using this list to identify "jurisdiction of incorporation" and the EU now allows pan-European incorporation. See:
https://en.wikipedia.org/wiki/List_of_legal_entity_types_by_country#European_Economic_Area_(including_the_European_Union)
@ArminCoder that list includes non EU countries as well, which is not what the original gist is about.
@AdamGerthel , yeah I taught it was about Europe countries, not just the ones in European Union. The array I provided are all the countries that are in Europe.
Here it is the EU country on a JSON with the ISO 3166 1 alpha2
{ "Austria": "AT", "Belgium": "BE", "Bulgaria": "BG", "Croatia": "HR", "Cyprus": "CY", "Czech Republic": "CZ", "Denmark": "DK", "Estonia": "EE", "Finland":"FI", "France": "FR", "Germany": "DE", "Greece": "GR", "Hungary": "HU", "Ireland": "IE", "Italy": "IT", "Latvia": "LV", "Lithuania": "LT", "Luxembourg": "LU", "Malta": "MT", "Netherlands": "NL", "Poland": "PL", "Portugal": "PT", "Romania": "RO", "San Marino": "SM", "Slovakia": "SK", "Slovenia": "SI", "Spain": "ES", "Sweden": "SE", "United Kingdom": "GB", "Vatican City": "VA" }
@glesperance's list looked most complete, so here it is as a PHP array:
private const EUROPEAN_COUNTRY_CODES = [
// -----[ EU 28 ]-----
"AT", // Austria
"BE", // Belgium
"BG", // Bulgaria
"HR", // Croatia
"CY", // Cyprus
"CZ", // Czech Republic
"DK", // Denmark
"EE", // Estonia
"FI", // Finland
"FR", // France
"DE", // Germany
"GR", // Greece
"HU", // Hungary
"IE", // Ireland, Republic of (EIRE)
"IT", // Italy
"LV", // Latvia
"LT", // Lithuania
"LU", // Luxembourg
"MT", // Malta
"NL", // Netherlands
"PL", // Poland
"PT", // Portugal
"RO", // Romania
"SK", // Slovakia
"SI", // Slovenia
"ES", // Spain
"SE", // Sweden
"GB", // United Kingdom (Great Britain)
// -----[ Outermost Regions (OMR) ]------
"GF", // French Guiana
"GP", // Guadeloupe
"MQ", // Martinique
"ME", // Montenegro
"YT", // Mayotte
"RE", // Réunion
"MF", // Saint Martin
// -----[ Special Cases: Part of EU ]-----
"GI", // Gibraltar
"AX", // Åland Islands
// -----[ Overseas Countries and Territories (OCT) ]-----
"PM", // Saint Pierre and Miquelon
"GL", // Greenland
"BL", // Saint Bartelemey
"SX", // Sint Maarten
"AW", // Aruba
"CW", // Curacao
"WF", // Wallis and Futuna
"PF", // French Polynesia
"NC", // New Caledonia
"TF", // French Southern Territories
"AI", // Anguilla
"BM", // Bermuda
"IO", // British Indian Ocean Territory
"VG", // Virgin Islands, British
"KY", // Cayman Islands
"FK", // Falkland Islands (Malvinas)
"MS", // Montserrat
"PN", // Pitcairn
"SH", // Saint Helena
"GS", // South Georgia and the South Sandwich Islands
"TC", // Turks and Caicos Islands
// -----[ Microstates ]-----
"AD", // Andorra
"LI", // Liechtenstein
"MC", // Monaco
"SM", // San Marino
"VA", // Vatican City
// -----[ Other ]-----
"JE", // Jersey
"GG", // Guernsey
];
AL
AD
AT
AZ
BY
BE
BA
BG
HR
CY
CZ
DK
EE
FI
FR
GE
DE
GR
HU
IS
IE
IT
KZ
XK
LV
LI
LT
LU
MK
MT
MD
MC
ME
NL
NO
PL
PT
RO
RU
SM
RS
SK
SI
ES
SE
CH
TR
UA
GB
VA
Based on hussainrmdxb's post, here's one for a shortcode for example:
"AT,BE,HR,BG,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IE,IT,LV,LT,LU,MT,NL,PL,PT,RO,SK,SI,ES,SE,GB"
class G8Countries(Countries):
# fmt: off
only = [
"AT", "BE", "BG", "CY", "CZ",
"DE", "DK", "EE", "ES", "FI",
"FR", "GR", "HR", "HU", "IE",
"IT", "LT", "LU", "LV", "MT",
"NL", "PL", "PT", "RO", "SE",
"SI", "SK"
]
# fmt: on
Lista de paises de la unión europea. Espero que les sirva.
@glesperance's list looked most complete, so here it is as a PHP array:
private const EUROPEAN_COUNTRY_CODES = [ // -----[ EU 28 ]----- "AT", // Austria "BE", // Belgium "BG", // Bulgaria "HR", // Croatia "CY", // Cyprus "CZ", // Czech Republic "DK", // Denmark "EE", // Estonia "FI", // Finland "FR", // France "DE", // Germany "GR", // Greece "HU", // Hungary "IE", // Ireland, Republic of (EIRE) "IT", // Italy "LV", // Latvia "LT", // Lithuania "LU", // Luxembourg "MT", // Malta "NL", // Netherlands "PL", // Poland "PT", // Portugal "RO", // Romania "SK", // Slovakia "SI", // Slovenia "ES", // Spain "SE", // Sweden "GB", // United Kingdom (Great Britain) // -----[ Outermost Regions (OMR) ]------ "GF", // French Guiana "GP", // Guadeloupe "MQ", // Martinique "ME", // Montenegro "YT", // Mayotte "RE", // Réunion "MF", // Saint Martin // -----[ Special Cases: Part of EU ]----- "GI", // Gibraltar "AX", // Åland Islands // -----[ Overseas Countries and Territories (OCT) ]----- "PM", // Saint Pierre and Miquelon "GL", // Greenland "BL", // Saint Bartelemey "SX", // Sint Maarten "AW", // Aruba "CW", // Curacao "WF", // Wallis and Futuna "PF", // French Polynesia "NC", // New Caledonia "TF", // French Southern Territories "AI", // Anguilla "BM", // Bermuda "IO", // British Indian Ocean Territory "VG", // Virgin Islands, British "KY", // Cayman Islands "FK", // Falkland Islands (Malvinas) "MS", // Montserrat "PN", // Pitcairn "SH", // Saint Helena "GS", // South Georgia and the South Sandwich Islands "TC", // Turks and Caicos Islands // -----[ Microstates ]----- "AD", // Andorra "LI", // Liechtenstein "MC", // Monaco "SM", // San Marino "VA", // Vatican City // -----[ Other ]----- "JE", // Jersey "GG", // Guernsey ];
Hi guys,
thanks @henrik for this and everyone that contribute.
Same list from @qmcree but in a yaml list format (with no indent):
- FI
- FR
- DE
- GR
- HU
- IE
- IT
- LV
- LT
- LU
- MT
- NL
- PL
- PT
- RO
- SK
- SI
- ES
- SE
- GB
- GF
- GP
- MQ
- ME
- YT
- RE
- MF
- GI
- AX
- PM
- GL
- BL
- SX
- AW
- CW
- WF
- PF
- NC
- TF
- AI
- BM
- IO
- VG
- KY
- FK
- MS
- PN
- SH
- GS
- TC
- AD
- LI
- MC
- SM
- VA
- JE
- GG
A drop-down in Liquid
{%- capture cntriesList -%}
Austria:AT,Belgium:BE,Bulgaria:BG,Croatia:HR,Cyprus:CY,Czech Republic:CZ,Denmark:DK,Estonia:EE,Finland:FI,France:FR,Germany:DE,Greece:GR,Hungary:HU,Ireland:IE,Italy:IT,Latvia:LV,Lithuania:LT,Luxembourg:LU,Malta:MT,Netherlands:NL,Poland:PL,Portugal:PT,Romania:RO,San Marino:SM,Slovakia:SK,Slovenia:SI,Spain:ES,Sweden:SE,United Kingdom:GB,Vatican City:VA
{%- endcapture -%}
{% assign countries = cntriesList | split: ',' %}
-- select html tag open --
{% for country in countries %}
{% assign cntryName = country | split: ':' | first %}
{% assign cntryCode = country | split: ':' | last %}
-- option name="{{ cntryCode }}">{{ cntryName }} --
{% endfor %}
-- select html tag close --
For those getting here are writing JavaScript/TypeScript. Leverage Set
for validating EU member nations by country code, eg:
const EU = new Set([
'AL',
'AD',
'AT',
'AZ',
'BY',
'BE',
'BA',
'BG',
'HR',
'CY',
'CZ',
'DK',
'EE',
'FI',
'FR',
'GE',
'DE',
'GR',
'HU',
'IS',
'IE',
'IT',
'KZ',
'XK',
'LV',
'LI',
'LT',
'LU',
'MK',
'MT',
'MD',
'MC',
'ME',
'NL',
'NO',
'PL',
'PT',
'RO',
'RU',
'SM',
'RS',
'SK',
'SI',
'ES',
'SE',
'CH',
'TR',
'UA',
'GB',
'VA',
])
const isEU = (code: string): boolean => EU.has(code)
This is the cleanest way to do this. I have seen developers reach for iteration for matches, try not to do this, as a pre-populated Set will suffice nicely and comes at little cost. For some additional helper utils (which might of use to you all) we open sourced a couple little modules, for dealing with i18n aspects that somewhat pertain to this nexus:
Country code to currency code mappings:
Country code to country name (English) mappings:
Hope it helps! Happy coding.
@bigghe @plpepin @panoply the UK (GB
) is no longer in the EU, sadly. So your lists are not correct.
The list of EU countries is here courtesy of Eurostat, the "statistical office of the European Union"
Also, note that the European Commission does not always use ISO 3166-1 alpha-2 codes, including at the Eurostat link above. As explained on Wikipedia:
The European Commission generally uses ISO 3166-1 alpha-2 codes with two exceptions: EL (not GR) is used to represent Greece, and UK (not GB) is used to represent the United Kingdom.[10] This notwithstanding, the Official Journal of the European Communities specified that GR and GB be used to represent Greece and United Kingdom respectively.[11] For VAT administration purposes, the European Commission uses EL and GB for Greece and the United Kingdom respectively.
So, depending on your use case, you may need to amend and extend the list of standard ISO 3166-1 alpha-2 codes
@bradydan is it official in UK already? I will have peek on the E.U governing sites. I am aware of the EL reference for Greece (I am Greek) however the vast majority of services feed GR when they are US based, might be worth adding EL in any sense. Wikipedia cannot be trusted nowadays, I will look on the gov counterparts and amend where necessary once I can confirm. Thanks for taking the time to leave your comment fam.
@bradydan The UK adopted GDPR into the law when they left the EU.
Following is for GDPR (EU countries and EFTA States):
PHP: