[Windows 8] How to get the user’s current culture ?

July 26th, 2012 | Posted by Tom in .NET | Article | HTML5 | Windows 8 | WinJS | WinRT | Read: 849

In .NET application, to retrieve the user’s current culture is pretty simple using the CultureInfo class. But performing the same thing, in particular using Javascript, is a bit more complex.

So here is a quick code sample to perform this task:

image

As you can see, we just need to access to the languages property of the GlobalizationPreferences class. This property is an array containing all the cultures installed and used on the machine.

Here is the results of the previous call:

image

Simple but very useful ! To see more content about localization, check here: http://msdn.microsoft.com/en-us/library/windows/apps/hh465006.aspx

 

Happy coding!

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

One Response




Leave a Reply