i have a Default.aspx
file where i fetch localized values:
Default.aspx:
<asp:Localize meta:resourcekey="lblTitle" runat="server">Welcome</asp:Localize>
i then create a matching fallback resource file:
Default.aspx.resx:
lblTitle.Text Welcome to Stackoverflow Localized
And that works:
Now i want to create, for example, a French localization:
Default.aspx.fr.resx:
lblTitle.Text Bienvenue Stackoverflow
And i change my browser to send a french language locale:
(which it does):
GET http://stackoverflow.com/ HTTP/1.1
Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, */*
Accept-Language: fr-CH,qps-ploc;q=0.5
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Host: stackoverflow.com
Except that it just doesn't work:
i'm following what Microsoft says:
For example, if you have a page named Default.aspx in the App_LocalResources folder, you might create the following files:
Default.aspx.resx
. This is the default local resource file (the fallback resource file) if no language match is found.
Default.aspx.es.resx
. This is the resource file for Spanish, without culture information.
Default.aspx.es-mx.resx
. This is the resource file for Spanish (Mexico) specifically.
Default.aspx.fr.resx
. This is the resource file for French, without culture information.
Why is .NET doing not what .NET should be doing?
Update:
From MSDN:
Selecting Resource Files for Different Languages
ASP.NET can set the UICulture and Culture properties for the page to the language and culture values that are passed by the browser. ... For detailed information, see How to: Set the Culture and UI Culture for ASP.NET Web Page Globalization.
How can i get ASP.NET to set the UICulture
and Culture
properties for the page to the language and culture values that are passed by the browser?
From How to: Set the Culture and UI Culture for ASP.NET Web Page Globalization:
Users can set the UI culture and culture in their browsers. For example, in Microsoft Internet Explorer, on the Tools menu, users can click Internet Options, on the General tab, click Language, and then set their language preference. If the enableClientBasedCulture attribute of the globalization element in the Web.config file is set to true, ASP.NET can set the UI culture and culture for a Web page automatically, based on the values that are sent by a browser.
To set the culture and UI culture for an ASP.NET Web page declaratively
- To have ASP.NET set the UI culture and culture to the first language that is specified in the current browser settings, set UICulture and Culture to auto. Alternatively, you can set this value to auto:culture_info_name, where culture_info_name is a culture name. For a list of culture names, see CultureInfo. You can make this setting either in the @ Page directive or Web.config file.