Miguel Domingos
Miguel Domingos

Reputation: 353

asp.net Localized Resources Explicit Localization not loading localized files

Resources for asp.net for different cultures load when a file with same name exists but with the suffix language-country like for example fr-FR for France.

Used this tutorial to create localized resources with explicit localization:

http://msdn.microsoft.com/en-us/library/fw69ke6f(v=vs.80).aspx

But it doesn't load the localized resources (loads the global resources file, the one without the culture name on it). I setted regional settings to fr (the localized culture that I'm trying altough I'm in Portugal), the localization in regional settings to France, checked the fr-FR language was on top of the IE9 browser languages (on internet options), recompiled the application, cleaned the the folder C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files, and it still doesn't work.

Also tried to put the fr file into a subdir called fr and using fr-FR instead of fr only.

Why the fr resources are not loading? Maybe I have to change the main file name (how does .net knows what's the main resources file filename)?

Upvotes: 0

Views: 1101

Answers (1)

Robb Vandaveer
Robb Vandaveer

Reputation: 1511

I don't know what version of IIS you are using but in 7 you have to explicitly turn on client based culture as detailed here. This adds the following line to your web.config

<system.web>
    <globalization enableClientBasedCulture="true" />
</system.web>

This article further explains that you also need to set these values in addition:

<system.web>
    <globalization culture="auto" uiculture="auto" enableClientBasedCulture="true" />
</system.web>

Upvotes: 1

Related Questions