How to find actual language file in use?
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", eg 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.
我不用本地化工作,但是阅读你的问题,我只是把每个包含CultureInfo代码的.resx文件中的一个关键字放在那个特定的文件中,我可以用这个文件来提供Javascript。
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
You can try the javascript on this page:
http://www.java2s.com/Code/ASP/Page/GetCulturedeDEidIDC.htm
链接地址: http://www.djcxy.com/p/66638.html上一篇: 更新装配中的资源文件
下一篇: 如何找到正在使用的实际语言文件?