views:

471

answers:

6

ISO 3166 has a list of 2 character country codes such as US, UK, FR.

A shopping cart I've used has both these codes and also the culture codes such as en-US or en-UK.

For a separate project I thought that the longer code is more useful because it at the very least tells me the language used by that country. But i cant seem to find an accurate list of them.

Should I use these 'culture codes' for tracking countries or just stick to the 2 character ISO 3166 names? What might be the catches of using either ?

I'm not sure why a shoppin cart that is locked to the english language would even care about en-US vs just US. Any insight?

Edit: Also where can I get a culture code list? Is this an ISO standard? Is it correct to assume that the country portion of a culture code is an ISO 3166 country code?

A: 

If you're just tracking countries of your users, I would stick to the country codes. Culture is more for tracking things such as decimal separators (. vs ,).

nasufara
+4  A: 

Country codes are used to identify countries. Simply countries.

Culture codes serve to identify cultures to refer to their specifics, like decimal signs, date separator, currencies etc. Here you are not directly interested in a country but in a particular culture.

If you need to simply track countries then stick with ISO 3166 codes. It is a good and simple standard. If you do something like IP-to-country determination, then most services will only give you countries but not specific user cultures.

You really need to tell us what usage scenario you have in mind, then it will be possible to advice better.

Developer Art
A: 

I'm not answering your main question, but the ISO 3166 country code for the United Kingdom is GB, not UK (which is “exceptionally reserved”, though), although the latter is the DNS TLD code for the United Kingdom (because of a personal error of Jon Postel, an urban legend has it). For that reason, the language tag for “British English” is en-GB, not en-UK.

That being said, it's not quite clear what you need those codes for.

Arthur Reutenauer
A: 

As a few have pointed out, one indicates only the country (US), while the other indicates both language and country (en-US). I just wanted to add that the whole point of having language/country is because this relationship is not one-to-one. You can have the same language spoken in different countries (pt-BR vs pt-PT), and you can have several languages spoken in the same country (fr-CA and en-CA).

If all you need to track is the user's country, by all means, use the ISO codes. If you need to track cultural and regional settings, then I'd use the full culture code.

Lucas
A: 

List of Culture Codes : "A comprehensive list of culture codes used for localising and in conjunction with the CultureInfo class."

Rubens Farias
A: 

As others have said, if you want to record users' geographic location, then use the ISO country codes.

If you also want to track users' culture for presentation purposes (e.g. translations, date and number formatting), then you should store both. Nothing should prevent a user living abroad from using their native language and culture settings. For example a French-speaking Canadian living in the US might have the US country code but want the fr-CA culture code.

Annabelle