Sunday, February 25, 2007

More on localization...

I was changing the Region and language settings in the control panel, and was expecting that text in the forms to show up in the language that I had set, with no luck.Did some reading and ……
CurrentUICulture is a per thread settings that governs from which resource file the ResourceManager class uses in a localized application. CurrentUICulture is a language setting and does not have any thing to do with date or currency formats.
The CurrentUICulture is determined from the users default language, or if this is not set, the language used by the o/s
The CurrentUICulture can be changed as follows
Thread.CurrentThread.CurrentUICulture = new CultureInfo(“fr”);

The CurrentCultrue is not a language setting, CurrentCultutre determines the date formats , currency formats etc.. This can be changed from the Regional option from your control panel. The CurrentCulture ctor takes a culture (a region and a language) as a parameter and will throw an exception if a neutral culture is specified
In a web application, the browsers default language can be determined to respond with the appropriate web page, as shown below
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);

1 comment:

  1. This comment has been removed by a blog administrator.