Search code examples
.netlocalizationglobalizationculturecultureinfo

Is 'culture' (eg. es-MX, en-US) meant to localize website -content- or -appearance-?


is the concept culture (as with .NET CultureInfo) to be used solely in localizing appearance of a website (language, date- and numberformatting etc.), or can it be used for localizing website content (location-bound newsmessages, contactdetails etc..)?

I need to build a website which supports both multiple-languages as localized content. I found that for instance there is no way to specify Dutch language in the United States ('nl-US'). I would like to specify both language and location in the url of the website. Does this imply I need to go like: www.domain.com/en-US/Netherlands/ ?

I hope my problem is clear.. Thanks in advance.


Solution

  • The culture codes are internationally recognized. The reason you see them as things like fr-FR for French (France) is that French is spoken in multiple countries and varies in those other places. This allows people who are translating to focus on the nuances of a particular dialect of a language.

    You can't just stuff any country code you want in there. You should track the country separately if you need it.

    Edit: Based on the comments, I want to include some more information.

    • If you need to figure out what country a user is actually in regardless of his or her locale, consider using IP to ISO-3166 country code mapping.

    • If you want to allow users to change their language regardless of their country but you still need to track where they're coming from, do the following.

      1. Detect their country using the ISO-3166 country mapping above.
      2. Default to their current locale (i.e., if they have their computer set to en-US, use English).
      3. Display a dropdown somewhere with all your supported locales and their languages and let them swap whenever they want.

    I think this covers all your questions/scenarios.