5

I am using the Globalize jQuery plugin to have globalization (correct number and date formats) on the client side in my MVC website. So I have downloaded that plugin and included the following javascript files after the validation js files themselves (I have tried putting the Globalize file before as well without any luck):

<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 run the application, I get the error

Globalize.addCultureInfo is not a function

I cannot figure out what the reason is

Hakan Fıstık
  • 16,800
  • 14
  • 110
  • 131
user2711444
  • 179
  • 1
  • 4
  • 13

2 Answers2

1

According to the documentation of the Globalize library itself, this function has been removed in the 1.x version. This function was exist in the versions 0.x

This method is replaced by Globalize.loadMessages( json ). If you were using it for anything except message translations, you may also need to use Globalize.load.

Hakan Fıstık
  • 16,800
  • 14
  • 110
  • 131
0

Maybe because the function addCulterInfo is not defined on globalize.js file. I used somthing like that on one of my projects sometime ago. I hope it 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's a new culture
    if ( isNew ) {
            this.cultures[ cultureName ].calendar = this.cultures[ cultureName ].calendars.standard;
    }
};
Hakan Fıstık
  • 16,800
  • 14
  • 110
  • 131
Tito
  • 1
  • 1