Calendar: Update Globalize to 1.0.0

This commit is contained in:
Felix Nagel 2015-07-27 20:53:16 +02:00
parent 8238c25980
commit f9ba50df66
19 changed files with 3575 additions and 627 deletions

View File

@ -19,7 +19,7 @@
"qunit-assert-close": "JamesMGreene/qunit-assert-close#v1.1.1", "qunit-assert-close": "JamesMGreene/qunit-assert-close#v1.1.1",
"qunit-composite": "JamesMGreene/qunit-composite#v1.1.0", "qunit-composite": "JamesMGreene/qunit-composite#v1.1.0",
"requirejs": "2.1.14", "requirejs": "2.1.14",
"globalize": "1.0.0-alpha.7", "globalize": "1.0.0",
"jquery-1.7.0": "jquery#1.7.0", "jquery-1.7.0": "jquery#1.7.0",
"jquery-1.7.1": "jquery#1.7.1", "jquery-1.7.1": "jquery#1.7.1",

View File

@ -9,6 +9,7 @@
<script src="../../external/cldrjs/cldr/event.js"></script> <script src="../../external/cldrjs/cldr/event.js"></script>
<script src="../../external/jquery/jquery.js"></script> <script src="../../external/jquery/jquery.js"></script>
<script src="../../external/globalize/globalize.js"></script> <script src="../../external/globalize/globalize.js"></script>
<script src="../../external/globalize/globalize/number.js"></script>
<script src="../../external/globalize/globalize/date.js"></script> <script src="../../external/globalize/globalize/date.js"></script>
<script src="../../external/localization.js"></script> <script src="../../external/localization.js"></script>
<script src="../../external/date.js"></script> <script src="../../external/date.js"></script>

View File

@ -9,6 +9,7 @@
<script src="../../external/cldrjs/cldr/event.js"></script> <script src="../../external/cldrjs/cldr/event.js"></script>
<script src="../../external/jquery/jquery.js"></script> <script src="../../external/jquery/jquery.js"></script>
<script src="../../external/globalize/globalize.js"></script> <script src="../../external/globalize/globalize.js"></script>
<script src="../../external/globalize/globalize/number.js"></script>
<script src="../../external/globalize/globalize/date.js"></script> <script src="../../external/globalize/globalize/date.js"></script>
<script src="../../external/localization.js"></script> <script src="../../external/localization.js"></script>
<script src="../../external/date.js"></script> <script src="../../external/date.js"></script>

View File

@ -9,6 +9,7 @@
<script src="../../external/cldrjs/cldr/event.js"></script> <script src="../../external/cldrjs/cldr/event.js"></script>
<script src="../../external/jquery/jquery.js"></script> <script src="../../external/jquery/jquery.js"></script>
<script src="../../external/globalize/globalize.js"></script> <script src="../../external/globalize/globalize.js"></script>
<script src="../../external/globalize/globalize/number.js"></script>
<script src="../../external/globalize/globalize/date.js"></script> <script src="../../external/globalize/globalize/date.js"></script>
<script src="../../external/localization.js"></script> <script src="../../external/localization.js"></script>
<script src="../../external/date.js"></script> <script src="../../external/date.js"></script>

View File

@ -9,6 +9,7 @@
<script src="../../external/cldrjs/cldr/event.js"></script> <script src="../../external/cldrjs/cldr/event.js"></script>
<script src="../../external/jquery/jquery.js"></script> <script src="../../external/jquery/jquery.js"></script>
<script src="../../external/globalize/globalize.js"></script> <script src="../../external/globalize/globalize.js"></script>
<script src="../../external/globalize/globalize/number.js"></script>
<script src="../../external/globalize/globalize/date.js"></script> <script src="../../external/globalize/globalize/date.js"></script>
<script src="../../external/localization.js"></script> <script src="../../external/localization.js"></script>
<script src="../../external/date.js"></script> <script src="../../external/date.js"></script>

View File

@ -9,6 +9,7 @@
<script src="../../external/cldrjs/cldr/event.js"></script> <script src="../../external/cldrjs/cldr/event.js"></script>
<script src="../../external/jquery/jquery.js"></script> <script src="../../external/jquery/jquery.js"></script>
<script src="../../external/globalize/globalize.js"></script> <script src="../../external/globalize/globalize.js"></script>
<script src="../../external/globalize/globalize/number.js"></script>
<script src="../../external/globalize/globalize/date.js"></script> <script src="../../external/globalize/globalize/date.js"></script>
<script src="../../external/localization.js"></script> <script src="../../external/localization.js"></script>
<script src="../../external/date.js"></script> <script src="../../external/date.js"></script>

