Globalize.addCultureInfo is not a function

I am using the Globalize jQuery plugin to globalize (the correct numbers and date formats) on the client side on my MVC website. Thus, I downloaded this plugin and included the following javascript files after the js validation files themselves (I also tried to put the Globalize file without it):

<script src="/Scripts/globalize.js"></script>
<script src="/Scripts/jquery.validate.globalize.min.js"></script>
<script src="/Scripts/globalize/globalize.culture.da-DK.js"></script>

But when I start the application, I get an error

Globalize.addCultureInfo is not a function

I can not understand what is the reason

+4
source share
2 answers

Perhaps because the addCulterInfo function is not defined in the globalize.js file. I used something like this in one of my projects at one time. Hope this helps:

Globalize.addCultureInfo = function( cultureName, baseCultureName, info ) {
    var base = {},
            isNew = false;
    if ( typeof cultureName !== "string" ) {
            // cultureName argument is optional string. If not specified, assume info is first
            // and only argument. Specified info deep-extends current culture.
            info = cultureName;
            cultureName = this.culture().name;
            base = this.cultures[ cultureName ];
    } else if ( typeof baseCultureName !== "string" ) {
            // baseCultureName argument is optional string. If not specified, assume info is second
            // argument. Specified info deep-extends specified culture.
            // If specified culture does not exist, create by deep-extending default
            info = baseCultureName;
            isNew = ( this.cultures[ cultureName ] == null );
            base = this.cultures[ cultureName ] || this.cultures[ "default" ];
    } else {
            // cultureName and baseCultureName specified. Assume a new culture is being created
            // by deep-extending an specified base culture
            isNew = true;
            base = this.cultures[ baseCultureName ];
    }
    this.cultures[ cultureName ] = extend(true, {},
            base,
            info
    );
    // Make the standard calendar the current culture if it a new culture
    if ( isNew ) {
            this.cultures[ cultureName ].calendar = this.cultures[ cultureName ].calendars.standard;
    }
};
0
source

Globalize 1.x. 0.x

Globalize.loadMessages( json ). -, , Globalize.load.

0

All Articles