Reputation: 3468
Is it possible to localize the javascript and jquery in asp.net (.net 4)?
Is there any proper examples with c#?
Upvotes: 3
Views: 783
Reputation: 3468
http://weblogs.asp.net/scottgu/archive/2010/06/10/jquery-globalization-plugin-from-microsoft.aspx
This site provides a demo application of globalization of jquery in .net
Upvotes: 3
Reputation: 101166
I usually create one localization script per language for a plugin. The script contains variables with all strings that the plugin use. Other scripts let you define all text strings in the plugin options.
I then use ASP.NET to define which language (since the user might not want the language reported by the browser).
In your master page:
<script type="text/javascript" src="/Scripts/jquery.yourplugin.resources.<%= userLanguage %>.js"></script>
<script type="text/javascript" src="/Scripts/jquery.yourplugin.js"></script>
Upvotes: 1