Globalization in jQuery not working

I followed the Scott Hanselman tutorial on Javascript globalization validation. This is a great tutorial that made me understand a topic that I am a little unfamiliar with. The only problem is that it is a little outdated because the link that it provided to files like jquery.glob.fr.js is invalid. But jquery redirects to an improved version.

That's fine, but they just don't do what they promise. I tried to find tutorials and information about this, but the only help on the Internet is the ReadMe file. They claim that it is =>

Globalize.culture( "fr" ); console.log( Globalize.culture().name ) // "fr" Globalize.culture( "fr-FR" ); console.log( Globalize.culture().name ) // "fr-FR" 

But when I try, my alertbox returns en instead of nl-BE

 <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> <script src="../../Scripts/globalize.culture.nl.js" type="text/javascript"></script> <script src="../../Scripts/globalize.culture.nl-BE.js" type="text/javascript"></script> <script src="../../Scripts/modernizr-1.7.js" type="text/javascript"></script> <script src="../../Scripts/globalize.js" type="text/javascript"></script> @Html.MetaAcceptLanguage() <script type="text/javascript"> $(document).ready(function () { //Ask ASP.NET what culture we prefer, because we stuck it in a meta tag var data = $("meta[name='accept-language']").attr("content") //Tell jQuery to figure it out also on the client side. alert(data.toString()); Globalize.culture("nl-BE"); alert(Globalize.culture().name); }); </script> 

At first I tried Globalize.culture (data), it did not work, so I tried nl-BE, as indicated in the documentation. No difference.

How do I change the culture to nl-BE instead of en?

+1
javascript jquery asp.net-mvc asp.net-mvc-3 globalization
Jul 19 '11 at 15:49
source share

No one has answered this question yet.

See similar questions:

44
Javascript parse float ignores decimal places
2
JQuery "$ .preferCulture ()" is not available / available

or similar:

7649
How do JavaScript locks work?
7428
How to check if an element is hidden in jQuery?
4523
"Thinking in AngularJS" if I have jQuery background?
4345
How to check if checkbox is checked in jQuery?
3952
Setting "checked" for checkbox with jQuery?
2644
Is there an "exists" function for jQuery?
2302
Add table row in jQuery
2245
How to refresh a page using jQuery?
2101
jQuery scroll to element
1957
Disable / enable input using jQuery?



All Articles