View File

@ -9,6 +9,7 @@
<script src="../../external/cldrjs/cldr/event.js"></script> <script src="../../external/cldrjs/cldr/event.js"></script>
<script src="../../external/jquery/jquery.js"></script> <script src="../../external/jquery/jquery.js"></script>
<script src="../../external/globalize/globalize.js"></script> <script src="../../external/globalize/globalize.js"></script>
<script src="../../external/globalize/globalize/number.js"></script>
<script src="../../external/globalize/globalize/date.js"></script> <script src="../../external/globalize/globalize/date.js"></script>
<script src="../../external/localization.js"></script> <script src="../../external/localization.js"></script>
<script src="../../external/date.js"></script> <script src="../../external/date.js"></script>

View File

@ -9,6 +9,7 @@
<script src="../../external/cldrjs/cldr/event.js"></script> <script src="../../external/cldrjs/cldr/event.js"></script>
<script src="../../external/jquery/jquery.js"></script> <script src="../../external/jquery/jquery.js"></script>
<script src="../../external/globalize/globalize.js"></script> <script src="../../external/globalize/globalize.js"></script>
<script src="../../external/globalize/globalize/number.js"></script>
<script src="../../external/globalize/globalize/date.js"></script> <script src="../../external/globalize/globalize/date.js"></script>
<script src="../../external/localization.js"></script> <script src="../../external/localization.js"></script>
<script src="../../external/date.js"></script> <script src="../../external/date.js"></script>

View File

@ -9,6 +9,7 @@
<script src="../../external/cldrjs/cldr/event.js"></script> <script src="../../external/cldrjs/cldr/event.js"></script>
<script src="../../external/jquery/jquery.js"></script> <script src="../../external/jquery/jquery.js"></script>
<script src="../../external/globalize/globalize.js"></script> <script src="../../external/globalize/globalize.js"></script>
<script src="../../external/globalize/globalize/number.js"></script>
<script src="../../external/globalize/globalize/date.js"></script> <script src="../../external/globalize/globalize/date.js"></script>
<script src="../../external/localization.js"></script> <script src="../../external/localization.js"></script>
<script src="../../external/date.js"></script> <script src="../../external/date.js"></script>

View File

@ -1,4 +1,4 @@
Copyright (c) 2013 Rafael Xavier de Souza http://rafael.xavier.blog.br Copyright (c) Rafael Xavier de Souza http://rafael.xavier.blog.br
Permission is hereby granted, free of charge, to any person Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation obtaining a copy of this software and associated documentation

View File

