Is en_UK an illegal locale? Is en_UK an illegal locale? php php

Is en_UK an illegal locale?


The correct country code is en_GB. Locales use ISO 3166-1 for country codes. The wikipedia writeup includes:

The codes are chosen, according to the ISO 3166/MA, "to reflect the significant, unique component of the country name in order to allow a visual association between country name and country code".[7] For this reason, common components of country names like "Republic", "Kingdom", "United", "Federal" or "Democratic" are normally not used for deriving the code elements. As a consequence, for example, the United Kingdom is officially assigned the alpha-2 code GB rather than UK, based on its official name "United Kingdom of Great Britain and Northern Ireland" (although UK is reserved on the request of the United Kingdom).


It is indeed a common (?) mistake. en_UK is wrong. The ISO country code for the UK is GB, making the language tag en_GB.


Imperfect implementations

Starting in 1985, ISO 3166-1 alpha-2 codes have been used in the Domain Name System as country code top-level domains (ccTLDs). The Internet Assigned Numbers Authority currently assigns the ccTLDs mostly following the alpha-2 codes, but with a few exceptions.[9] For example, the United Kingdom, whose alpha-2 code is GB, uses .uk instead of .gb as its ccTLD, as UK is currently exceptionally reserved in ISO 3166-1 on the request of the United Kingdom.

According to wikipedia http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2.

So apparently it's an old thing that has stuck or something like that.

EDIT: martin clayton found a better answer.