Question

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.

Was it helpful?

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.

OTHER TIPS

It can do languages as well; with resx files. Check around for a few tutorials; it's quite beautiful.

-- Edit: Tried to find some for you, best I can come up with is: http://msdn.microsoft.com/en-us/goglobal/bb688096.aspx, probably someone else can provide more specific links.

A very quick overview is that you can add various resx files (.es-ES, .es-CO [if that's the one for colombia) and then bind the entries in those files to controls (or use them just as global variables for various purposes). In this way you have a label like:

(Not exactly that, but something like that, please correct me if I'm slightly wrong) and it will get the appropriate text for whatever language the browser that the user is using has requested (you need to make a slight change in the web.config for this info to get passed in though). It should all be layed out for you in the link I've provided.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top