AJM
AJM

Reputation: 32500

ASP.NET Resource File Globalization and Localization Per Region

I am developing a website which needs to support multiple langauges.

I know that I can a seperate set of resource files for each culture and use that to manage the different languages e.g. when a user selects French set the UiCulture to be french and ASP.NET will pick up on the french resource files.

My problem is that I may have to support French for a Canadian version of the site and french for a European version of the site. The text will be a bit different as the Canadian market is different from the french one.

Is there a way I can support two copies of "French" resource files - one for Canada and one from France using the UiCulture described above?

Upvotes: 1

Views: 1126

Answers (2)

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

For Canadian french, there is culture settings available specifically for that, fr-CA. You just need to set that.

enter image description here

Upvotes: 3

Paweł Dyda
Paweł Dyda

Reputation: 18662

To add to what Muhammad said, what you need is to create two resource files named for example Resources.fr.resx and Resources.fr-CA.resx. Also you need to actually detect uiCulture by setting it to "auto".

That's it. You might think of adding the third one (Resources.fr-FR.resx) that would be the copy of generic French resource file but actually that is not necessary.

BTW. Please mind that user may have set just "FR" in his/her web browser. In that case wherever he/she is, default French would be shown. I don't think this is really big deal but you might need to actually document this (how to set Accept-Language appropriately depending on the browser).

Upvotes: 2

Related Questions