I'm developping an ASP MVC application that use Globalize.js. In the _Layout.cshtml I added this code
<script>
(function () {
$(function () {
$.when(
$.getJSON("@Url.Content("~/Scripts/cldr/supplemental/likelySubtags.json")"),
$.getJSON("@Url.Content("~/Scripts/cldr/main/fr/numbers.json")"),
$.getJSON("@Url.Content("~/Scripts/cldr/supplemental/numberingSystems.json")"),
$.getJSON("@Url.Content("~/Scripts/cldr/main/fr/ca-gregorian.json")"),
$.getJSON("@Url.Content("~/Scripts/cldr/main/fr/timeZoneNames.json")"),
$.getJSON("@Url.Content("~/Scripts/cldr/supplemental/timeData.json")"),
$.getJSON("@Url.Content("~/Scripts/cldr/supplemental/weekData.json")")
).then(function () {
// Normalize $.get results, we only need the JSON, not the request statuses.
return [].slice.apply(arguments, [0]).map(function (result) {
return result[0];
});
}).then(Globalize.load).then(function () {
Globalize.locale("fr");
});
});
})();
</script>
It's working. But when I tried to use it in other page in $(document).ready or $(window).load I Have the error JavaScript: E_DEFAULT_LOCALE_NOT_DEFINED: Default locale has not been defined.
It seems Like that The Globalize is not yet loaded.