mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Datepicker: Use Globalize 1.0.0
- Update Globalize to 1.0.0-alpha.6
This commit is contained in:
parent
b5bae456a2
commit
d0a5a7a0e6
10
Gruntfile.js
10
Gruntfile.js
@ -276,6 +276,16 @@ grunt.initConfig({
|
||||
destPrefix: "external"
|
||||
},
|
||||
files: {
|
||||
"cldrjs/cldr.js": "cldrjs/dist/cldr.js",
|
||||
"cldrjs/cldr/event.js": "cldrjs/dist/cldr/event.js",
|
||||
"cldrjs/cldr/supplemental.js": "cldrjs/dist/cldr/supplemental.js",
|
||||
"cldrjs/LICENSE-MIT": "cldrjs/LICENSE-MIT",
|
||||
|
||||
"globalize/globalize.js": "globalize/dist/globalize.js",
|
||||
"globalize/globalize/date.js": "globalize/dist/globalize/date.js",
|
||||
"globalize/globalize/message.js": "globalize/dist/globalize/message.js",
|
||||
"globalize/LICENSE.txt": "globalize/LICENSE.txt",
|
||||
|
||||
"qunit/qunit.js": "qunit/qunit/qunit.js",
|
||||
"qunit/qunit.css": "qunit/qunit/qunit.css",
|
||||
"qunit/LICENSE.txt": "qunit/LICENSE.txt",
|
||||
|
19
bower.json
19
bower.json
@ -14,11 +14,8 @@
|
||||
"jquery-mousewheel": "3.1.12",
|
||||
"jquery-simulate": "1.0.0",
|
||||
"jshint": "2.4.4",
|
||||
"qunit": "1.18.0",
|
||||
"qunit-assert-classes": "1.0.2",
|
||||
"qunit-assert-close": "JamesMGreene/qunit-assert-close#v1.1.1",
|
||||
"qunit-composite": "JamesMGreene/qunit-composite#v1.1.0",
|
||||
"requirejs": "2.1.14",
|
||||
"qunit": "1.17.1",
|
||||
"globalize": "1.0.0-alpha.6",
|
||||
|
||||
"jquery-1.7.0": "jquery#1.7.0",
|
||||
"jquery-1.7.1": "jquery#1.7.1",
|
||||
@ -32,18 +29,10 @@
|
||||
"jquery-1.10.0": "jquery#1.10.0",
|
||||
"jquery-1.10.1": "jquery#1.10.1",
|
||||
"jquery-1.10.2": "jquery#1.10.2",
|
||||
"jquery-1.11.0": "jquery#1.11.0",
|
||||
"jquery-1.11.1": "jquery#1.11.1",
|
||||
"jquery-1.11.2": "jquery#1.11.2",
|
||||
"jquery-1.11.3": "jquery#1.11.3",
|
||||
"jquery-1.x": "jquery#1.11.3",
|
||||
"jquery-1.x": "jquery#1.10.2",
|
||||
"jquery-2.0.0": "jquery#2.0.0",
|
||||
"jquery-2.0.1": "jquery#2.0.1",
|
||||
"jquery-2.0.2": "jquery#2.0.2",
|
||||
"jquery-2.0.3": "jquery#2.0.3",
|
||||
"jquery-2.1.0": "jquery#2.1.0",
|
||||
"jquery-2.1.1": "jquery#2.1.1",
|
||||
"jquery-2.1.2": "jquery#2.1.2",
|
||||
"jquery-2.1.3": "jquery#2.1.3"
|
||||
"jquery-2.0.3": "jquery#2.0.3"
|
||||
}
|
||||
}
|
||||
|
22
external/cldrjs/LICENSE-MIT/LICENSE-MIT
vendored
Normal file
22
external/cldrjs/LICENSE-MIT/LICENSE-MIT
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
Copyright (c) 2013 Rafael Xavier de Souza http://rafael.xavier.blog.br
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
549
external/cldrjs/cldr.js
vendored
Normal file
549
external/cldrjs/cldr.js
vendored
Normal file
@ -0,0 +1,549 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v0.3.8
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: 2014-07-13T05:05Z
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v0.3.8 2014-07-13T05:05Z MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
// AMD.
|
||||
define( factory );
|
||||
} else if ( typeof module === "object" && typeof module.exports === "object" ) {
|
||||
// Node. CommonJS.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
// Global
|
||||
root.Cldr = factory();
|
||||
}
|
||||
|
||||
}( 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 ) {
|
||||
return Object.prototype.toString.call( obj ) === "[object Array]";
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
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 ) {
|
||||
if ( arrayIsArray( path ) ) {
|
||||
path = path.join( "/" );
|
||||
}
|
||||
if ( typeof path !== "string" ) {
|
||||
throw new Error( "invalid path \"" + path + "\"" );
|
||||
}
|
||||
// 1: Ignore leading slash `/`
|
||||
// 2: Ignore leading `cldr/`
|
||||
path = path
|
||||
.replace( /^\// , "" ) /* 1 */
|
||||
.replace( /^cldr\// , "" ); /* 2 */
|
||||
|
||||
// Replace {attribute}'s
|
||||
path = path.replace( /{[a-zA-Z]+}/g, function( name ) {
|
||||
name = name.replace( /^{([^}]*)}$/, "$1" );
|
||||
return attributes[ name ];
|
||||
});
|
||||
|
||||
return path.split( "/" );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var arraySome = function( array, callback ) {
|
||||
var i, length;
|
||||
if ( array.some ) {
|
||||
return array.some( callback );
|
||||
}
|
||||
for ( i = 0, length = array.length; i < length; i++ ) {
|
||||
if ( callback( array[ i ], i, array ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return the maximized language id as defined in
|
||||
* http://www.unicode.org/reports/tr35/#Likely_Subtags
|
||||
* 1. Canonicalize.
|
||||
* 1.1 Make sure the input locale is in canonical form: uses the right
|
||||
* separator, and has the right casing.
|
||||
* TODO Right casing? What df? It seems languages are lowercase, scripts are
|
||||
* Capitalized, territory is uppercase. I am leaving this as an exercise to
|
||||
* the user.
|
||||
*
|
||||
* 1.2 Replace any deprecated subtags with their canonical values using the
|
||||
* <alias> data in supplemental metadata. Use the first value in the
|
||||
* replacement list, if it exists. Language tag replacements may have multiple
|
||||
* parts, such as "sh" ➞ "sr_Latn" or mo" ➞ "ro_MD". In such a case, the
|
||||
* original script and/or region are retained if there is one. Thus
|
||||
* "sh_Arab_AQ" ➞ "sr_Arab_AQ", not "sr_Latn_AQ".
|
||||
* TODO What <alias> data?
|
||||
*
|
||||
* 1.3 If the tag is grandfathered (see <variable id="$grandfathered"
|
||||
* type="choice"> in the supplemental data), then return it.
|
||||
* TODO grandfathered?
|
||||
*
|
||||
* 1.4 Remove the script code 'Zzzz' and the region code 'ZZ' if they occur.
|
||||
* 1.5 Get the components of the cleaned-up source tag (languages, scripts,
|
||||
* and regions), plus any variants and extensions.
|
||||
* 2. Lookup. Lookup each of the following in order, and stop on the first
|
||||
* match:
|
||||
* 2.1 languages_scripts_regions
|
||||
* 2.2 languages_regions
|
||||
* 2.3 languages_scripts
|
||||
* 2.4 languages
|
||||
* 2.5 und_scripts
|
||||
* 3. Return
|
||||
* 3.1 If there is no match, either return an error value, or the match for
|
||||
* "und" (in APIs where a valid language tag is required).
|
||||
* 3.2 Otherwise there is a match = languagem_scriptm_regionm
|
||||
* 3.3 Let xr = xs if xs is not empty, and xm otherwise.
|
||||
* 3.4 Return the language tag composed of languager _ scriptr _ regionr +
|
||||
* variants + extensions.
|
||||
*
|
||||
* @subtags [Array] normalized language id subtags tuple (see init.js).
|
||||
*/
|
||||
var coreLikelySubtags = function( Cldr, cldr, subtags, options ) {
|
||||
var match, matchFound,
|
||||
language = subtags[ 0 ],
|
||||
script = subtags[ 1 ],
|
||||
sep = Cldr.localeSep,
|
||||
territory = subtags[ 2 ];
|
||||
options = options || {};
|
||||
|
||||
// Skip if (language, script, territory) is not empty [3.3]
|
||||
if ( language !== "und" && script !== "Zzzz" && territory !== "ZZ" ) {
|
||||
return [ language, script, territory ];
|
||||
}
|
||||
|
||||
// Skip if no supplemental likelySubtags data is present
|
||||
if ( typeof cldr.get( "supplemental/likelySubtags" ) === "undefined" ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// [2]
|
||||
matchFound = arraySome([
|
||||
[ language, script, territory ],
|
||||
[ language, territory ],
|
||||
[ language, script ],
|
||||
[ language ],
|
||||
[ "und", script ]
|
||||
], function( test ) {
|
||||
return match = !(/\b(Zzzz|ZZ)\b/).test( test.join( sep ) ) /* [1.4] */ && cldr.get( [ "supplemental/likelySubtags", test.join( sep ) ] );
|
||||
});
|
||||
|
||||
// [3]
|
||||
if ( matchFound ) {
|
||||
// [3.2 .. 3.4]
|
||||
match = match.split( sep );
|
||||
return [
|
||||
language !== "und" ? language : match[ 0 ],
|
||||
script !== "Zzzz" ? script : match[ 1 ],
|
||||
territory !== "ZZ" ? territory : match[ 2 ]
|
||||
];
|
||||
} else if ( options.force ) {
|
||||
// [3.1.2]
|
||||
return cldr.get( "supplemental/likelySubtags/und" ).split( sep );
|
||||
} else {
|
||||
// [3.1.1]
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Given a locale, remove any fields that Add Likely Subtags would add.
|
||||
* http://www.unicode.org/reports/tr35/#Likely_Subtags
|
||||
* 1. First get max = AddLikelySubtags(inputLocale). If an error is signaled,
|
||||
* return it.
|
||||
* 2. Remove the variants from max.
|
||||
* 3. Then for trial in {language, language _ region, language _ script}. If
|
||||
* AddLikelySubtags(trial) = max, then return trial + variants.
|
||||
* 4. If you do not get a match, return max + variants.
|
||||
*
|
||||
* @maxLanguageId [Array] maxLanguageId tuple (see init.js).
|
||||
*/
|
||||
var coreRemoveLikelySubtags = function( Cldr, cldr, maxLanguageId ) {
|
||||
var match, matchFound,
|
||||
language = maxLanguageId[ 0 ],
|
||||
script = maxLanguageId[ 1 ],
|
||||
territory = maxLanguageId[ 2 ];
|
||||
|
||||
// [3]
|
||||
matchFound = arraySome([
|
||||
[ [ language, "Zzzz", "ZZ" ], [ language ] ],
|
||||
[ [ language, "Zzzz", territory ], [ language, territory ] ],
|
||||
[ [ language, script, "ZZ" ], [ language, script ] ]
|
||||
], function( test ) {
|
||||
var result = coreLikelySubtags( Cldr, cldr, test[ 0 ] );
|
||||
match = test[ 1 ];
|
||||
return result && result[ 0 ] === maxLanguageId[ 0 ] &&
|
||||
result[ 1 ] === maxLanguageId[ 1 ] &&
|
||||
result[ 2 ] === maxLanguageId[ 2 ];
|
||||
});
|
||||
|
||||
// [4]
|
||||
return matchFound ? match : maxLanguageId;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// @path: normalized path
|
||||
var resourceGet = function( data, path ) {
|
||||
var i,
|
||||
node = data,
|
||||
length = path.length;
|
||||
|
||||
for ( i = 0; i < length - 1; i++ ) {
|
||||
node = node[ path[ i ] ];
|
||||
if ( !node ) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
return node[ path[ i ] ];
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var itemGetResolved = function( Cldr, path, attributes ) {
|
||||
// Resolve path
|
||||
var normalizedPath = pathNormalize( path, attributes );
|
||||
|
||||
return resourceGet( Cldr._resolved, normalizedPath );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var alwaysArray = function( stringOrArray ) {
|
||||
return typeof stringOrArray === "string" ? [ stringOrArray ] : stringOrArray;
|
||||
};
|
||||
|
||||
|
||||
var jsonMerge = (function() {
|
||||
|
||||
// Returns new deeply merged JSON.
|
||||
//
|
||||
// Eg.
|
||||
// merge( { a: { b: 1, c: 2 } }, { a: { b: 3, d: 4 } } )
|
||||
// -> { a: { b: 3, c: 2, d: 4 } }
|
||||
//
|
||||
// @arguments JSON's
|
||||
//
|
||||
var merge = function() {
|
||||
var destination = {},
|
||||
sources = [].slice.call( arguments, 0 );
|
||||
arrayForEach( sources, function( source ) {
|
||||
var prop;
|
||||
for ( prop in source ) {
|
||||
if ( prop in destination && arrayIsArray( destination[ prop ] ) ) {
|
||||
|
||||
// Concat Arrays
|
||||
destination[ prop ] = destination[ prop ].concat( source[ prop ] );
|
||||
|
||||
} else if ( prop in destination && typeof destination[ prop ] === "object" ) {
|
||||
|
||||
// Merge Objects
|
||||
destination[ prop ] = merge( destination[ prop ], source[ prop ] );
|
||||
|
||||
} else {
|
||||
|
||||
// Set new values
|
||||
destination[ prop ] = source[ prop ];
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
return destination;
|
||||
};
|
||||
|
||||
return merge;
|
||||
|
||||
}());
|
||||
|
||||
|
||||
/**
|
||||
* new Cldr()
|
||||
*/
|
||||
var Cldr = function( locale ) {
|
||||
this.init( locale );
|
||||
};
|
||||
|
||||
// Build optimization hack to avoid duplicating functions across modules.
|
||||
Cldr._alwaysArray = alwaysArray;
|
||||
Cldr._createError = createError;
|
||||
Cldr._itemGetResolved = itemGetResolved;
|
||||
Cldr._jsonMerge = jsonMerge;
|
||||
Cldr._pathNormalize = pathNormalize;
|
||||
Cldr._resourceGet = resourceGet;
|
||||
Cldr._validatePresence = validatePresence;
|
||||
Cldr._validateType = validateType;
|
||||
Cldr._validateTypePath = validateTypePath;
|
||||
Cldr._validateTypePlainObject = validateTypePlainObject;
|
||||
|
||||
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.
|
||||
Cldr.localeSep = "-";
|
||||
|
||||
// Load resolved cldr data
|
||||
// @json [JSON]
|
||||
Cldr.load = function( json ) {
|
||||
validatePresence( json, "json" );
|
||||
validateTypePlainObject( json, "json" );
|
||||
Cldr._resolved = jsonMerge( Cldr._resolved, json );
|
||||
};
|
||||
|
||||
/**
|
||||
* .init() automatically run on instantiation/construction.
|
||||
*/
|
||||
Cldr.prototype.init = function( locale ) {
|
||||
var language, languageId, maxLanguageId, script, territory, unicodeLanguageId, variant,
|
||||
sep = Cldr.localeSep;
|
||||
|
||||
validatePresence( locale, "locale" );
|
||||
validateTypeString( locale, "locale" );
|
||||
|
||||
// Normalize locale code.
|
||||
// Get (or deduce) the "triple subtags": language, territory (also aliased as region), and script subtags.
|
||||
// Get the variant subtags (calendar, collation, currency, etc).
|
||||
// refs:
|
||||
// - http://www.unicode.org/reports/tr35/#Field_Definitions
|
||||
// - http://www.unicode.org/reports/tr35/#Language_and_Locale_IDs
|
||||
// - 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.
|
||||
maxLanguageId = coreLikelySubtags( Cldr, this, [ language, script, territory ], { force: true } ) || unicodeLanguageId.split( "_" );
|
||||
language = maxLanguageId[ 0 ];
|
||||
script = maxLanguageId[ 1 ];
|
||||
territory = maxLanguageId[ 2 ];
|
||||
|
||||
languageId = coreRemoveLikelySubtags( Cldr, this, maxLanguageId ).join( sep );
|
||||
|
||||
// Set attributes
|
||||
this.attributes = {
|
||||
|
||||
// Unicode Language Id
|
||||
languageId: languageId,
|
||||
maxLanguageId: maxLanguageId.join( sep ),
|
||||
|
||||
// Unicode Language Id Subtabs
|
||||
language: language,
|
||||
script: script,
|
||||
territory: territory,
|
||||
region: territory, /* alias */
|
||||
variant: variant
|
||||
};
|
||||
|
||||
this.locale = variant ? [ languageId, variant ].join( sep ) : languageId;
|
||||
};
|
||||
|
||||
/**
|
||||
* .get()
|
||||
*/
|
||||
Cldr.prototype.get = function( path ) {
|
||||
|
||||
validatePresence( path, "path" );
|
||||
validateTypePath( path, "path" );
|
||||
|
||||
return itemGetResolved( Cldr, path, this.attributes );
|
||||
};
|
||||
|
||||
/**
|
||||
* .main()
|
||||
*/
|
||||
Cldr.prototype.main = function( path ) {
|
||||
validatePresence( path, "path" );
|
||||
validateTypePath( path, "path" );
|
||||
|
||||
path = alwaysArray( path );
|
||||
return this.get( [ "main/{languageId}" ].concat( path ) );
|
||||
};
|
||||
|
||||
return Cldr;
|
||||
|
||||
|
||||
|
||||
}));
|
585
external/cldrjs/cldr/event.js
vendored
Normal file
585
external/cldrjs/cldr/event.js
vendored
Normal file
@ -0,0 +1,585 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v0.3.8
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: 2014-07-13T05:05Z
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v0.3.8 2014-07-13T05:05Z MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
(function( factory ) {
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
// AMD.
|
||||
define( [ "../cldr" ], factory );
|
||||
} else if ( typeof module === "object" && typeof module.exports === "object" ) {
|
||||
// Node. CommonJS.
|
||||
module.exports = factory( require( "cldrjs" ) );
|
||||
} else {
|
||||
// Global
|
||||
factory( Cldr );
|
||||
}
|
||||
|
||||
}(function( Cldr ) {
|
||||
|
||||
// Build optimization hack to avoid duplicating functions across modules.
|
||||
var pathNormalize = Cldr._pathNormalize,
|
||||
validatePresence = Cldr._validatePresence,
|
||||
validateType = Cldr._validateType;
|
||||
|
||||
|
||||
/*!
|
||||
* EventEmitter v4.2.7 - git.io/ee
|
||||
* Oliver Caldwell
|
||||
* MIT license
|
||||
* @preserve
|
||||
*/
|
||||
|
||||
var EventEmitter;
|
||||
/* jshint ignore:start */
|
||||
EventEmitter = (function () {
|
||||
|
||||
|
||||
/**
|
||||
* Class for managing events.
|
||||
* Can be extended to provide event functionality in other classes.
|
||||
*
|
||||
* @class EventEmitter Manages event registering and emitting.
|
||||
*/
|
||||
function EventEmitter() {}
|
||||
|
||||
// Shortcuts to improve speed and size
|
||||
var proto = EventEmitter.prototype;
|
||||
var exports = this;
|
||||
var originalGlobalValue = exports.EventEmitter;
|
||||
|
||||
/**
|
||||
* Finds the index of the listener for the event in it's storage array.
|
||||
*
|
||||
* @param {Function[]} listeners Array of listeners to search through.
|
||||
* @param {Function} listener Method to look for.
|
||||
* @return {Number} Index of the specified listener, -1 if not found
|
||||
* @api private
|
||||
*/
|
||||
function indexOfListener(listeners, listener) {
|
||||
var i = listeners.length;
|
||||
while (i--) {
|
||||
if (listeners[i].listener === listener) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias a method while keeping the context correct, to allow for overwriting of target method.
|
||||
*
|
||||
* @param {String} name The name of the target method.
|
||||
* @return {Function} The aliased method
|
||||
* @api private
|
||||
*/
|
||||
function alias(name) {
|
||||
return function aliasClosure() {
|
||||
return this[name].apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the listener array for the specified event.
|
||||
* Will initialise the event object and listener arrays if required.
|
||||
* Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.
|
||||
* Each property in the object response is an array of listener functions.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to return the listeners from.
|
||||
* @return {Function[]|Object} All listener functions for the event.
|
||||
*/
|
||||
proto.getListeners = function getListeners(evt) {
|
||||
var events = this._getEvents();
|
||||
var response;
|
||||
var key;
|
||||
|
||||
// Return a concatenated array of all matching events if
|
||||
// the selector is a regular expression.
|
||||
if (evt instanceof RegExp) {
|
||||
response = {};
|
||||
for (key in events) {
|
||||
if (events.hasOwnProperty(key) && evt.test(key)) {
|
||||
response[key] = events[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
response = events[evt] || (events[evt] = []);
|
||||
}
|
||||
|
||||
return response;
|
||||
};
|
||||
|
||||
/**
|
||||
* Takes a list of listener objects and flattens it into a list of listener functions.
|
||||
*
|
||||
* @param {Object[]} listeners Raw listener objects.
|
||||
* @return {Function[]} Just the listener functions.
|
||||
*/
|
||||
proto.flattenListeners = function flattenListeners(listeners) {
|
||||
var flatListeners = [];
|
||||
var i;
|
||||
|
||||
for (i = 0; i < listeners.length; i += 1) {
|
||||
flatListeners.push(listeners[i].listener);
|
||||
}
|
||||
|
||||
return flatListeners;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to return the listeners from.
|
||||
* @return {Object} All listener functions for an event in an object.
|
||||
*/
|
||||
proto.getListenersAsObject = function getListenersAsObject(evt) {
|
||||
var listeners = this.getListeners(evt);
|
||||
var response;
|
||||
|
||||
if (listeners instanceof Array) {
|
||||
response = {};
|
||||
response[evt] = listeners;
|
||||
}
|
||||
|
||||
return response || listeners;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a listener function to the specified event.
|
||||
* The listener will not be added if it is a duplicate.
|
||||
* If the listener returns true then it will be removed after it is called.
|
||||
* If you pass a regular expression as the event name then the listener will be added to all events that match it.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to attach the listener to.
|
||||
* @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.addListener = function addListener(evt, listener) {
|
||||
var listeners = this.getListenersAsObject(evt);
|
||||
var listenerIsWrapped = typeof listener === 'object';
|
||||
var key;
|
||||
|
||||
for (key in listeners) {
|
||||
if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {
|
||||
listeners[key].push(listenerIsWrapped ? listener : {
|
||||
listener: listener,
|
||||
once: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of addListener
|
||||
*/
|
||||
proto.on = alias('addListener');
|
||||
|
||||
/**
|
||||
* Semi-alias of addListener. It will add a listener that will be
|
||||
* automatically removed after it's first execution.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to attach the listener to.
|
||||
* @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.addOnceListener = function addOnceListener(evt, listener) {
|
||||
return this.addListener(evt, {
|
||||
listener: listener,
|
||||
once: true
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of addOnceListener.
|
||||
*/
|
||||
proto.once = alias('addOnceListener');
|
||||
|
||||
/**
|
||||
* Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.
|
||||
* You need to tell it what event names should be matched by a regex.
|
||||
*
|
||||
* @param {String} evt Name of the event to create.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.defineEvent = function defineEvent(evt) {
|
||||
this.getListeners(evt);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Uses defineEvent to define multiple events.
|
||||
*
|
||||
* @param {String[]} evts An array of event names to define.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.defineEvents = function defineEvents(evts) {
|
||||
for (var i = 0; i < evts.length; i += 1) {
|
||||
this.defineEvent(evts[i]);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes a listener function from the specified event.
|
||||
* When passed a regular expression as the event name, it will remove the listener from all events that match it.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to remove the listener from.
|
||||
* @param {Function} listener Method to remove from the event.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.removeListener = function removeListener(evt, listener) {
|
||||
var listeners = this.getListenersAsObject(evt);
|
||||
var index;
|
||||
var key;
|
||||
|
||||
for (key in listeners) {
|
||||
if (listeners.hasOwnProperty(key)) {
|
||||
index = indexOfListener(listeners[key], listener);
|
||||
|
||||
if (index !== -1) {
|
||||
listeners[key].splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of removeListener
|
||||
*/
|
||||
proto.off = alias('removeListener');
|
||||
|
||||
/**
|
||||
* Adds listeners in bulk using the manipulateListeners method.
|
||||
* If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.
|
||||
* You can also pass it a regular expression to add the array of listeners to all events that match it.
|
||||
* Yeah, this function does quite a bit. That's probably a bad thing.
|
||||
*
|
||||
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.
|
||||
* @param {Function[]} [listeners] An optional array of listener functions to add.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.addListeners = function addListeners(evt, listeners) {
|
||||
// Pass through to manipulateListeners
|
||||
return this.manipulateListeners(false, evt, listeners);
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes listeners in bulk using the manipulateListeners method.
|
||||
* If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
|
||||
* You can also pass it an event name and an array of listeners to be removed.
|
||||
* You can also pass it a regular expression to remove the listeners from all events that match it.
|
||||
*
|
||||
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.
|
||||
* @param {Function[]} [listeners] An optional array of listener functions to remove.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.removeListeners = function removeListeners(evt, listeners) {
|
||||
// Pass through to manipulateListeners
|
||||
return this.manipulateListeners(true, evt, listeners);
|
||||
};
|
||||
|
||||
/**
|
||||
* Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.
|
||||
* The first argument will determine if the listeners are removed (true) or added (false).
|
||||
* If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
|
||||
* You can also pass it an event name and an array of listeners to be added/removed.
|
||||
* You can also pass it a regular expression to manipulate the listeners of all events that match it.
|
||||
*
|
||||
* @param {Boolean} remove True if you want to remove listeners, false if you want to add.
|
||||
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.
|
||||
* @param {Function[]} [listeners] An optional array of listener functions to add/remove.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
|
||||
var i;
|
||||
var value;
|
||||
var single = remove ? this.removeListener : this.addListener;
|
||||
var multiple = remove ? this.removeListeners : this.addListeners;
|
||||
|
||||
// If evt is an object then pass each of it's properties to this method
|
||||
if (typeof evt === 'object' && !(evt instanceof RegExp)) {
|
||||
for (i in evt) {
|
||||
if (evt.hasOwnProperty(i) && (value = evt[i])) {
|
||||
// Pass the single listener straight through to the singular method
|
||||
if (typeof value === 'function') {
|
||||
single.call(this, i, value);
|
||||
}
|
||||
else {
|
||||
// Otherwise pass back to the multiple function
|
||||
multiple.call(this, i, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// So evt must be a string
|
||||
// And listeners must be an array of listeners
|
||||
// Loop over it and pass each one to the multiple method
|
||||
i = listeners.length;
|
||||
while (i--) {
|
||||
single.call(this, evt, listeners[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes all listeners from a specified event.
|
||||
* If you do not specify an event then all listeners will be removed.
|
||||
* That means every event will be emptied.
|
||||
* You can also pass a regex to remove all events that match it.
|
||||
*
|
||||
* @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.removeEvent = function removeEvent(evt) {
|
||||
var type = typeof evt;
|
||||
var events = this._getEvents();
|
||||
var key;
|
||||
|
||||
// Remove different things depending on the state of evt
|
||||
if (type === 'string') {
|
||||
// Remove all listeners for the specified event
|
||||
delete events[evt];
|
||||
}
|
||||
else if (evt instanceof RegExp) {
|
||||
// Remove all events matching the regex.
|
||||
for (key in events) {
|
||||
if (events.hasOwnProperty(key) && evt.test(key)) {
|
||||
delete events[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Remove all listeners in all events
|
||||
delete this._events;
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of removeEvent.
|
||||
*
|
||||
* Added to mirror the node API.
|
||||
*/
|
||||
proto.removeAllListeners = alias('removeEvent');
|
||||
|
||||
/**
|
||||
* Emits an event of your choice.
|
||||
* When emitted, every listener attached to that event will be executed.
|
||||
* If you pass the optional argument array then those arguments will be passed to every listener upon execution.
|
||||
* Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
|
||||
* So they will not arrive within the array on the other side, they will be separate.
|
||||
* You can also pass a regular expression to emit to all events that match it.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to emit and execute listeners for.
|
||||
* @param {Array} [args] Optional array of arguments to be passed to each listener.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.emitEvent = function emitEvent(evt, args) {
|
||||
var listeners = this.getListenersAsObject(evt);
|
||||
var listener;
|
||||
var i;
|
||||
var key;
|
||||
var response;
|
||||
|
||||
for (key in listeners) {
|
||||
if (listeners.hasOwnProperty(key)) {
|
||||
i = listeners[key].length;
|
||||
|
||||
while (i--) {
|
||||
// If the listener returns true then it shall be removed from the event
|
||||
// The function is executed either with a basic call or an apply if there is an args array
|
||||
listener = listeners[key][i];
|
||||
|
||||
if (listener.once === true) {
|
||||
this.removeListener(evt, listener.listener);
|
||||
}
|
||||
|
||||
response = listener.listener.apply(this, args || []);
|
||||
|
||||
if (response === this._getOnceReturnValue()) {
|
||||
this.removeListener(evt, listener.listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of emitEvent
|
||||
*/
|
||||
proto.trigger = alias('emitEvent');
|
||||
|
||||
/**
|
||||
* Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.
|
||||
* As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.
|
||||
*
|
||||
* @param {String|RegExp} evt Name of the event to emit and execute listeners for.
|
||||
* @param {...*} Optional additional arguments to be passed to each listener.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.emit = function emit(evt) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
return this.emitEvent(evt, args);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the current value to check against when executing listeners. If a
|
||||
* listeners return value matches the one set here then it will be removed
|
||||
* after execution. This value defaults to true.
|
||||
*
|
||||
* @param {*} value The new value to check for when executing listeners.
|
||||
* @return {Object} Current instance of EventEmitter for chaining.
|
||||
*/
|
||||
proto.setOnceReturnValue = function setOnceReturnValue(value) {
|
||||
this._onceReturnValue = value;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetches the current value to check against when executing listeners. If
|
||||
* the listeners return value matches this one then it should be removed
|
||||
* automatically. It will return true by default.
|
||||
*
|
||||
* @return {*|Boolean} The current value to check for or the default, true.
|
||||
* @api private
|
||||
*/
|
||||
proto._getOnceReturnValue = function _getOnceReturnValue() {
|
||||
if (this.hasOwnProperty('_onceReturnValue')) {
|
||||
return this._onceReturnValue;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetches the events object and creates one if required.
|
||||
*
|
||||
* @return {Object} The events storage object.
|
||||
* @api private
|
||||
*/
|
||||
proto._getEvents = function _getEvents() {
|
||||
return this._events || (this._events = {});
|
||||
};
|
||||
|
||||
/**
|
||||
* Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.
|
||||
*
|
||||
* @return {Function} Non conflicting EventEmitter class.
|
||||
*/
|
||||
EventEmitter.noConflict = function noConflict() {
|
||||
exports.EventEmitter = originalGlobalValue;
|
||||
return EventEmitter;
|
||||
};
|
||||
|
||||
return EventEmitter;
|
||||
}());
|
||||
/* jshint ignore:end */
|
||||
|
||||
|
||||
|
||||
var validateTypeFunction = function( value, name ) {
|
||||
validateType( value, name, typeof value === "undefined" || typeof value === "function", "Function" );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var superGet, superInit,
|
||||
globalEe = new EventEmitter();
|
||||
|
||||
function validateTypeEvent( value, name ) {
|
||||
validateType( value, name, typeof value === "string" || value instanceof RegExp, "String or RegExp" );
|
||||
}
|
||||
|
||||
function validateThenCall( method, self ) {
|
||||
return function( event, listener ) {
|
||||
validatePresence( event, "event" );
|
||||
validateTypeEvent( event, "event" );
|
||||
|
||||
validatePresence( listener, "listener" );
|
||||
validateTypeFunction( listener, "listener" );
|
||||
|
||||
return self[ method ].apply( self, arguments );
|
||||
};
|
||||
}
|
||||
|
||||
function off( self ) {
|
||||
return validateThenCall( "off", self );
|
||||
}
|
||||
|
||||
function on( self ) {
|
||||
return validateThenCall( "on", self );
|
||||
}
|
||||
|
||||
function once( self ) {
|
||||
return validateThenCall( "once", self );
|
||||
}
|
||||
|
||||
Cldr.off = off( globalEe );
|
||||
Cldr.on = on( globalEe );
|
||||
Cldr.once = once( globalEe );
|
||||
|
||||
/**
|
||||
* Overload Cldr.prototype.init().
|
||||
*/
|
||||
superInit = Cldr.prototype.init;
|
||||
Cldr.prototype.init = function() {
|
||||
var ee;
|
||||
this.ee = ee = new EventEmitter();
|
||||
this.off = off( ee );
|
||||
this.on = on( ee );
|
||||
this.once = once( ee );
|
||||
superInit.apply( this, arguments );
|
||||
};
|
||||
|
||||
/**
|
||||
* getOverload is encapsulated, because of cldr/unresolved. If it's loaded
|
||||
* after cldr/event (and note it overwrites .get), it can trigger this
|
||||
* overload again.
|
||||
*/
|
||||
function getOverload() {
|
||||
|
||||
/**
|
||||
* Overload Cldr.prototype.get().
|
||||
*/
|
||||
superGet = Cldr.prototype.get;
|
||||
Cldr.prototype.get = function( path ) {
|
||||
var value = superGet.apply( this, arguments );
|
||||
path = pathNormalize( path, this.attributes ).join( "/" );
|
||||
globalEe.trigger( "get", [ path, value ] );
|
||||
this.ee.trigger( "get", [ path, value ] );
|
||||
return value;
|
||||
};
|
||||
}
|
||||
|
||||
Cldr._eventInit = getOverload;
|
||||
getOverload();
|
||||
|
||||
return Cldr;
|
||||
|
||||
|
||||
|
||||
}));
|
101
external/cldrjs/cldr/supplemental.js
vendored
Normal file
101
external/cldrjs/cldr/supplemental.js
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
/**
|
||||
* CLDR JavaScript Library v0.3.8
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2013 Rafael Xavier de Souza
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: 2014-07-13T05:05Z
|
||||
*/
|
||||
/*!
|
||||
* CLDR JavaScript Library v0.3.8 2014-07-13T05:05Z MIT license © Rafael Xavier
|
||||
* http://git.io/h4lmVg
|
||||
*/
|
||||
(function( factory ) {
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
// AMD.
|
||||
define( [ "../cldr" ], factory );
|
||||
} else if ( typeof module === "object" && typeof module.exports === "object" ) {
|
||||
// Node. CommonJS.
|
||||
module.exports = factory( require( "cldrjs" ) );
|
||||
} else {
|
||||
// Global
|
||||
factory( Cldr );
|
||||
}
|
||||
|
||||
}(function( Cldr ) {
|
||||
|
||||
// Build optimization hack to avoid duplicating functions across modules.
|
||||
var alwaysArray = Cldr._alwaysArray;
|
||||
|
||||
|
||||
|
||||
|
||||
var supplementalMain = function( cldr ) {
|
||||
|
||||
var prepend, supplemental;
|
||||
|
||||
prepend = function( prepend ) {
|
||||
return function( path ) {
|
||||
path = alwaysArray( path );
|
||||
return cldr.get( [ prepend ].concat( path ) );
|
||||
};
|
||||
};
|
||||
|
||||
supplemental = prepend( "supplemental" );
|
||||
|
||||
// Week Data
|
||||
// http://www.unicode.org/reports/tr35/tr35-dates.html#Week_Data
|
||||
supplemental.weekData = prepend( "supplemental/weekData" );
|
||||
|
||||
supplemental.weekData.firstDay = function() {
|
||||
return cldr.get( "supplemental/weekData/firstDay/{territory}" ) ||
|
||||
cldr.get( "supplemental/weekData/firstDay/001" );
|
||||
};
|
||||
|
||||
supplemental.weekData.minDays = function() {
|
||||
var minDays = cldr.get( "supplemental/weekData/minDays/{territory}" ) ||
|
||||
cldr.get( "supplemental/weekData/minDays/001" );
|
||||
return parseInt( minDays, 10 );
|
||||
};
|
||||
|
||||
// Time Data
|
||||
// http://www.unicode.org/reports/tr35/tr35-dates.html#Time_Data
|
||||
supplemental.timeData = prepend( "supplemental/timeData" );
|
||||
|
||||
supplemental.timeData.allowed = function() {
|
||||
return cldr.get( "supplemental/timeData/{territory}/_allowed" ) ||
|
||||
cldr.get( "supplemental/timeData/001/_allowed" );
|
||||
};
|
||||
|
||||
supplemental.timeData.preferred = function() {
|
||||
return cldr.get( "supplemental/timeData/{territory}/_preferred" ) ||
|
||||
cldr.get( "supplemental/timeData/001/_preferred" );
|
||||
};
|
||||
|
||||
return supplemental;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var initSuper = Cldr.prototype.init;
|
||||
|
||||
/**
|
||||
* .init() automatically ran on construction.
|
||||
*
|
||||
* Overload .init().
|
||||
*/
|
||||
Cldr.prototype.init = function() {
|
||||
initSuper.apply( this, arguments );
|
||||
this.supplemental = supplementalMain( this );
|
||||
};
|
||||
|
||||
return Cldr;
|
||||
|
||||
|
||||
|
||||
}));
|
8
external/date.js
vendored
8
external/date.js
vendored
@ -121,7 +121,7 @@ $.date.prototype = {
|
||||
return 32 - new Date( year, month, 32 ).getDate();
|
||||
},
|
||||
monthName: function() {
|
||||
return Globalize.format( this.dateObject, { pattern: "MMMM" } );
|
||||
return Globalize.formatDate( this.dateObject, { pattern: "MMMM" } );
|
||||
},
|
||||
day: function() {
|
||||
return this.dateObject.getDate();
|
||||
@ -157,7 +157,7 @@ $.date.prototype = {
|
||||
printDate = new Date( this.year(), date.getMonth(), 1 - leadDays );
|
||||
for ( var row = 0; row < rows; row++ ) {
|
||||
var week = result[ result.length ] = {
|
||||
number: Globalize.format( printDate, { pattern: "w" } ),
|
||||
number: Globalize.formatDate( printDate, { pattern: "w" } ),
|
||||
days: []
|
||||
};
|
||||
for ( var dayx = 0; dayx < 7; dayx++ ) {
|
||||
@ -202,7 +202,7 @@ $.date.prototype = {
|
||||
// TODO compare year, month, day each for better performance
|
||||
equal: function( other ) {
|
||||
function format( date ) {
|
||||
return Globalize.format( date, { pattern: "yyyyMMdd" } );
|
||||
return Globalize.formatDate( date, { pattern: "yyyyMMdd" } );
|
||||
}
|
||||
return format( this.dateObject ) === format( other );
|
||||
},
|
||||
@ -210,7 +210,7 @@ $.date.prototype = {
|
||||
return this.dateObject;
|
||||
},
|
||||
format: function( format ) {
|
||||
return Globalize.format( this.dateObject, format || this.globalFormat );
|
||||
return Globalize.formatDate( this.dateObject, format || this.globalFormat );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,14 @@
|
||||
Copyright Software Freedom Conservancy, Inc.
|
||||
http://jquery.org/license
|
||||
Copyright 2010, 2014 jQuery Foundation and other contributors,
|
||||
https://jquery.org/
|
||||
|
||||
This software consists of voluntary contributions made by many
|
||||
individuals. For exact contribution history, see the revision history
|
||||
available at https://github.com/jquery/globalize
|
||||
|
||||
The following license applies to all parts of this software except as
|
||||
documented below:
|
||||
|
||||
====
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
@ -19,3 +28,17 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
====
|
||||
|
||||
Copyright and related rights for sample code are waived via CC0. Sample
|
||||
code is defined as all source code contained within the doc directory.
|
||||
|
||||
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
====
|
||||
|
||||
All files located in the node_modules and external directories are
|
||||
externally maintained libraries used by this software which have their
|
||||
own licenses; we recommend you read them, as their terms may differ from
|
||||
the terms above.
|
1960
external/globalize/globalize.js
vendored
1960
external/globalize/globalize.js
vendored
File diff suppressed because it is too large
Load Diff
1254
external/globalize/globalize/date.js
vendored
Normal file
1254
external/globalize/globalize/date.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
86
external/globalize/globalize/message.js
vendored
Normal file
86
external/globalize/globalize/message.js
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
/*!
|
||||
* Globalize v1.0.0-alpha.6
|
||||
*
|
||||
* http://github.com/jquery/globalize
|
||||
*
|
||||
* Copyright 2010, 2014 jQuery Foundation, Inc. and other contributors
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: 2014-09-01T21:32Z
|
||||
*/
|
||||
(function( root, factory ) {
|
||||
|
||||
// UMD returnExports
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD
|
||||
define([
|
||||
"cldr",
|
||||
"../globalize"
|
||||
], factory );
|
||||
} else if ( typeof exports === "object" ) {
|
||||
|
||||
// Node, CommonJS
|
||||
module.exports = factory( require( "cldrjs" ), require( "globalize" ) );
|
||||
} else {
|
||||
|
||||
// Extend global
|
||||
factory( root.Cldr, root.Globalize );
|
||||
}
|
||||
}(this, function( Cldr, Globalize ) {
|
||||
|
||||
var alwaysArray = Globalize._alwaysArray,
|
||||
validateDefaultLocale = Globalize._validateDefaultLocale,
|
||||
validateParameterPresence = Globalize._validateParameterPresence,
|
||||
validateParameterType = Globalize._validateParameterType,
|
||||
validateParameterTypePlainObject = Globalize._validateParameterTypePlainObject;
|
||||
|
||||
|
||||
/**
|
||||
* .loadTranslations( json )
|
||||
*
|
||||
* @json [JSON]
|
||||
*
|
||||
* Load translation data.
|
||||
*/
|
||||
Globalize.loadTranslations = function( json ) {
|
||||
var customData = {
|
||||
"globalize-translations": json
|
||||
};
|
||||
|
||||
validateParameterPresence( json, "json" );
|
||||
validateParameterTypePlainObject( json, "json" );
|
||||
|
||||
Cldr.load( customData );
|
||||
};
|
||||
|
||||
/**
|
||||
* .translate( path )
|
||||
*
|
||||
* @path [String or Array]
|
||||
*
|
||||
* Translate item given its path.
|
||||
*/
|
||||
Globalize.translate =
|
||||
Globalize.prototype.translate = function( path ) {
|
||||
var cldr;
|
||||
|
||||
validateParameterPresence( path, "path" );
|
||||
validateParameterType( path, "path", typeof path === "string" || Array.isArray( path ),
|
||||
"a String nor an Array" );
|
||||
|
||||
path = alwaysArray( path );
|
||||
cldr = this.cldr;
|
||||
|
||||
validateDefaultLocale( cldr );
|
||||
|
||||
return cldr.get( [ "globalize-translations/{languageId}" ].concat( path ) );
|
||||
};
|
||||
|
||||
return Globalize;
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
3409
external/localization.js
vendored
3409
external/localization.js
vendored
File diff suppressed because it is too large
Load Diff
@ -4,9 +4,41 @@
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Datepicker Test Suite</title>
|
||||
|
||||
<script src="../../../external/requirejs/require.js"></script>
|
||||
<script src="../../lib/css.js" data-modules="core calendar datepicker"></script>
|
||||
<script src="../../lib/bootstrap.js" data-widget="datepicker"></script>
|
||||
<script src="../../jquery.js"></script>
|
||||
<link rel="stylesheet" href="../../../external/qunit/qunit.css">
|
||||
<script src="../../../external/qunit/qunit.js"></script>
|
||||
<script src="../../../external/jquery-simulate/jquery.simulate.js"></script>
|
||||
<script src="../../../external/cldrjs/cldr.js"></script>
|
||||
<script src="../../../external/cldrjs/cldr/supplemental.js"></script>
|
||||
<script src="../../../external/cldrjs/cldr/event.js"></script>
|
||||
<script src="../../../external/globalize/globalize.js"></script>
|
||||
<script src="../../../external/globalize/globalize/date.js"></script>
|
||||
<script src="../../../external/globalize/globalize/message.js"></script>
|
||||
<script src="../../../external/localization.js"></script>
|
||||
<script src="../../../external/date.js"></script>
|
||||
<script src="../testsuite.js"></script>
|
||||
<script>
|
||||
TestHelpers.loadResources({
|
||||
css: [ "core", "calendar", "datepicker" ],
|
||||
js: [
|
||||
"ui/core.js",
|
||||
"ui/widget.js",
|
||||
"ui/button.js",
|
||||
"ui/calendar.js",
|
||||
"ui/position.js",
|
||||
"ui/datepicker.js"
|
||||
]
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="datepicker_common.js"></script>
|
||||
<script src="datepicker_core.js"></script>
|
||||
<script src="datepicker_events.js"></script>
|
||||
<script src="datepicker_methods.js"></script>
|
||||
<script src="datepicker_options.js"></script>
|
||||
<script src="datepicker_test_helpers.js"></script>
|
||||
|
||||
<script src="../swarminject.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
@ -515,7 +515,7 @@ return $.widget( "ui.calendar", {
|
||||
if ( arguments.length ) {
|
||||
this.valueAsDate( Globalize.parseDate( value, this.options.dateFormat ) );
|
||||
} else {
|
||||
return Globalize.format( this.option( "value" ), this.options.dateFormat );
|
||||
return Globalize.formatDate( this.option( "value" ), this.options.dateFormat );
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -285,7 +285,7 @@ var widget = $.widget( "ui.datepicker", {
|
||||
if ( arguments.length ) {
|
||||
if ( this.calendarInstance._isValid( value ) ) {
|
||||
this.calendarInstance.valueAsDate( value );
|
||||
this.element.val( Globalize.format( value, this.options.dateFormat ) );
|
||||
this.element.val( Globalize.formatDate( value, this.options.dateFormat ) );
|
||||
}
|
||||
} else {
|
||||
return this._getParsedValue();
|
||||
|
Loading…
Reference in New Issue
Block a user