Where can I find a list of language + region codes?

UnicodeInternationalizationIsoRegion

Unicode Problem Overview


I have googled (well, DuckDuckGo'ed, actually) till I'm blue in the face, but cannot find a list of language codes of the type en-GB or fr-CA anywhere.

There are excellent resources about the components, in particular the W3C I18n page, but I was hoping for a simple alphabetical listing, fairly canonical if possible (something like this one). Cannot find.

Can anyone point me in the right direction? Many thanks!

Unicode Solutions


Solution 1 - Unicode

There are several language code systems and several region code systems, as well as their combinations. As you refer to a W3C page, I presume that you are referring to the system defined in BCP 47. That system is orthogonal in the sense that codes like en-GB and fr-CA simply combine a language code and a region code. This means a very large number of possible combinations, most of which make little sense, like ab-AX, which means Abkhaz as spoken in Åland (I don’t think anyone, still less any community, speaks Abkhaz there, though it is theoretically possible of course).

So any list of language-region combinations would be just a pragmatic list of combinations that are important in some sense, or supported by some software in some special sense.

The specifications that you have found define the general principles and also the authoritative sources on different “subtags” (like primary language code and region code). For the most important parts, the official registration authority maintains the three- and two-letter ISO 639 codes for languages, and the ISO site contains the two-letter ISO 3166 codes for regions. The lists are quite readable, and I see no reason to consider using other than these primary resources, especially regarding possible changes.

Solution 2 - Unicode

There are 2 components in play here :

  1. The language tag which is generally defined by ISO 639-1 alpha-2
  2. The region tag which is generally defined by ISO 3166-1 alpha-2

You can mix and match languages and regions in whichever combination makes sense to you so there is no list of all possibilities.

BTW, you're effectively using a BCP47 tag, which defines the standards for each locale segment.

Solution 3 - Unicode

Unicode maintains such a list : http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/index.html Even better, you can have it in an XML format (ideal to parse the list) and with also the usual writing systems used by each language : http://unicode.org/repos/cldr/trunk/common/supplemental/supplementalData.xml (look in /LanguageData)

Solution 4 - Unicode

One solution would be to parse this list, it would give you all of the keys needed to create the list you are looking for.

http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry

Solution 5 - Unicode

Solution 6 - Unicode

This can be found at Unicode's Common Locale Data Repository. Specifically, a JSON file of this information is available in their cldr-json repo

Solution 7 - Unicode

We have a working list that we work off of for language code/language name referencing for Localizejs. Hope that helps

https://stackoverflow.com/questions/3217492/list-of-language-codes-in-yaml-or-json/28902032#28902032

Solution 8 - Unicode

List of primary language subtags, with common region subtags for each language (based on population of language speakers in each region):

https://www.unicode.org/cldr/charts/latest/supplemental/language_territory_information.html

For example, for English:

  • en-US (320,000,000)
  • en-IN (250,000,000)
  • en-NG (110,000,000)
  • en-PK (100,000,000)
  • en-PH (68,000,000)
  • en-GB (64,000,000)

(Jukka K. Korpela and tigrish give good explanations for why any combination of language + region code is valid, but it might be helpful to have a list of codes most likely to be in actual use. s-f's link has such useful information sorted by region, so it might also be helpful to have this information sorted by language.)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDɑvïdView Question on Stackoverflow
Solution 1 - UnicodeJukka K. KorpelaView Answer on Stackoverflow
Solution 2 - UnicodetigrishView Answer on Stackoverflow
Solution 3 - UnicodeThomas CORDONNIERView Answer on Stackoverflow
Solution 4 - UnicodeAdamView Answer on Stackoverflow
Solution 5 - Unicodes-fView Answer on Stackoverflow
Solution 6 - UnicodeBriceView Answer on Stackoverflow
Solution 7 - UnicodejohnnywuView Answer on Stackoverflow
Solution 8 - UnicodeChris TollefsonView Answer on Stackoverflow