@ -1,15 +1,15 @@
/** /**
* CLDR JavaScript Library v0.3.8 * CLDR JavaScript Library v0.4.1
* http://jquery.com/ * http://jquery.com/
* *
* Copyright 2013 Rafael Xavier de Souza * Copyright 2013 Rafael Xavier de Souza
* Released under the MIT license * Released under the MIT license
* http://jquery.org/license * http://jquery.org/license
* *
* Date: 2014-07-13T05:05Z * Date: 2015-02-25T13:51Z
*/ */
/*! /*!
* CLDR JavaScript Library v0.3.8 2014-07-13T05:05Z MIT license © Rafael Xavier * CLDR JavaScript Library v0.4.1 2015-02-25T13:51Z MIT license © Rafael Xavier
* http://git.io/h4lmVg * http://git.io/h4lmVg
*/ */
(function( root, factory ) { (function( root, factory ) {
@ -28,85 +28,6 @@
}( this, function() { }( this, function() {
var arrayForEach = function( array, callback ) {
var i, length;
if ( array.forEach ) {
return array.forEach( callback );
}
for ( i = 0, length = array.length; i < length; i++ ) {
callback( array[ i ], i, array );
}
};
var objectKeys = function( object ) {
var i,
result = [];
if ( Object.keys ) {
return Object.keys( object );
}
for ( i in object ) {
result.push( i );
}
return result;
};
var createError = function( code, attributes ) {
var error, message;
message = code + ( attributes && JSON ? ": " + JSON.stringify( attributes ) : "" );
error = new Error( message );
error.code = code;
// extend( error, attributes );
arrayForEach( objectKeys( attributes ), function( attribute ) {
error[ attribute ] = attributes[ attribute ];
});
return error;
};
var validate = function( code, check, attributes ) {
if ( !check ) {
throw createError( code, attributes );
}
};
var validatePresence = function( value, name ) {
validate( "E_MISSING_PARAMETER", typeof value !== "undefined", {
name: name
});
};
var validateType = function( value, name, check, expected ) {
validate( "E_INVALID_PAR_TYPE", check, {
expected: expected,
name: name,
value: value
});
};
var arrayIsArray = Array.isArray || function( obj ) { var arrayIsArray = Array.isArray || function( obj ) {
return Object.prototype.toString.call( obj ) === "[object Array]"; return Object.prototype.toString.call( obj ) === "[object Array]";
}; };
@ -114,37 +35,6 @@
var validateTypePath = function( value, name ) {
validateType( value, name, typeof value === "string" || arrayIsArray( value ), "String or Array" );
};
/**
* Function inspired by jQuery Core, but reduced to our use case.
*/
var isPlainObject = function( obj ) {
return obj !== null && "" + obj === "[object Object]";
};
var validateTypePlainObject = function( value, name ) {
validateType( value, name, typeof value === "undefined" || isPlainObject( value ), "Plain Object" );
};
var validateTypeString = function( value, name ) {
validateType( value, name, typeof value === "string", "a string" );
};
var pathNormalize = function( path, attributes ) { var pathNormalize = function( path, attributes ) {
if ( arrayIsArray( path ) ) { if ( arrayIsArray( path ) ) {
path = path.join( "/" ); path = path.join( "/" );
@ -315,6 +205,200 @@
/**
* subtags( locale )
*
* @locale [String]
*/
var coreSubtags = function( locale ) {
var aux, unicodeLanguageId,
subtags = [];
locale = locale.replace( /_/, "-" );
// Unicode locale extensions.
aux = locale.split( "-u-" );
if ( aux[ 1 ] ) {
aux[ 1 ] = aux[ 1 ].split( "-t-" );
locale = aux[ 0 ] + ( aux[ 1 ][ 1 ] ? "-t-" + aux[ 1 ][ 1 ] : "");
subtags[ 4 /* unicodeLocaleExtensions */ ] = aux[ 1 ][ 0 ];
}
// TODO normalize transformed extensions. Currently, skipped.
// subtags[ x ] = locale.split( "-t-" )[ 1 ];
unicodeLanguageId = locale.split( "-t-" )[ 0 ];
// unicode_language_id = "root"
// | unicode_language_subtag
// (sep unicode_script_subtag)?
// (sep unicode_region_subtag)?
// (sep unicode_variant_subtag)* ;
//
// Although unicode_language_subtag = alpha{2,8}, I'm using alpha{2,3}. Because, there's no language on CLDR lengthier than 3.
aux = unicodeLanguageId.match( /^(([a-z]{2,3})(-([A-Z][a-z]{3}))?(-([A-Z]{2}|[0-9]{3}))?)(-[a-zA-Z0-9]{5,8}|[0-9][a-zA-Z0-9]{3})*$|^(root)$/ );
if ( aux === null ) {
return [ "und", "Zzzz", "ZZ" ];
}
subtags[ 0 /* language */ ] = aux[ 9 ] /* root */ || aux[ 2 ] || "und";
subtags[ 1 /* script */ ] = aux[ 4 ] || "Zzzz";
subtags[ 2 /* territory */ ] = aux[ 6 ] || "ZZ";
subtags[ 3 /* variant */ ] = aux[ 7 ];
// 0: language
// 1: script
// 2: territory (aka region)
// 3: variant
// 4: unicodeLocaleExtensions
return subtags;
};
var arrayForEach = function( array, callback ) {
var i, length;
if ( array.forEach ) {
return array.forEach( callback );
}
for ( i = 0, length = array.length; i < length; i++ ) {
callback( array[ i ], i, array );
}
};
/**
* bundleLookup( minLanguageId )
*
* @Cldr [Cldr class]
*
* @cldr [Cldr instance]
*
* @minLanguageId [String] requested languageId after applied remove likely subtags.
*/
var bundleLookup = function( Cldr, cldr, minLanguageId ) {
var availableBundleMap = Cldr._availableBundleMap,
availableBundleMapQueue = Cldr._availableBundleMapQueue;
if ( availableBundleMapQueue.length ) {
arrayForEach( availableBundleMapQueue, function( bundle ) {
var existing, maxBundle, minBundle, subtags;
subtags = coreSubtags( bundle );
maxBundle = coreLikelySubtags( Cldr, cldr, subtags, { force: true } ) || subtags;
minBundle = coreRemoveLikelySubtags( Cldr, cldr, maxBundle );
minBundle = minBundle.join( Cldr.localeSep );
existing = availableBundleMapQueue[ minBundle ];
if ( existing && existing.length < bundle.length ) {
return;
}
availableBundleMap[ minBundle ] = bundle;
});
Cldr._availableBundleMapQueue = [];
}
return availableBundleMap[ minLanguageId ] || null;
};
var objectKeys = function( object ) {
var i,
result = [];
if ( Object.keys ) {
return Object.keys( object );
}
for ( i in object ) {
result.push( i );
}
return result;
};
var createError = function( code, attributes ) {
var error, message;
message = code + ( attributes && JSON ? ": " + JSON.stringify( attributes ) : "" );
error = new Error( message );
error.code = code;
// extend( error, attributes );
arrayForEach( objectKeys( attributes ), function( attribute ) {
error[ attribute ] = attributes[ attribute ];
});
return error;
};
var validate = function( code, check, attributes ) {
if ( !check ) {
throw createError( code, attributes );
}
};
var validatePresence = function( value, name ) {
validate( "E_MISSING_PARAMETER", typeof value !== "undefined", {
name: name
});
};
var validateType = function( value, name, check, expected ) {
validate( "E_INVALID_PAR_TYPE", check, {
expected: expected,
name: name,
value: value
});
};
var validateTypePath = function( value, name ) {
validateType( value, name, typeof value === "string" || arrayIsArray( value ), "String or Array" );
};
/**
* Function inspired by jQuery Core, but reduced to our use case.
*/
var isPlainObject = function( obj ) {
return obj !== null && "" + obj === "[object Object]";
};
var validateTypePlainObject = function( value, name ) {
validateType( value, name, typeof value === "undefined" || isPlainObject( value ), "Plain Object" );
};
var validateTypeString = function( value, name ) {
validateType( value, name, typeof value === "string", "a string" );
};
// @path: normalized path // @path: normalized path
var resourceGet = function( data, path ) { var resourceGet = function( data, path ) {
var i, var i,
@ -333,18 +417,33 @@
var itemGetResolved = function( Cldr, path, attributes ) { /**
// Resolve path * setAvailableBundles( Cldr, json )
var normalizedPath = pathNormalize( path, attributes ); *
* @Cldr [Cldr class]
*
* @json resolved/unresolved cldr data.
*
* Set available bundles queue based on passed json CLDR data. Considers a bundle as any String at /main/{bundle}.
*/
var coreSetAvailableBundles = function( Cldr, json ) {
var bundle,
availableBundleMapQueue = Cldr._availableBundleMapQueue,
main = resourceGet( json, [ "main" ] );
return resourceGet( Cldr._resolved, normalizedPath ); if ( main ) {
for ( bundle in main ) {
if ( main.hasOwnProperty( bundle ) && bundle !== "root" ) {
availableBundleMapQueue.push( bundle );
}
}
}
}; };
var alwaysArray = function( somethingOrArray ) {
var alwaysArray = function( stringOrArray ) { return arrayIsArray( somethingOrArray ) ? somethingOrArray : [ somethingOrArray ];
return typeof stringOrArray === "string" ? [ stringOrArray ] : stringOrArray;
}; };
@ -390,6 +489,48 @@
}()); }());
/**
* load( Cldr, source, jsons )
*
* @Cldr [Cldr class]
*
* @source [Object]
*
* @jsons [arguments]
*/
var coreLoad = function( Cldr, source, jsons ) {
var i, j, json;
validatePresence( jsons[ 0 ], "json" );
// Support arbitrary parameters, e.g., `Cldr.load({...}, {...})`.
for ( i = 0; i < jsons.length; i++ ) {
// Support array parameters, e.g., `Cldr.load([{...}, {...}])`.
json = alwaysArray( jsons[ i ] );
for ( j = 0; j < json.length; j++ ) {
validateTypePlainObject( json[ j ], "json" );
source = jsonMerge( source, json[ j ] );
coreSetAvailableBundles( Cldr, json[ j ] );
}
}
return source;
};
var itemGetResolved = function( Cldr, path, attributes ) {
// Resolve path
var normalizedPath = pathNormalize( path, attributes );
return resourceGet( Cldr._resolved, normalizedPath );
};
/** /**
* new Cldr() * new Cldr()
*/ */
@ -399,6 +540,7 @@
// Build optimization hack to avoid duplicating functions across modules. // Build optimization hack to avoid duplicating functions across modules.
Cldr._alwaysArray = alwaysArray; Cldr._alwaysArray = alwaysArray;
Cldr._coreLoad = coreLoad;
Cldr._createError = createError; Cldr._createError = createError;
Cldr._itemGetResolved = itemGetResolved; Cldr._itemGetResolved = itemGetResolved;
Cldr._jsonMerge = jsonMerge; Cldr._jsonMerge = jsonMerge;
@ -409,29 +551,39 @@
Cldr._validateTypePath = validateTypePath; Cldr._validateTypePath = validateTypePath;
Cldr._validateTypePlainObject = validateTypePlainObject; Cldr._validateTypePlainObject = validateTypePlainObject;
Cldr._availableBundleMap = {};
Cldr._availableBundleMapQueue = [];
Cldr._resolved = {}; Cldr._resolved = {};
// Allow user to override locale separator "-" (default) | "_". According to http://www.unicode.org/reports/tr35/#Unicode_language_identifier, both "-" and "_" are valid locale separators (eg. "en_GB", "en-GB"). According to http://unicode.org/cldr/trac/ticket/6786 its usage must be consistent throughout the data set. // Allow user to override locale separator "-" (default) | "_". According to http://www.unicode.org/reports/tr35/#Unicode_language_identifier, both "-" and "_" are valid locale separators (eg. "en_GB", "en-GB"). According to http://unicode.org/cldr/trac/ticket/6786 its usage must be consistent throughout the data set.
Cldr.localeSep = "-"; Cldr.localeSep = "-";
// Load resolved cldr data /**
// @json [JSON] * Cldr.load( json [, json, ...] )
Cldr.load = function( json ) { *
validatePresence( json, "json" ); * @json [JSON] CLDR data or [Array] Array of @json's.
validateTypePlainObject( json, "json" ); *
Cldr._resolved = jsonMerge( Cldr._resolved, json ); * Load resolved cldr data.
*/
Cldr.load = function() {
Cldr._resolved = coreLoad( Cldr, Cldr._resolved, arguments );
}; };
/** /**
* .init() automatically run on instantiation/construction. * .init() automatically run on instantiation/construction.
*/ */
Cldr.prototype.init = function( locale ) { Cldr.prototype.init = function( locale ) {
var language, languageId, maxLanguageId, script, territory, unicodeLanguageId, variant, var attributes, language, maxLanguageId, minLanguageId, script, subtags, territory, unicodeLocaleExtensions, variant,
sep = Cldr.localeSep; sep = Cldr.localeSep;
validatePresence( locale, "locale" ); validatePresence( locale, "locale" );
validateTypeString( locale, "locale" ); validateTypeString( locale, "locale" );
subtags = coreSubtags( locale );
unicodeLocaleExtensions = subtags[ 4 ];
variant = subtags[ 3 ];
// Normalize locale code. // Normalize locale code.
// Get (or deduce) the "triple subtags": language, territory (also aliased as region), and script subtags. // Get (or deduce) the "triple subtags": language, territory (also aliased as region), and script subtags.
// Get the variant subtags (calendar, collation, currency, etc). // Get the variant subtags (calendar, collation, currency, etc).
@ -440,73 +592,20 @@
// - http://www.unicode.org/reports/tr35/#Language_and_Locale_IDs // - http://www.unicode.org/reports/tr35/#Language_and_Locale_IDs
// - http://www.unicode.org/reports/tr35/#Unicode_locale_identifier // - http://www.unicode.org/reports/tr35/#Unicode_locale_identifier
locale = locale.replace( /-/, "_" );
// TODO normalize unicode locale extensions. Currently, skipped.
// unicodeLocaleExtensions = locale.split( "_u_" )[ 1 ];
locale = locale.split( "_u_" )[ 0 ];
// TODO normalize transformed extensions. Currently, skipped.
// transformedExtensions = locale.split( "_t_" )[ 1 ];
locale = locale.split( "_t_" )[ 0 ];
unicodeLanguageId = locale;
// unicodeLanguageId = ...
switch ( true ) {
// language_script_territory..
case /^[a-z]{2,3}_[A-Z][a-z]{3}_[A-Z0-9]{2}(\b|_)/.test( unicodeLanguageId ):
language = unicodeLanguageId.split( "_" )[ 0 ];
script = unicodeLanguageId.split( "_" )[ 1 ];
territory = unicodeLanguageId.split( "_" )[ 2 ];
variant = unicodeLanguageId.split( "_" )[ 3 ];
break;
// language_script..
case /^[a-z]{2,3}_[A-Z][a-z]{3}(\b|_)/.test( unicodeLanguageId ):
language = unicodeLanguageId.split( "_" )[ 0 ];
script = unicodeLanguageId.split( "_" )[ 1 ];
territory = "ZZ";
variant = unicodeLanguageId.split( "_" )[ 2 ];
break;
// language_territory..
case /^[a-z]{2,3}_[A-Z0-9]{2}(\b|_)/.test( unicodeLanguageId ):
language = unicodeLanguageId.split( "_" )[ 0 ];
script = "Zzzz";
territory = unicodeLanguageId.split( "_" )[ 1 ];
variant = unicodeLanguageId.split( "_" )[ 2 ];
break;
// language.., or root
case /^([a-z]{2,3}|root)(\b|_)/.test( unicodeLanguageId ):
language = unicodeLanguageId.split( "_" )[ 0 ];
script = "Zzzz";
territory = "ZZ";
variant = unicodeLanguageId.split( "_" )[ 1 ];
break;
default:
language = "und";
script = "Zzzz";
territory = "ZZ";
break;
}
// When a locale id does not specify a language, or territory (region), or script, they are obtained by Likely Subtags. // When a locale id does not specify a language, or territory (region), or script, they are obtained by Likely Subtags.
maxLanguageId = coreLikelySubtags( Cldr, this, [ language, script, territory ], { force: true } ) || unicodeLanguageId.split( "_" ); maxLanguageId = coreLikelySubtags( Cldr, this, subtags, { force: true } ) || subtags;
language = maxLanguageId[ 0 ]; language = maxLanguageId[ 0 ];
script = maxLanguageId[ 1 ]; script = maxLanguageId[ 1 ];
territory = maxLanguageId[ 2 ]; territory = maxLanguageId[ 2 ];
languageId = coreRemoveLikelySubtags( Cldr, this, maxLanguageId ).join( sep ); minLanguageId = coreRemoveLikelySubtags( Cldr, this, maxLanguageId ).join( sep );
// Set attributes // Set attributes
this.attributes = { this.attributes = attributes = {
bundle: bundleLookup( Cldr, this, minLanguageId ),
// Unicode Language Id // Unicode Language Id
languageId: languageId, minlanguageId: minLanguageId,
maxLanguageId: maxLanguageId.join( sep ), maxLanguageId: maxLanguageId.join( sep ),
// Unicode Language Id Subtabs // Unicode Language Id Subtabs
@ -517,7 +616,21 @@
variant: variant variant: variant
}; };
this.locale = variant ? [ languageId, variant ].join( sep ) : languageId; // Unicode locale extensions.
unicodeLocaleExtensions && ( "-" + unicodeLocaleExtensions ).replace( /-[a-z]{3,8}|(-[a-z]{2})-([a-z]{3,8})/g, function( attribute, key, type ) {
if ( key ) {
// Extension is in the `keyword` form.
attributes[ "u" + key ] = type;
} else {
// Extension is in the `attribute` form.
attributes[ "u" + attribute ] = true;
}
});
this.locale = locale;
}; };
/** /**
@ -538,12 +651,17 @@
validatePresence( path, "path" ); validatePresence( path, "path" );
validateTypePath( path, "path" ); validateTypePath( path, "path" );
validate( "E_MISSING_BUNDLE", this.attributes.bundle !== null, {
locale: this.locale
});
path = alwaysArray( path ); path = alwaysArray( path );
return this.get( [ "main/{languageId}" ].concat( path ) ); return this.get( [ "main/{bundle}" ].concat( path ) );
}; };
return Cldr; return Cldr;
})); }));

View File

@ -1,15 +1,15 @@
/** /**
* CLDR JavaScript Library v0.3.8 * CLDR JavaScript Library v0.4.1
* http://jquery.com/ * http://jquery.com/
* *
* Copyright 2013 Rafael Xavier de Souza * Copyright 2013 Rafael Xavier de Souza
* Released under the MIT license * Released under the MIT license
* http://jquery.org/license * http://jquery.org/license
* *
* Date: 2014-07-13T05:05Z * Date: 2015-02-25T13:51Z
*/ */
/*! /*!
* CLDR JavaScript Library v0.3.8 2014-07-13T05:05Z MIT license © Rafael Xavier * CLDR JavaScript Library v0.4.1 2015-02-25T13:51Z MIT license © Rafael Xavier
* http://git.io/h4lmVg * http://git.io/h4lmVg
*/ */
(function( factory ) { (function( factory ) {
@ -32,7 +32,6 @@
validatePresence = Cldr._validatePresence, validatePresence = Cldr._validatePresence,
validateType = Cldr._validateType; validateType = Cldr._validateType;
/*! /*!
* EventEmitter v4.2.7 - git.io/ee * EventEmitter v4.2.7 - git.io/ee
* Oliver Caldwell * Oliver Caldwell
@ -582,4 +581,5 @@ EventEmitter = (function () {
})); }));

View File

@ -1,15 +1,15 @@
/** /**
* CLDR JavaScript Library v0.3.8 * CLDR JavaScript Library v0.4.1
* http://jquery.com/ * http://jquery.com/
* *
* Copyright 2013 Rafael Xavier de Souza * Copyright 2013 Rafael Xavier de Souza
* Released under the MIT license * Released under the MIT license
* http://jquery.org/license * http://jquery.org/license
* *
* Date: 2014-07-13T05:05Z * Date: 2015-02-25T13:51Z
*/ */
/*! /*!
* CLDR JavaScript Library v0.3.8 2014-07-13T05:05Z MIT license © Rafael Xavier * CLDR JavaScript Library v0.4.1 2015-02-25T13:51Z MIT license © Rafael Xavier
* http://git.io/h4lmVg * http://git.io/h4lmVg
*/ */
(function( factory ) { (function( factory ) {
@ -32,7 +32,6 @@
var supplementalMain = function( cldr ) { var supplementalMain = function( cldr ) {
var prepend, supplemental; var prepend, supplemental;
@ -98,4 +97,5 @@
})); }));

View File

@ -1,5 +1,4 @@
Copyright 2010, 2014 jQuery Foundation and other contributors, Copyright jQuery Foundation and other contributors, https://jquery.org/
https://jquery.org/
This software consists of voluntary contributions made by many This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history individuals. For exact contribution history, see the revision history

View File

@ -1,13 +1,17 @@
/*! /**
* Globalize v1.0.0-alpha.7 * Globalize v1.0.0
* *
* http://github.com/jquery/globalize * http://github.com/jquery/globalize
* *
* Copyright 2010, 2014 jQuery Foundation, Inc. and other contributors * Copyright jQuery Foundation and other contributors
* Released under the MIT license * Released under the MIT license
* http://jquery.org/license * http://jquery.org/license
* *
* Date: 2014-09-30T12:31Z * Date: 2015-04-23T12:02Z
*/
/*!
* Globalize v1.0.0 2015-04-23T12:02Z Released under the MIT license
* http://git.io/TrdQbw
*/ */
(function( root, factory ) { (function( root, factory ) {
@ -54,7 +58,7 @@ var toString = function( variable ) {
* *
* Return the formatted message. For example: * Return the formatted message. For example:
* *
* - formatMessage( "{0} second", 1 ); // 1 second * - formatMessage( "{0} second", [ 1 ] ); // 1 second
* *
* - formatMessage( "{0}/{1}", ["m", "s"] ); // m/s * - formatMessage( "{0}/{1}", ["m", "s"] ); // m/s
* *
@ -77,6 +81,23 @@ var formatMessage = function( message, data ) {
var objectExtend = function() {
var destination = arguments[ 0 ],
sources = [].slice.call( arguments, 1 );
sources.forEach(function( source ) {
var prop;
for ( prop in source ) {
destination[ prop ] = source[ prop ];
}
});
return destination;
};
var createError = function( code, message, attributes ) { var createError = function( code, message, attributes ) {
var error; var error;
@ -84,10 +105,7 @@ var createError = function( code, message, attributes ) {
error = new Error( message ); error = new Error( message );
error.code = code; error.code = code;
// extend( error, attributes ); objectExtend( error, attributes );
Object.keys( attributes ).forEach(function( attribute ) {
error[ attribute ] = attributes[ attribute ];
});
return error; return error;
}; };
@ -228,6 +246,28 @@ var alwaysCldr = function( localeOrCldr ) {
// ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions?redirectlocale=en-US&redirectslug=JavaScript%2FGuide%2FRegular_Expressions
var regexpEscape = function( string ) {
return string.replace( /([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1" );
};
var stringPad = function( str, count, right ) {
var length;
if ( typeof str !== "string" ) {
str = String( str );
}
for ( length = str.length; length < count; length += 1 ) {
str = ( right ? ( str + "0" ) : ( "0" + str ) );
}
return str;
};
function validateLikelySubtags( cldr ) { function validateLikelySubtags( cldr ) {
cldr.once( "get", validateCldr ); cldr.once( "get", validateCldr );
cldr.get( "supplemental/likelySubtags" ); cldr.get( "supplemental/likelySubtags" );
@ -256,18 +296,16 @@ function Globalize( locale ) {
} }
/** /**
* Globalize.load( json ) * Globalize.load( json, ... )
* *
* @json [JSON] * @json [JSON]
* *
* Load resolved or unresolved cldr data. * Load resolved or unresolved cldr data.
* Somewhat equivalent to previous Globalize.addCultureInfo(...). * Somewhat equivalent to previous Globalize.addCultureInfo(...).
*/ */
Globalize.load = function( json ) { Globalize.load = function() {
validateParameterPresence( json, "json" ); // validations are delegated to Cldr.load().
validateParameterTypePlainObject( json, "json" ); Cldr.load.apply( Cldr, arguments );
Cldr.load( json );
}; };
/** /**
@ -298,6 +336,9 @@ Globalize._alwaysArray = alwaysArray;
Globalize._createError = createError; Globalize._createError = createError;
Globalize._formatMessage = formatMessage; Globalize._formatMessage = formatMessage;
Globalize._isPlainObject = isPlainObject; Globalize._isPlainObject = isPlainObject;
Globalize._objectExtend = objectExtend;
Globalize._regexpEscape = regexpEscape;
Globalize._stringPad = stringPad;
Globalize._validate = validate; Globalize._validate = validate;
Globalize._validateCldr = validateCldr; Globalize._validateCldr = validateCldr;
Globalize._validateDefaultLocale = validateDefaultLocale; Globalize._validateDefaultLocale = validateDefaultLocale;

File diff suppressed because it is too large Load Diff

1266
external/globalize/globalize/number.js vendored Normal file

File diff suppressed because it is too large Load Diff

1482
external/localization.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,8 @@
"date", "date",
"./button", "./button",
"./core", "./core",
"./button" ], factory ); "./button"
], factory );
} else { } else {
// Browser globals // Browser globals
@ -178,8 +179,8 @@ return $.widget( "ui.calendar", {
_setLocale: function( locale ) { _setLocale: function( locale ) {
var globalize = new Globalize( locale ), var globalize = new Globalize( locale ),
weekdayShortFormatter = globalize.dateFormatter({ pattern: "EEEEEE" }), weekdayShortFormatter = globalize.dateFormatter({ raw: "EEEEEE" }),
weekdayNarrowFormatter = globalize.dateFormatter({ pattern: "EEEEE" }); weekdayNarrowFormatter = globalize.dateFormatter({ raw: "EEEEE" });
this._format = globalize.dateFormatter({ date: "short" }); this._format = globalize.dateFormatter({ date: "short" });
this._parse = globalize.dateParser({ date: "short" }); this._parse = globalize.dateParser({ date: "short" });
@ -192,9 +193,9 @@ return $.widget( "ui.calendar", {
return shortWeekday.length > 3 ? weekdayNarrowFormatter( date ) : shortWeekday; return shortWeekday.length > 3 ? weekdayNarrowFormatter( date ) : shortWeekday;
}, },
formatWeekdayFull: globalize.dateFormatter({ pattern: "EEEE" }), formatWeekdayFull: globalize.dateFormatter({ raw: "EEEE" }),
formatMonth: globalize.dateFormatter({ pattern: "MMMM" }), formatMonth: globalize.dateFormatter({ raw: "MMMM" }),
formatWeekOfYear: globalize.dateFormatter({ pattern: "w" }), formatWeekOfYear: globalize.dateFormatter({ raw: "w" }),
parse: this._parse parse: this._parse
}; };
}, },