Globalization in JQuery is not working

2020-04-21 18:19发布

问题:

I have been following theScott Hanselman Tutorial on Globalized Javascript Validation. It is a great tutorial wich made me understand a topic I'm not that familiar with a bit better. The only problem is that it's a bit outdated because the link he provided to files like jquery.glob.fr.js is invalid. But you get redirected to the improved version by Jquery.

That's ok, but They just don't do what they promise to do. I tried searching for tutorials and information about this, but the only help on the internet is the ReadMe file. They state this =>

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

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

But when I try it 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 didn't work so i tried nl-BE like the documentation states. No difference.

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