tags:

views:

125

answers:

3

I have a number resx files as follows,

Resources-es-ES.resx Resources-es.resx Resources.resx (english defaults)

They are compiled into an assembly and I use them for localising my web pages by simply referring to Resources.Ok for example. My question is whether there is a way to find out the "rendered culture", e.g. if I come into the site with my CurrentUICulture set to "fr-fr" for example it will fall back to using the English resources and I'm wondering how to get that information to help me with some JavaScript localisation.

A: 

You can try the javascript on this page:

http://www.java2s.com/Code/ASP/Page/GetCulturedeDEidIDC.htm

MUG4N
A: 

I don't work much with localization but reading your question I'd just put a key in each of the .resx files that contains the CultureInfo code for that particular file that I could feed the Javascript with.

Don
I like this, simple but should work a treat for my particular problem. Thanks
Chris Meek
+1  A: 

Luckily .NET has built-in javascript object with culture information. Assuming you've got ScriptManager on page (I think you need it..), you can use this:

<script type=”text/javascript”>
   var culture = Sys.CultureInfo.CurrentCulture;
   alert(culture.name); //shows en-GB etc
</script>

Edit: You can read about it here: http://msdn.microsoft.com/en-us/library/bb397445.aspx

rochal