Sergio Romero
Sergio Romero

Reputation: 6597

Is there a way to test localization other than changing the thread's CurrentCulture?

In an ASP .Net MVC application. I want to make sure my code is getting its strings from the resource files of the correct culture. I know I can put something like the following on the code:

Thread.CurrentThread.CurrentCulture = myCultureInfo;
Thread.CurrentThread.CurrentUICulture = myCultureInfo;

and it will work. I was just wondering if there is a way of doing it without modifying the source code. I remember someone showed me quite a while ago that by changing some setting in IE could do the trick but I do not what exactly he changed and if you can do something similar with Chrome and/or FireFox.

Upvotes: 1

Views: 1045

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038730

You could use the element in your web.config to set the culture to some specific value or set it to auto meaning that the client settings will be used:

<globalization culture="auto" uiCulture="auto" />

Now ASP.NET will use the culture configured on the client browser. For example in FireFox:

enter image description here

I would also recommend you reading the following blog post on globalization in ASP.NET.

Upvotes: 2

Related Questions