diff options
author | Rafael Xavier de Souza <rxaviers@gmail.com> | 2013-11-30 10:22:17 -0200 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2015-01-29 17:47:48 -0500 |
commit | ffc8ab2710c2cf9769cbdc8b253e7a82e9e8a53f (patch) | |
tree | cc18b1738fa47a6e24c448ba79e625ceb995121b | |
parent | ff4bfd643d4f30eb171ab8e40600fe8963ddfb1b (diff) | |
download | jquery-ui-ffc8ab2710c2cf9769cbdc8b253e7a82e9e8a53f.tar.gz jquery-ui-ffc8ab2710c2cf9769cbdc8b253e7a82e9e8a53f.zip |
Datepicker: Use Globalize 1.0.0
-rw-r--r-- | demos/datepicker/date-formats.html | 25 | ||||
-rw-r--r-- | demos/datepicker/localization.html | 9 | ||||
-rw-r--r-- | demos/datepicker/show-week.html | 10 | ||||
-rw-r--r-- | external/date.js | 73 | ||||
-rw-r--r-- | external/globalize/globalize.culture.de-DE.js | 81 | ||||
-rw-r--r-- | external/globalize/globalize.culture.ja-JP.js | 100 | ||||
-rw-r--r-- | external/globalize/globalize.js | 3049 | ||||
-rw-r--r-- | external/localization.js | 3545 | ||||
-rw-r--r-- | tests/unit/date/date.html | 6 | ||||
-rw-r--r-- | tests/unit/date/date_core.js | 90 | ||||
-rw-r--r-- | tests/unit/datepicker/datepicker.html | 6 | ||||
-rw-r--r-- | tests/unit/datepicker/datepicker_core.js | 12 | ||||
-rw-r--r-- | tests/unit/datepicker/datepicker_methods.js | 12 | ||||
-rw-r--r-- | tests/unit/datepicker/datepicker_options.js | 8 | ||||
-rw-r--r-- | ui/datepicker.js | 28 |
15 files changed, 4855 insertions, 2199 deletions
diff --git a/demos/datepicker/date-formats.html b/demos/datepicker/date-formats.html index 1b8874f8c..2c5045b6f 100644 --- a/demos/datepicker/date-formats.html +++ b/demos/datepicker/date-formats.html @@ -18,7 +18,24 @@ $(function() { $( "#datepicker" ).datepicker(); $( "#format" ).change(function() { - $( "#datepicker" ).datepicker( "option", "dateFormat", $( this ).val() ); + var format; + switch( $( this ).val() ) { + case "short": + $( "#datepicker" ).datepicker( "option", "dateFormat", { + date: "short" + }); + break; + case "long": + $( "#datepicker" ).datepicker( "option", "dateFormat", { + date: "long" + }); + break; + case "iso": + $( "#datepicker" ).datepicker( "option", "dateFormat", { + pattern: "yyyy-MM-dd" + }); + break; + } }); }); </script> @@ -29,9 +46,9 @@ <p>Format options:<br /> <select id="format"> - <option value="d">Default - M/d/yyyy</option> - <option value="D">Long - dddd, MMMM dd, yyyy</option> - <option value="yyyy-MM-dd">ISO 8601 - yyyy-MM-dd</option> + <option value="short">Short - M/d/yy in "en" locale</option> + <option value="long">Long - MMMM d, y in "en" locale</option> + <option value="iso">ISO 8601 - yyyy-MM-dd</option> </select> </p> diff --git a/demos/datepicker/localization.html b/demos/datepicker/localization.html index b8c99547b..61aa7c9a2 100644 --- a/demos/datepicker/localization.html +++ b/demos/datepicker/localization.html @@ -6,8 +6,6 @@ <link rel="stylesheet" href="../../themes/base/all.css"> <script src="../../external/jquery/jquery.js"></script> <script src="../../external/globalize/globalize.js"></script> - <script src="../../external/globalize/globalize.culture.de-DE.js"></script> - <script src="../../external/globalize/globalize.culture.ja-JP.js"></script> <script src="../../external/date.js"></script> <script src="../../external/localization.js"></script> <script src="../../ui/core.js"></script> @@ -18,11 +16,11 @@ <link rel="stylesheet" href="../demos.css"> <script> $(function() { - Globalize.culture( "de-DE" ); + Globalize.locale( "de-DE" ); $( "#datepicker" ).datepicker(); $( "#locale" ).change(function() { - // TODO refresh the current value to convert to the selected culture - Globalize.culture( $(this).val() ); + // TODO refresh the current value to convert to the selected locale + Globalize.locale( $(this).val() ); }); }); </script> @@ -32,7 +30,6 @@ <p>Date: <input type="text" id="datepicker"/> <select id="locale"> <option value="de-DE" selected>German (Deutsch)</option> - <option value="ja-JP">Japanese (日本語</option> <option value="en">English</option> </select></p> diff --git a/demos/datepicker/show-week.html b/demos/datepicker/show-week.html index e9a33d8da..c7faf1020 100644 --- a/demos/datepicker/show-week.html +++ b/demos/datepicker/show-week.html @@ -17,8 +17,7 @@ <script> $(function() { $( "#datepicker" ).datepicker({ - showWeek: true, - firstDay: 1 + showWeek: true }); }); </script> @@ -28,10 +27,9 @@ <p>Date: <input type="text" id="datepicker"></p> <div class="demo-description"> -<p>The datepicker can show the week of the year. The default calculation follows - the ISO 8601 definition: the week starts on Monday, the first week of the year - contains the first Thursday of the year. This means that some days from one - year may be placed into weeks 'belonging' to another year.</p> +<p>The datepicker can show the week of the year. The calculation follows + <a href="http://www.unicode.org/reports/tr35 /tr35-dates.html#Date_Field_Symbol_Table">Unicode CLDR specification</a>. + This means that some days from one year may be placed into weeks 'belonging' to another year.</p> </div> </body> </html> diff --git a/external/date.js b/external/date.js index fef4dcaef..b8d1ef30d 100644 --- a/external/date.js +++ b/external/date.js @@ -6,25 +6,31 @@ */ (function( $, undefined ) { -$.date = function( datestring, formatstring ) { - //TODO: Need to refactor $.date to be a constructor, move the methods to a prototype. - var calendar = Globalize.culture().calendar, - format = formatstring ? formatstring : calendar.patterns.d, - date = datestring ? Globalize.parseDate( datestring, format ) : new Date(); +var weekdays = [ "sun", "mon", "tue", "wed", "thu", "fri", "sat" ], + weekdaysRev = { + "sun": 0, + "mon": 1, + "tue": 2, + "wed": 3, + "thu": 4, + "fri": 5, + "sat": 6 + }; + +Globalize.locale( "en" ); - if ( !date ) { - date = new Date(); +$.date = function( date, globalFormat ) { + //TODO: Need to refactor $.date to be a constructor, move the methods to a prototype. + if ( typeof date === "string" && date.length ) { + date = Globalize.parseDate( date, globalFormat ); } + date = date || new Date(); + return { - refresh: function() { - calendar = Globalize.culture().calendar; - format = formatstring || calendar.patterns.d; - return this; - }, - setFormat: function( formatstring ) { - if ( formatstring ) { - format = formatstring; + setFormat: function( format ) { + if ( format ) { + globalFormat = format; } return this; }, @@ -82,7 +88,7 @@ $.date = function( datestring, formatstring ) { return 32 - new Date( year, month, 32 ).getDate(); }, monthName: function() { - return calendar.months.names[ date.getMonth() ]; + return Globalize.format( date, { pattern: "MMMM" } ); }, day: function() { return date.getDate(); @@ -101,10 +107,10 @@ $.date = function( datestring, formatstring ) { weekdays: function() { var result = []; for ( var dow = 0; dow < 7; dow++ ) { - var day = ( dow + calendar.firstDay ) % 7; + var day = ( dow + weekdaysRev[ Globalize.locale().supplemental.weekData.firstDay() ] ) % 7; result.push({ - shortname: calendar.days.namesShort[ day ], - fullname: calendar.days.names[ day ] + shortname: Globalize.locale().main([ "dates/calendars/gregorian/days/format/abbreviated", weekdays[ day ] ]), + fullname: Globalize.locale().main([ "dates/calendars/gregorian/days/format/wide", weekdays[ day ] ]), }); } return result; @@ -113,12 +119,12 @@ $.date = function( datestring, formatstring ) { var result = [], today = $.date(), firstDayOfMonth = new Date( this.year(), date.getMonth(), 1 ).getDay(), - leadDays = ( firstDayOfMonth - calendar.firstDay + 7 ) % 7, + leadDays = ( firstDayOfMonth - weekdaysRev[ Globalize.locale().supplemental.weekData.firstDay() ] + 7 ) % 7, rows = Math.ceil( ( leadDays + this.daysInMonth() ) / 7 ), printDate = new Date( this.year(), date.getMonth(), 1 - leadDays ); for ( var row = 0; row < rows; row++ ) { var week = result[ result.length ] = { - number: this.iso8601Week( printDate ), + number: Globalize.format( printDate, { pattern: "w" } ), days: [] }; for ( var dayx = 0; dayx < 7; dayx++ ) { @@ -153,16 +159,6 @@ $.date = function( datestring, formatstring ) { result[ result.length - 1 ].last = true; return result; }, - iso8601Week: function(date) { - var checkDate = new Date( date.getTime() ); - // Find Thursday of this week starting on Monday - checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) ); - var time = checkDate.getTime(); - // Compare with Jan 1 - checkDate.setMonth( 0 ); - checkDate.setDate( 1 ); - return Math.floor( Math.round( ( time - checkDate ) / 86400000) / 7 ) + 1; - }, select: function() { this.selected = this.clone(); return this; @@ -170,27 +166,20 @@ $.date = function( datestring, formatstring ) { clone: function() { return $.date( new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), - date.getMinutes(), date.getSeconds()), formatstring ); + date.getMinutes(), date.getSeconds()), globalFormat ); }, // TODO compare year, month, day each for better performance equal: function( other ) { function format( date ) { - return Globalize.format( date, "d" ); + return Globalize.format( date, { pattern: "yyyyMMdd" } ); } return format( date ) === format( other ); }, date: function() { return date; }, - format: function( formatstring ) { - return Globalize.format( date, formatstring ? formatstring : format ); - }, - calendar: function( newcalendar ) { - if ( newcalendar ) { - calendar = newcalendar; - return this; - } - return calendar; + format: function( format ) { + return Globalize.format( date, format || globalFormat ); } }; }; diff --git a/external/globalize/globalize.culture.de-DE.js b/external/globalize/globalize.culture.de-DE.js deleted file mode 100644 index 5466bd75e..000000000 --- a/external/globalize/globalize.culture.de-DE.js +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Globalize Culture de-DE - * - * http://github.com/jquery/globalize - * - * Copyright Software Freedom Conservancy, Inc. - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * This file was generated by the Globalize Culture Generator - * Translation: bugs found in this file need to be fixed in the generator - */ - -(function( window, undefined ) { - -var Globalize; - -if ( typeof require !== "undefined" - && typeof exports !== "undefined" - && typeof module !== "undefined" ) { - // Assume CommonJS - Globalize = require( "globalize" ); -} else { - // Global variable - Globalize = window.Globalize; -} - -Globalize.addCultureInfo( "de-DE", "default", { - name: "de-DE", - englishName: "German (Germany)", - nativeName: "Deutsch (Deutschland)", - language: "de", - numberFormat: { - ",": ".", - ".": ",", - NaN: "n. def.", - negativeInfinity: "-unendlich", - positiveInfinity: "+unendlich", - percent: { - pattern: ["-n%","n%"], - ",": ".", - ".": "," - }, - currency: { - pattern: ["-n $","n $"], - ",": ".", - ".": ",", - symbol: "€" - } - }, - calendars: { - standard: { - "/": ".", - firstDay: 1, - days: { - names: ["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"], - namesAbbr: ["So","Mo","Di","Mi","Do","Fr","Sa"], - namesShort: ["So","Mo","Di","Mi","Do","Fr","Sa"] - }, - months: { - names: ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember",""], - namesAbbr: ["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez",""] - }, - AM: null, - PM: null, - eras: [{"name":"n. Chr.","start":null,"offset":0}], - patterns: { - d: "dd.MM.yyyy", - D: "dddd, d. MMMM yyyy", - t: "HH:mm", - T: "HH:mm:ss", - f: "dddd, d. MMMM yyyy HH:mm", - F: "dddd, d. MMMM yyyy HH:mm:ss", - M: "dd MMMM", - Y: "MMMM yyyy" - } - } - } -}); - -}( this )); diff --git a/external/globalize/globalize.culture.ja-JP.js b/external/globalize/globalize.culture.ja-JP.js deleted file mode 100644 index a9469d709..000000000 --- a/external/globalize/globalize.culture.ja-JP.js +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Globalize Culture ja-JP - * - * http://github.com/jquery/globalize - * - * Copyright Software Freedom Conservancy, Inc. - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * This file was generated by the Globalize Culture Generator - * Translation: bugs found in this file need to be fixed in the generator - */ - -(function( window, undefined ) { - -var Globalize; - -if ( typeof require !== "undefined" - && typeof exports !== "undefined" - && typeof module !== "undefined" ) { - // Assume CommonJS - Globalize = require( "globalize" ); -} else { - // Global variable - Globalize = window.Globalize; -} - -Globalize.addCultureInfo( "ja-JP", "default", { - name: "ja-JP", - englishName: "Japanese (Japan)", - nativeName: "日本語 (日本)", - language: "ja", - numberFormat: { - NaN: "NaN (非数値)", - negativeInfinity: "-∞", - positiveInfinity: "+∞", - percent: { - pattern: ["-n%","n%"] - }, - currency: { - pattern: ["-$n","$n"], - decimals: 0, - symbol: "¥" - } - }, - calendars: { - standard: { - days: { - names: ["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"], - namesAbbr: ["日","月","火","水","木","金","土"], - namesShort: ["日","月","火","水","木","金","土"] - }, - months: { - names: ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月",""], - namesAbbr: ["1","2","3","4","5","6","7","8","9","10","11","12",""] - }, - AM: ["午前","午前","午前"], - PM: ["午後","午後","午後"], - eras: [{"name":"西暦","start":null,"offset":0}], - patterns: { - d: "yyyy/MM/dd", - D: "yyyy'年'M'月'd'日'", - t: "H:mm", - T: "H:mm:ss", - f: "yyyy'年'M'月'd'日' H:mm", - F: "yyyy'年'M'月'd'日' H:mm:ss", - M: "M'月'd'日'", - Y: "yyyy'年'M'月'" - } - }, - Japanese: { - name: "Japanese", - days: { - names: ["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"], - namesAbbr: ["日","月","火","水","木","金","土"], - namesShort: ["日","月","火","水","木","金","土"] - }, - months: { - names: ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月",""], - namesAbbr: ["1","2","3","4","5","6","7","8","9","10","11","12",""] - }, - AM: ["午前","午前","午前"], - PM: ["午後","午後","午後"], - eras: [{"name":"平成","start":null,"offset":1867},{"name":"昭和","start":-1812153600000,"offset":1911},{"name":"大正","start":-1357603200000,"offset":1925},{"name":"明治","start":60022080000,"offset":1988}], - twoDigitYearMax: 99, - patterns: { - d: "gg y/M/d", - D: "gg y'年'M'月'd'日'", - t: "H:mm", - T: "H:mm:ss", - f: "gg y'年'M'月'd'日' H:mm", - F: "gg y'年'M'月'd'日' H:mm:ss", - M: "M'月'd'日'", - Y: "gg y'年'M'月'" - } - } - } -}); - -}( this )); diff --git a/external/globalize/globalize.js b/external/globalize/globalize.js index a38a32625..1086d339d 100644 --- a/external/globalize/globalize.js +++ b/external/globalize/globalize.js @@ -1,1585 +1,1788 @@ /*! - * Globalize + * Globalize v1.0.0pre * * http://github.com/jquery/globalize * - * Copyright Software Freedom Conservancy, Inc. - * Dual licensed under the MIT or GPL Version 2 licenses. + * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors + * Released under the MIT license * http://jquery.org/license + * + * Date: 2013-12-01T12:08Z */ - -(function( window, undefined ) { - -var Globalize, - // private variables - regexHex, - regexInfinity, - regexParseFloat, - regexTrim, - // private JavaScript utility functions - arrayIndexOf, - endsWith, - extend, - isArray, - isFunction, - isObject, - startsWith, - trim, - truncate, - zeroPad, - // private Globalization utility functions - appendPreOrPostMatch, - expandFormat, - formatDate, - formatNumber, - getTokenRegExp, - getEra, - getEraYear, - parseExact, - parseNegativePattern; - -// Global variable (Globalize) or CommonJS module (globalize) -Globalize = function( cultureSelector ) { - return new Globalize.prototype.init( cultureSelector ); -}; - -if ( typeof require !== "undefined" && - typeof exports !== "undefined" && - typeof module !== "undefined" ) { - // Assume CommonJS - module.exports = Globalize; -} else { - // Export as global variable - window.Globalize = Globalize; -} - -Globalize.cultures = {}; - -Globalize.prototype = { - constructor: Globalize, - init: function( cultureSelector ) { - this.cultures = Globalize.cultures; - this.cultureSelector = cultureSelector; - - return this; +(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.Globalize = factory(); } -}; -Globalize.prototype.init.prototype = Globalize.prototype; - -// 1. When defining a culture, all fields are required except the ones stated as optional. -// 2. Each culture should have a ".calendars" object with at least one calendar named "standard" -// which serves as the default calendar in use by that culture. -// 3. Each culture should have a ".calendar" object which is the current calendar being used, -// it may be dynamically changed at any time to one of the calendars in ".calendars". -Globalize.cultures[ "default" ] = { - // A unique name for the culture in the form <language code>-<country/region code> - name: "en", - // the name of the culture in the english language - englishName: "English", - // the name of the culture in its own language - nativeName: "English", - // whether the culture uses right-to-left text - isRTL: false, - // "language" is used for so-called "specific" cultures. - // For example, the culture "es-CL" means "Spanish, in Chili". - // It represents the Spanish-speaking culture as it is in Chili, - // which might have different formatting rules or even translations - // than Spanish in Spain. A "neutral" culture is one that is not - // specific to a region. For example, the culture "es" is the generic - // Spanish culture, which may be a more generalized version of the language - // that may or may not be what a specific culture expects. - // For a specific culture like "es-CL", the "language" field refers to the - // neutral, generic culture information for the language it is using. - // This is not always a simple matter of the string before the dash. - // For example, the "zh-Hans" culture is netural (Simplified Chinese). - // And the "zh-SG" culture is Simplified Chinese in Singapore, whose lanugage - // field is "zh-CHS", not "zh". - // This field should be used to navigate from a specific culture to it's - // more general, neutral culture. If a culture is already as general as it - // can get, the language may refer to itself. - language: "en", - // numberFormat defines general number formatting rules, like the digits in - // each grouping, the group separator, and how negative numbers are displayed. - numberFormat: { - // [negativePattern] - // Note, numberFormat.pattern has no "positivePattern" unlike percent and currency, - // but is still defined as an array for consistency with them. - // negativePattern: one of "(n)|-n|- n|n-|n -" - pattern: [ "-n" ], - // number of decimal places normally shown - decimals: 2, - // string that separates number groups, as in 1,000,000 - ",": ",", - // string that separates a number from the fractional portion, as in 1.99 - ".": ".", - // array of numbers indicating the size of each number group. - // TODO: more detailed description and example - groupSizes: [ 3 ], - // symbol used for positive numbers - "+": "+", - // symbol used for negative numbers - "-": "-", - // symbol used for NaN (Not-A-Number) - "NaN": "NaN", - // symbol used for Negative Infinity - negativeInfinity: "-Infinity", - // symbol used for Positive Infinity - positiveInfinity: "Infinity", - percent: { - // [negativePattern, positivePattern] - // negativePattern: one of "-n %|-n%|-%n|%-n|%n-|n-%|n%-|-% n|n %-|% n-|% -n|n- %" - // positivePattern: one of "n %|n%|%n|% n" - pattern: [ "-n %", "n %" ], - // number of decimal places normally shown - decimals: 2, - // array of numbers indicating the size of each number group. - // TODO: more detailed description and example - groupSizes: [ 3 ], - // string that separates number groups, as in 1,000,000 - ",": ",", - // string that separates a number from the fractional portion, as in 1.99 - ".": ".", - // symbol used to represent a percentage - symbol: "%" - }, - currency: { - // [negativePattern, positivePattern] - // negativePattern: one of "($n)|-$n|$-n|$n-|(n$)|-n$|n-$|n$-|-n $|-$ n|n $-|$ n-|$ -n|n- $|($ n)|(n $)" - // positivePattern: one of "$n|n$|$ n|n $" - pattern: [ "($n)", "$n" ], - // number of decimal places normally shown - decimals: 2, - // array of numbers indicating the size of each number group. - // TODO: more detailed description and example - groupSizes: [ 3 ], - // string that separates number groups, as in 1,000,000 - ",": ",", - // string that separates a number from the fractional portion, as in 1.99 - ".": ".", - // symbol used to represent currency - symbol: "$" + +}( this, function() { + +/** + * CLDR JavaScript Library v0.2.4-pre + * http://jquery.com/ + * + * Copyright 2013 Rafael Xavier de Souza + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2013-11-30T11:30Z + */ +/*! + * CLDR JavaScript Library v0.2.4-pre 2013-11-30T11:30Z MIT license © Rafael Xavier + * http://git.io/h4lmVg + */ + var Cldr = (function() { + + + + var alwaysArray = function( stringOrArray ) { + return typeof stringOrArray === "string" ? [ stringOrArray ] : stringOrArray; + }; + + + + + var common = function( Cldr ) { + + Cldr.prototype.main = function( path ) { + path = alwaysArray( path ); + return this.get( [ "main/{languageId}" ].concat( path ) ); + }; + + }; + + + + + var arrayIsArray = Array.isArray || function( obj ) { + return Object.prototype.toString.call( obj ) === "[object Array]"; + }; + + + + + var pathNormalize = function( path, attributes ) { + if ( arrayIsArray( path ) ) { + path = path.join( "/" ); } - }, - // calendars defines all the possible calendars used by this culture. - // There should be at least one defined with name "standard", and is the default - // calendar used by the culture. - // A calendar contains information about how dates are formatted, information about - // the calendar's eras, a standard set of the date formats, - // translations for day and month names, and if the calendar is not based on the Gregorian - // calendar, conversion functions to and from the Gregorian calendar. - calendars: { - standard: { - // name that identifies the type of calendar this is - name: "Gregorian_USEnglish", - // separator of parts of a date (e.g. "/" in 11/05/1955) - "/": "/", - // separator of parts of a time (e.g. ":" in 05:44 PM) - ":": ":", - // the first day of the week (0 = Sunday, 1 = Monday, etc) - firstDay: 0, - days: { - // full day names - names: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], - // abbreviated day names - namesAbbr: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], - // shortest day names - namesShort: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ] - }, - months: { - // full month names (13 months for lunar calendards -- 13th month should be "" if not lunar) - names: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", "" ], - // abbreviated month names - namesAbbr: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "" ] - }, - // AM and PM designators in one of these forms: - // The usual view, and the upper and lower case versions - // [ standard, lowercase, uppercase ] - // The culture does not use AM or PM (likely all standard date formats use 24 hour time) - // null - AM: [ "AM", "am", "AM" ], - PM: [ "PM", "pm", "PM" ], - eras: [ - // eras in reverse chronological order. - // name: the name of the era in this culture (e.g. A.D., C.E.) - // start: when the era starts in ticks (gregorian, gmt), null if it is the earliest supported era. - // offset: offset in years from gregorian calendar - { - "name": "A.D.", - "start": null, - "offset": 0 - } - ], - // when a two digit year is given, it will never be parsed as a four digit - // year greater than this year (in the appropriate era for the culture) - // Set it as a full year (e.g. 2029) or use an offset format starting from - // the current year: "+19" would correspond to 2029 if the current year 2010. - twoDigitYearMax: 2029, - // set of predefined date and time patterns used by the culture - // these represent the format someone in this culture would expect - // to see given the portions of the date that are shown. - patterns: { - // short date pattern - d: "M/d/yyyy", - // long date pattern - D: "dddd, MMMM dd, yyyy", - // short time pattern - t: "h:mm tt", - // long time pattern - T: "h:mm:ss tt", - // long date, short time pattern - f: "dddd, MMMM dd, yyyy h:mm tt", - // long date, long time pattern - F: "dddd, MMMM dd, yyyy h:mm:ss tt", - // month/day pattern - M: "MMMM dd", - // month/year pattern - Y: "yyyy MMMM", - // S is a sortable format that does not vary by culture - S: "yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss" - } - // optional fields for each calendar: - /* - monthsGenitive: - Same as months but used when the day preceeds the month. - Omit if the culture has no genitive distinction in month names. - For an explaination of genitive months, see http://blogs.msdn.com/michkap/archive/2004/12/25/332259.aspx - convert: - Allows for the support of non-gregorian based calendars. This convert object is used to - to convert a date to and from a gregorian calendar date to handle parsing and formatting. - The two functions: - fromGregorian( date ) - Given the date as a parameter, return an array with parts [ year, month, day ] - corresponding to the non-gregorian based year, month, and day for the calendar. - toGregorian( year, month, day ) - Given the non-gregorian year, month, and day, return a new Date() object - set to the corresponding date in the gregorian calendar. - */ + if ( typeof path !== "string" ) { + throw new Error( "invalid path \"" + path + "\"" ); } - }, - // For localized strings - messages: {} -}; + // 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 ]; + }); -Globalize.cultures[ "default" ].calendar = Globalize.cultures[ "default" ].calendars.standard; + return path.split( "/" ); + }; -Globalize.cultures.en = Globalize.cultures[ "default" ]; -Globalize.cultureSelector = "en"; -// -// private variables -// -regexHex = /^0x[a-f0-9]+$/i; -regexInfinity = /^[+\-]?infinity$/i; -regexParseFloat = /^[+\-]?\d*\.?\d*(e[+\-]?\d+)?$/; -regexTrim = /^\s+|\s+$/g; + 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; + }; -// -// private JavaScript utility functions -// -arrayIndexOf = function( array, item ) { - if ( array.indexOf ) { - return array.indexOf( item ); - } - for ( var i = 0, length = array.length; i < length; i++ ) { - if ( array[i] === item ) { - return i; + + + // 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 likelySubtags = function( cldr, subtags, options ) { + var match, matchFound, + language = subtags[ 0 ], + script = subtags[ 1 ], + 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( "_" ) ) /* [1.4] */ && cldr.get( [ "supplemental/likelySubtags", test.join( "_" ) ] ); + }); + + // [3] + if ( matchFound ) { + // [3.2 .. 3.4] + match = match.split( "_" ); + 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( "_" ); + } else { + // [3.1.1] + return; } - } - return -1; -}; - -endsWith = function( value, pattern ) { - return value.substr( value.length - pattern.length ) === pattern; -}; - -extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } + }; - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !isFunction(target) ) { - target = {}; - } - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( isObject(copy) || (copyIsArray = isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && isArray(src) ? src : []; + // 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 removeLikelySubtags = function( 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 = likelySubtags( cldr, test[ 0 ] ); + match = test[ 1 ]; + return result && result[ 0 ] === maxLanguageId[ 0 ] && + result[ 1 ] === maxLanguageId[ 1 ] && + result[ 2 ] === maxLanguageId[ 2 ]; + }); - } else { - clone = src && isObject(src) ? src : {}; - } + // [4] + return matchFound ? match : maxLanguageId; + }; - // Never move original objects, clone them - target[ name ] = extend( deep, clone, copy ); - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } + + + var supplemental = 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 init = function( locale ) { + var language, languageId, maxLanguageId, script, territory, unicodeLanguageId, variant; + + if ( typeof locale !== "string" ) { + throw new Error( "invalid locale type: \"" + JSON.stringify( locale ) + "\"" ); } - } - // Return the modified object - return target; -}; + // 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 -isArray = Array.isArray || function( obj ) { - return Object.prototype.toString.call( obj ) === "[object Array]"; -}; + locale = locale.replace( /-/, "_" ); -isFunction = function( obj ) { - return Object.prototype.toString.call( obj ) === "[object Function]"; -}; + // TODO normalize unicode locale extensions. Currently, skipped. + // unicodeLocaleExtensions = locale.split( "_u_" )[ 1 ]; + locale = locale.split( "_u_" )[ 0 ]; -isObject = function( obj ) { - return Object.prototype.toString.call( obj ) === "[object Object]"; -}; + // TODO normalize transformed extensions. Currently, skipped. + // transformedExtensions = locale.split( "_t_" )[ 1 ]; + locale = locale.split( "_t_" )[ 0 ]; -startsWith = function( value, pattern ) { - return value.indexOf( pattern ) === 0; -}; + unicodeLanguageId = locale; -trim = function( value ) { - return ( value + "" ).replace( regexTrim, "" ); -}; + // unicodeLanguageId = ... + switch ( true ) { -truncate = function( value ) { - if ( isNaN( value ) ) { - return NaN; - } - return Math[ value < 0 ? "ceil" : "floor" ]( value ); -}; + // language_script_territory.. + case /^[a-z]{2}_[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; -zeroPad = function( str, count, left ) { - var l; - for ( l = str.length; l < count; l += 1 ) { - str = ( left ? ("0" + str) : (str + "0") ); - } - return str; -}; - -// -// private Globalization utility functions -// - -appendPreOrPostMatch = function( preMatch, strings ) { - // appends pre- and post- token match strings while removing escaped characters. - // Returns a single quote count which is used to determine if the token occurs - // in a string literal. - var quoteCount = 0, - escaped = false; - for ( var i = 0, il = preMatch.length; i < il; i++ ) { - var c = preMatch.charAt( i ); - switch ( c ) { - case "\'": - if ( escaped ) { - strings.push( "\'" ); - } - else { - quoteCount++; - } - escaped = false; + // language_script.. + case /^[a-z]{2}_[A-Z][a-z]{3}(\b|_)/.test( unicodeLanguageId ): + language = unicodeLanguageId.split( "_" )[ 0 ]; + script = unicodeLanguageId.split( "_" )[ 1 ]; + territory = "ZZ"; + variant = unicodeLanguageId.split( "_" )[ 2 ]; break; - case "\\": - if ( escaped ) { - strings.push( "\\" ); - } - escaped = !escaped; + + // language_territory.. + case /^[a-z]{2}_[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}|root)(\b|_)/.test( unicodeLanguageId ): + language = unicodeLanguageId.split( "_" )[ 0 ]; + script = "Zzzz"; + territory = "ZZ"; + variant = unicodeLanguageId.split( "_" )[ 1 ]; + break; + default: - strings.push( c ); - escaped = false; + language = "und"; break; } - } - return quoteCount; -}; - -expandFormat = function( cal, format ) { - // expands unspecified or single character date formats into the full pattern. - format = format || "F"; - var pattern, - patterns = cal.patterns, - len = format.length; - if ( len === 1 ) { - pattern = patterns[ format ]; - if ( !pattern ) { - throw "Invalid date format string \'" + format + "\'."; - } - format = pattern; - } - else if ( len === 2 && format.charAt(0) === "%" ) { - // %X escape format -- intended as a custom format string that is only one character, not a built-in format. - format = format.charAt( 1 ); - } - return format; -}; - -formatDate = function( value, format, culture ) { - var cal = culture.calendar, - convert = cal.convert, - ret; - - if ( !format || !format.length || format === "i" ) { - if ( culture && culture.name.length ) { - if ( convert ) { - // non-gregorian calendar, so we cannot use built-in toLocaleString() - ret = formatDate( value, cal.patterns.F, culture ); - } - else { - var eraDate = new Date( value.getTime() ), - era = getEra( value, cal.eras ); - eraDate.setFullYear( getEraYear(value, cal, era) ); - ret = eraDate.toLocaleString(); + + // When a locale id does not specify a language, or territory (region), or script, they are obtained by Likely Subtags. + maxLanguageId = likelySubtags( this, [ language, script, territory ], { force: true } ) || unicodeLanguageId.split( "_" ); + language = maxLanguageId[ 0 ]; + script = maxLanguageId[ 1 ]; + territory = maxLanguageId[ 2 ]; + + // TODO json content distributed on zip file use languageId with `-` on main.<lang>. Why `-` vs. `_` ? + languageId = removeLikelySubtags( this, maxLanguageId ).join( "_" ); + + // Set attributes + this.attributes = { + + // Unicode Language Id + languageId: languageId, + maxLanguageId: maxLanguageId.join( "_" ), + + // Unicode Language Id Subtabs + language: language, + script: script, + territory: territory, + region: territory, /* alias */ + variant: variant + }; + + this.locale = variant ? [ languageId, variant ].join( "_" ) : languageId; + + // Inlcude supplemental helper + this.supplemental = supplemental( this ); + }; + + + + + // @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; } } - else { - ret = value.toString(); + return node[ path[ i ] ]; + }; + + + + + var bundleParentLookup = function( Cldr, locale ) { + var parent; + + if ( locale === "root" ) { + return; } - return ret; - } - var eras = cal.eras, - sortable = format === "s"; - format = expandFormat( cal, format ); - - // Start with an empty string - ret = []; - var hour, - zeros = [ "0", "00", "000" ], - foundDay, - checkedDay, - dayPartRegExp = /([^d]|^)(d|dd)([^d]|$)/g, - quoteCount = 0, - tokenRegExp = getTokenRegExp(), - converted; - - function padZeros( num, c ) { - var r, s = num + ""; - if ( c > 1 && s.length < c ) { - r = ( zeros[c - 2] + s); - return r.substr( r.length - c, c ); + // First, try to find parent on supplemental data. + parent = resourceGet( Cldr._resolved, pathNormalize( [ "supplemental/parentLocales/parentLocale", locale ] ) ); + if ( parent ) { + return parent; } - else { - r = s; + + // Or truncate locale. + parent = locale.substr( 0, locale.lastIndexOf( "_" ) ); + if ( !parent ) { + return "root"; } - return r; - } - function hasDay() { - if ( foundDay || checkedDay ) { - return foundDay; + return parent; + }; + + + + + // @path: normalized path + var resourceSet = function( data, path, value ) { + var i, + node = data, + length = path.length; + + for ( i = 0; i < length - 1; i++ ) { + if ( !node[ path[ i ] ] ) { + node[ path[ i ] ] = {}; + } + node = node[ path[ i ] ]; } - foundDay = dayPartRegExp.test( format ); - checkedDay = true; - return foundDay; - } + node[ path[ i ] ] = value; + }; + - function getPart( date, part ) { - if ( converted ) { - return converted[ part ]; + + + var arrayForEach = function( array, callback ) { + var i, length; + if ( array.forEach ) { + return array.forEach( callback ); } - switch ( part ) { - case 0: - return date.getFullYear(); - case 1: - return date.getMonth(); - case 2: - return date.getDate(); - default: - throw "Invalid part value " + part; + for ( i = 0, length = array.length; i < length; i++ ) { + callback( array[ i ], i, array ); } - } + }; - if ( !sortable && convert ) { - converted = convert.fromGregorian( value ); - } - for ( ; ; ) { - // Save the current index - var index = tokenRegExp.lastIndex, - // Look for the next pattern - ar = tokenRegExp.exec( format ); + var jsonMerge = (function() { - // Append the text before the pattern (or the end of the string if not found) - var preMatch = format.slice( index, ar ? ar.index : format.length ); - quoteCount += appendPreOrPostMatch( preMatch, ret ); + // 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 ] ) ) { - if ( !ar ) { - break; - } + // Concat Arrays + destination[ prop ] = destination[ prop ].concat( source[ prop ] ); - // do not replace any matches that occur inside a string literal. - if ( quoteCount % 2 ) { - ret.push( ar[0] ); - continue; - } + } else if ( prop in destination && typeof destination[ prop ] === "object" ) { - var current = ar[ 0 ], - clength = current.length; + // Merge Objects + destination[ prop ] = merge( destination[ prop ], source[ prop ] ); + + } else { + + // Set new values + destination[ prop ] = source[ prop ]; - switch ( current ) { - case "ddd": - //Day of the week, as a three-letter abbreviation - case "dddd": - // Day of the week, using the full name - var names = ( clength === 3 ) ? cal.days.namesAbbr : cal.days.names; - ret.push( names[value.getDay()] ); - break; - case "d": - // Day of month, without leading zero for single-digit days - case "dd": - // Day of month, with leading zero for single-digit days - foundDay = true; - ret.push( - padZeros( getPart(value, 2), clength ) - ); - break; - case "MMM": - // Month, as a three-letter abbreviation - case "MMMM": - // Month, using the full name - var part = getPart( value, 1 ); - ret.push( - ( cal.monthsGenitive && hasDay() ) ? - ( cal.monthsGenitive[ clength === 3 ? "namesAbbr" : "names" ][ part ] ) : - ( cal.months[ clength === 3 ? "namesAbbr" : "names" ][ part ] ) - ); - break; - case "M": - // Month, as digits, with no leading zero for single-digit months - case "MM": - // Month, as digits, with leading zero for single-digit months - ret.push( - padZeros( getPart(value, 1) + 1, clength ) - ); - break; - case "y": - // Year, as two digits, but with no leading zero for years less than 10 - case "yy": - // Year, as two digits, with leading zero for years less than 10 - case "yyyy": - // Year represented by four full digits - part = converted ? converted[ 0 ] : getEraYear( value, cal, getEra(value, eras), sortable ); - if ( clength < 4 ) { - part = part % 100; - } - ret.push( - padZeros( part, clength ) - ); - break; - case "h": - // Hours with no leading zero for single-digit hours, using 12-hour clock - case "hh": - // Hours with leading zero for single-digit hours, using 12-hour clock - hour = value.getHours() % 12; - if ( hour === 0 ) hour = 12; - ret.push( - padZeros( hour, clength ) - ); - break; - case "H": - // Hours with no leading zero for single-digit hours, using 24-hour clock - case "HH": - // Hours with leading zero for single-digit hours, using 24-hour clock - ret.push( - padZeros( value.getHours(), clength ) - ); - break; - case "m": - // Minutes with no leading zero for single-digit minutes - case "mm": - // Minutes with leading zero for single-digit minutes - ret.push( - padZeros( value.getMinutes(), clength ) - ); - break; - case "s": - // Seconds with no leading zero for single-digit seconds - case "ss": - // Seconds with leading zero for single-digit seconds - ret.push( - padZeros( value.getSeconds(), clength ) - ); - break; - case "t": - // One character am/pm indicator ("a" or "p") - case "tt": - // Multicharacter am/pm indicator - part = value.getHours() < 12 ? ( cal.AM ? cal.AM[0] : " " ) : ( cal.PM ? cal.PM[0] : " " ); - ret.push( clength === 1 ? part.charAt(0) : part ); - break; - case "f": - // Deciseconds - case "ff": - // Centiseconds - case "fff": - // Milliseconds - ret.push( - padZeros( value.getMilliseconds(), 3 ).substr( 0, clength ) - ); - break; - case "z": - // Time zone offset, no leading zero - case "zz": - // Time zone offset with leading zero - hour = value.getTimezoneOffset() / 60; - ret.push( - ( hour <= 0 ? "+" : "-" ) + padZeros( Math.floor(Math.abs(hour)), clength ) - ); - break; - case "zzz": - // Time zone offset with leading zero - hour = value.getTimezoneOffset() / 60; - ret.push( - ( hour <= 0 ? "+" : "-" ) + padZeros( Math.floor(Math.abs(hour)), 2 ) + - // Hard coded ":" separator, rather than using cal.TimeSeparator - // Repeated here for consistency, plus ":" was already assumed in date parsing. - ":" + padZeros( Math.abs(value.getTimezoneOffset() % 60), 2 ) - ); - break; - case "g": - case "gg": - if ( cal.eras ) { - ret.push( - cal.eras[ getEra(value, eras) ].name - ); } - break; - case "/": - ret.push( cal["/"] ); - break; - default: - throw "Invalid date format pattern \'" + current + "\'."; - } - } - return ret.join( "" ); -}; - -// formatNumber -(function() { - var expandNumber; - - expandNumber = function( number, precision, formatInfo ) { - var groupSizes = formatInfo.groupSizes, - curSize = groupSizes[ 0 ], - curGroupIndex = 1, - factor = Math.pow( 10, precision ), - rounded = Math.round( number * factor ) / factor; - - if ( !isFinite(rounded) ) { - rounded = number; - } - number = rounded; - - var numberString = number+"", - right = "", - split = numberString.split( /e/i ), - exponent = split.length > 1 ? parseInt( split[1], 10 ) : 0; - numberString = split[ 0 ]; - split = numberString.split( "." ); - numberString = split[ 0 ]; - right = split.length > 1 ? split[ 1 ] : ""; - - if ( exponent > 0 ) { - right = zeroPad( right, exponent, false ); - numberString += right.slice( 0, exponent ); - right = right.substr( exponent ); - } - else if ( exponent < 0 ) { - exponent = -exponent; - numberString = zeroPad( numberString, exponent + 1, true ); - right = numberString.slice( -exponent, numberString.length ) + right; - numberString = numberString.slice( 0, -exponent ); + } + }); + return destination; + }; + + return merge; + +}()); + var itemLookup = (function() { + + var lookup; + + lookup = function( Cldr, locale, path, attributes, childLocale ) { + var normalizedPath, parent, value; + + // 1: Finish recursion + // 2: Avoid infinite loop + if ( typeof locale === "undefined" /* 1 */ || locale === childLocale /* 2 */ ) { + return; } - if ( precision > 0 ) { - right = formatInfo[ "." ] + - ( (right.length > precision) ? right.slice(0, precision) : zeroPad(right, precision) ); + // Resolve path + normalizedPath = pathNormalize( path, attributes ); + + // Check resolved (cached) data first + value = resourceGet( Cldr._resolved, normalizedPath ); + if ( value ) { + return value; } - else { - right = ""; + + // Check raw data + value = resourceGet( Cldr._raw, normalizedPath ); + + if ( !value ) { + // Or, lookup at parent locale + parent = bundleParentLookup( Cldr, locale ); + value = lookup( Cldr, parent, path, jsonMerge( attributes, { languageId: parent }), locale ); } - var stringIndex = numberString.length - 1, - sep = formatInfo[ "," ], - ret = ""; + // Set resolved (cached) + resourceSet( Cldr._resolved, normalizedPath, value ); - while ( stringIndex >= 0 ) { - if ( curSize === 0 || curSize > stringIndex ) { - return numberString.slice( 0, stringIndex + 1 ) + ( ret.length ? (sep + ret + right) : right ); - } - ret = numberString.slice( stringIndex - curSize + 1, stringIndex + 1 ) + ( ret.length ? (sep + ret) : "" ); + return value; + }; - stringIndex -= curSize; + return lookup; - if ( curGroupIndex < groupSizes.length ) { - curSize = groupSizes[ curGroupIndex ]; - curGroupIndex++; - } +}()); + + + var itemGetResolved = function( Cldr, path, attributes ) { + // Resolve path + var normalizedPath = pathNormalize( path, attributes ); + + return resourceGet( Cldr._resolved, normalizedPath ); + }; + + + + + var Cldr = function() { + init.apply( this, arguments ); + }; + + Cldr._resolved = {}; + Cldr._raw = {}; + + // Load resolved or unresolved cldr data + // @json [JSON] + Cldr.load = function( json ) { + if ( typeof json !== "object" ) { + throw new Error( "invalid json" ); } + Cldr._raw = jsonMerge( Cldr._raw, json ); + }; - return numberString.slice( 0, stringIndex + 1 ) + sep + ret + right; + Cldr.prototype.get = function( path ) { + // Simplify locale using languageId (there are no other resource bundles) + // 1: during init(), get is called, but languageId is not defined. Use "" as a workaround in this very specific scenario. + var locale = this.attributes && this.attributes.languageId || "" /* 1 */; + + return itemGetResolved( Cldr, path, this.attributes ) || + itemLookup( Cldr, locale, path, this.attributes ); }; - formatNumber = function( value, format, culture ) { - if ( !isFinite(value) ) { - if ( value === Infinity ) { - return culture.numberFormat.positiveInfinity; - } - if ( value === -Infinity ) { - return culture.numberFormat.negativeInfinity; - } - return culture.numberFormat.NaN; + common( Cldr ); + + return Cldr; + + + +}()); + + + var arrayMap = function( array, callback ) { + var clone, i, length; + if ( array.map ) { + return array.map( callback ); } - if ( !format || format === "i" ) { - return culture.name.length ? value.toLocaleString() : value.toString(); + for ( clone = [], i = 0, length = array.length; i < length; i++ ) { + clone[ i ] = callback( array[ i ], i, array ); } - format = format || "D"; - - var nf = culture.numberFormat, - number = Math.abs( value ), - precision = -1, - pattern; - if ( format.length > 1 ) precision = parseInt( format.slice(1), 10 ); - - var current = format.charAt( 0 ).toUpperCase(), - formatInfo; - - switch ( current ) { - case "D": - pattern = "n"; - number = truncate( number ); - if ( precision !== -1 ) { - number = zeroPad( "" + number, precision, true ); - } - if ( value < 0 ) number = "-" + number; - break; - case "N": - formatInfo = nf; - /* falls through */ - case "C": - formatInfo = formatInfo || nf.currency; - /* falls through */ - case "P": - formatInfo = formatInfo || nf.percent; - pattern = value < 0 ? formatInfo.pattern[ 0 ] : ( formatInfo.pattern[1] || "n" ); - if ( precision === -1 ) precision = formatInfo.decimals; - number = expandNumber( number * (current === "P" ? 100 : 1), precision, formatInfo ); - break; - default: - throw "Bad number format specifier: " + current; + return clone; + }; + + + + + var objectValues = function( object ) { + var i, + result = []; + + for ( i in object ) { + result.push( object[ i ] ); } - var patternParts = /n|\$|-|%/g, - ret = ""; - for ( ; ; ) { - var index = patternParts.lastIndex, - ar = patternParts.exec( pattern ); + return result; + }; - ret += pattern.slice( index, ar ? ar.index : pattern.length ); - if ( !ar ) { - break; + + + /** + * allPreset() + * + * @cldr [Cldr instance]. + * + * Return an Array with all (skeleton, date, time, datetime) presets. + */ + var datetimeAllPresets = function( cldr ) { + var result = []; + + // Skeleton + result = objectValues( cldr.main( "dates/calendars/gregorian/dateTimeFormats/availableFormats" ) ); + + // Time + result = result.concat( objectValues( cldr.main( "dates/calendars/gregorian/timeFormats" ) ) ); + + // Date + result = result.concat( objectValues( cldr.main( "dates/calendars/gregorian/dateFormats" ) ) ); + + // Datetime + result = result.concat( arrayMap( objectValues( cldr.main( "dates/calendars/gregorian/dateTimeFormats" ) ), function( datetimeFormat, key ) { + if ( typeof datetimeFormat !== "string" ) { + return datetimeFormat; } + return datetimeFormat + .replace( /\{0\}/, cldr.main([ + "dates/calendars/gregorian/timeFormats", + key + ])) + .replace( /\{1\}/, cldr.main([ + "dates/calendars/gregorian/dateFormats", + key + ])); + })); + + return arrayMap( result, function( pattern ) { + return { pattern: pattern }; + }); + }; + + - switch ( ar[0] ) { - case "n": - ret += number; + + /** + * expandPattern( pattern, cldr ) + * + * @pattern [String or Object] if String, it's considered a skeleton. Object accepts: + * - skeleton: [String] lookup availableFormat; + * - date: [String] ( "full" | "long" | "medium" | "short" ); + * - time: [String] ( "full" | "long" | "medium" | "short" ); + * - datetime: [String] ( "full" | "long" | "medium" | "short" ); + * - pattern: [String] For more info see datetime/format.js. + * + * @cldr [Cldr instance]. + * + * Return the corresponding pattern. + * Eg for "en": + * - "GyMMMd" returns "MMM d, y G"; + * - { skeleton: "GyMMMd" } returns "MMM d, y G"; + * - { date: "full" } returns "EEEE, MMMM d, y"; + * - { time: "full" } returns "h:mm:ss a zzzz"; + * - { datetime: "full" } returns "EEEE, MMMM d, y 'at' h:mm:ss a zzzz"; + * - { pattern: "dd/mm" } returns "dd/mm"; + */ + var datetimeExpandPattern = function( pattern, cldr ) { + var result; + + if ( typeof pattern === "string" ) { + pattern = { skeleton: pattern }; + } + + if ( typeof pattern === "object" ) { + + switch ( true ) { + case "skeleton" in pattern: + result = cldr.main([ + "dates/calendars/gregorian/dateTimeFormats/availableFormats", + pattern.skeleton + ]); break; - case "$": - ret += nf.currency.symbol; + + case "date" in pattern: + case "time" in pattern: + result = cldr.main([ + "dates/calendars/gregorian", + "date" in pattern ? "dateFormats" : "timeFormats", + ( pattern.date || pattern.time ) + ]); break; - case "-": - // don't make 0 negative - if ( /[1-9]/.test(number) ) { - ret += nf[ "-" ]; + + case "datetime" in pattern: + result = cldr.main([ + "dates/calendars/gregorian/dateTimeFormats", + pattern.datetime + ]); + if ( result ) { + result = result + .replace( /\{0\}/, cldr.main([ + "dates/calendars/gregorian/timeFormats", + pattern.datetime + ])) + .replace( /\{1\}/, cldr.main([ + "dates/calendars/gregorian/dateFormats", + pattern.datetime + ])); } break; - case "%": - ret += nf.percent.symbol; + + case "pattern" in pattern: + result = pattern.pattern; break; + + default: + throw new Error( "Invalid pattern" ); } + + } else { + throw new Error( "Invalid pattern" ); + } + + if ( !result ) { + throw new Error( "Pattern not found" ); } - return ret; + return result; }; -}()); -getTokenRegExp = function() { - // regular expression for matching date and time tokens in format strings. - return (/\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|gg|g/g); -}; - -getEra = function( date, eras ) { - if ( !eras ) return 0; - var start, ticks = date.getTime(); - for ( var i = 0, l = eras.length; i < l; i++ ) { - start = eras[ i ].start; - if ( start === null || ticks >= start ) { - return i; + + var datetimeWeekDays = [ "sun", "mon", "tue", "wed", "thu", "fri", "sat" ]; + + + + var arrayIndexOf = function( array, item ) { + if ( array.indexOf ) { + return array.indexOf( item ); } - } - return 0; -}; - -getEraYear = function( date, cal, era, sortable ) { - var year = date.getFullYear(); - if ( !sortable && cal.eras ) { - // convert normal gregorian year to era-shifted gregorian - // year by subtracting the era offset - year -= cal.eras[ era ].offset; - } - return year; -}; - -// parseExact -(function() { - var expandYear, - getDayIndex, - getMonthIndex, - getParseRegExp, - outOfRange, - toUpper, - toUpperArray; - - expandYear = function( cal, year ) { - // expands 2-digit year into 4 digits. - if ( year < 100 ) { - var now = new Date(), - era = getEra( now ), - curr = getEraYear( now, cal, era ), - twoDigitYearMax = cal.twoDigitYearMax; - twoDigitYearMax = typeof twoDigitYearMax === "string" ? new Date().getFullYear() % 100 + parseInt( twoDigitYearMax, 10 ) : twoDigitYearMax; - year += curr - ( curr % 100 ); - if ( year > twoDigitYearMax ) { - year -= 100; + for ( var i = 0, length = array.length; i < length; i++ ) { + if ( array[i] === item ) { + return i; } } - return year; + return -1; }; - getDayIndex = function ( cal, value, abbr ) { - var ret, - days = cal.days, - upperDays = cal._upperDays; - if ( !upperDays ) { - cal._upperDays = upperDays = [ - toUpperArray( days.names ), - toUpperArray( days.namesAbbr ), - toUpperArray( days.namesShort ) - ]; - } - value = toUpper( value ); - if ( abbr ) { - ret = arrayIndexOf( upperDays[1], value ); - if ( ret === -1 ) { - ret = arrayIndexOf( upperDays[2], value ); - } - } - else { - ret = arrayIndexOf( upperDays[0], value ); - } - return ret; + + + + /** + * firstDayOfWeek + */ + var datetimeFirstDayOfWeek = function( cldr ) { + return arrayIndexOf( datetimeWeekDays, cldr.supplemental.weekData.firstDay() ); }; - getMonthIndex = function( cal, value, abbr ) { - var months = cal.months, - monthsGen = cal.monthsGenitive || cal.months, - upperMonths = cal._upperMonths, - upperMonthsGen = cal._upperMonthsGen; - if ( !upperMonths ) { - cal._upperMonths = upperMonths = [ - toUpperArray( months.names ), - toUpperArray( months.namesAbbr ) - ]; - cal._upperMonthsGen = upperMonthsGen = [ - toUpperArray( monthsGen.names ), - toUpperArray( monthsGen.namesAbbr ) - ]; - } - value = toUpper( value ); - var i = arrayIndexOf( abbr ? upperMonths[1] : upperMonths[0], value ); - if ( i < 0 ) { - i = arrayIndexOf( abbr ? upperMonthsGen[1] : upperMonthsGen[0], value ); + + + + /** + * dayOfWeek + * + * Return the day of the week normalized by the territory's firstDay [0-6]. + * Eg for "mon": + * - return 0 if territory is GB, or BR, or DE, or FR (week starts on "mon"); + * - return 1 if territory is US (week starts on "sun"); + * - return 2 if territory is EG (week starts on "sat"); + */ + var datetimeDayOfWeek = function( date, cldr ) { + return ( date.getDay() - datetimeFirstDayOfWeek( cldr ) + 7 ) % 7; + }; + + + + + /** + * distanceInDays( from, to ) + * + * Return the distance in days between from and to Dates. + */ + var datetimeDistanceInDays = function( from, to ) { + var inDays = 864e5; + return ( to.getTime() - from.getTime() ) / inDays; + }; + + + + + /** + * startOf + * + * Return the + */ + var datetimeStartOf = function( date, unit ) { + date = new Date( date.getTime() ); + switch( unit ) { + case "year": + date.setMonth( 0 ); + /* falls through */ + case "month": + date.setDate( 1 ); + /* falls through */ + case "day": + date.setHours( 0 ); + /* falls through */ + case "hour": + date.setMinutes( 0 ); + /* falls through */ + case "minute": + date.setSeconds( 0 ); + /* falls through */ + case "second": + date.setMilliseconds( 0 ); } - return i; + return date; }; - getParseRegExp = function( cal, format ) { - // converts a format string into a regular expression with groups that - // can be used to extract date fields from a date string. - // check for a cached parse regex. - var re = cal._parseRegExp; - if ( !re ) { - cal._parseRegExp = re = {}; + + + + /** + * dayOfYear + * + * Return the distance in days of the date to the begin of the year [0-d]. + */ + var datetimeDayOfYear = function( date ) { + return Math.floor( datetimeDistanceInDays( datetimeStartOf( date, "year" ), date ) ); + }; + + + + + /** + * millisecondsInDay + */ + var datetimeMillisecondsInDay = function( date ) { + // TODO Handle daylight savings discontinuities + return date - datetimeStartOf( date, "day" ); + }; + + + + var datetimePatternRe = (/([a-z])\1*|'[^']+'|''|./ig); + + + + var stringPad = function( str, count, right ) { + var length; + if ( typeof str !== "string" ) { + str = String( str ); } - else { - var reFormat = re[ format ]; - if ( reFormat ) { - return reFormat; - } + for ( length = str.length; length < count; length += 1 ) { + str = ( right ? ( str + "0" ) : ( "0" + str ) ); } + return str; + }; + + - // expand single digit formats, then escape regular expression characters. - var expFormat = expandFormat( cal, format ).replace( /([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g, "\\\\$1" ), - regexp = [ "^" ], - groups = [], - index = 0, - quoteCount = 0, - tokenRegExp = getTokenRegExp(), - match; - - // iterate through each date token found. - while ( (match = tokenRegExp.exec(expFormat)) !== null ) { - var preMatch = expFormat.slice( index, match.index ); - index = tokenRegExp.lastIndex; - - // don't replace any matches that occur inside a string literal. - quoteCount += appendPreOrPostMatch( preMatch, regexp ); - if ( quoteCount % 2 ) { - regexp.push( match[0] ); - continue; + + /** + * format( date, pattern, cldr ) + * + * @date [Date instance]. + * + * @pattern [String] raw pattern. + * ref: http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns + * + * @cldr [Cldr instance]. + * + * TODO Support other calendar types. + * + * Disclosure: this function borrows excerpts of dojo/date/locale. + */ + var datetimeFormat = function( date, pattern, cldr ) { + var widths = [ "abbreviated", "wide", "narrow" ]; + return pattern.replace( datetimePatternRe, function( current ) { + var pad, ret, + chr = current.charAt( 0 ), + length = current.length; + + if ( chr === "j" ) { + // Locale preferred hHKk. + // http://www.unicode.org/reports/tr35/tr35-dates.html#Time_Data + chr = cldr.supplemental.timeData.preferred(); } - // add a regex group for the token. - var m = match[ 0 ], - len = m.length, - add; - switch ( m ) { - case "dddd": case "ddd": - case "MMMM": case "MMM": - case "gg": case "g": - add = "(\\D+)"; + switch ( chr ) { + + // Era + case "G": + ret = cldr.main([ + "dates/calendars/gregorian/eras", + length <= 3 ? "eraAbbr" : ( length === 4 ? "eraNames" : "eraNarrow" ), + date.getFullYear() < 0 ? 0 : 1 + ]); + break; + + // Year + case "y": + // Plain year. + // The length specifies the padding, but for two letters it also specifies the maximum length. + ret = String( date.getFullYear() ); + pad = true; + if ( length === 2 ) { + ret = ret.substr( ret.length - 2 ); + } + break; + + case "Y": + // Year in "Week of Year" + // The length specifies the padding, but for two letters it also specifies the maximum length. + // yearInWeekofYear = date + DaysInAWeek - (dayOfWeek - firstDay) - minDays + ret = new Date( date.getTime() ); + ret.setDate( ret.getDate() + 7 - ( datetimeDayOfWeek( date, cldr ) - datetimeFirstDayOfWeek( cldr ) ) - cldr.supplemental.weekData.minDays() ); + ret = String( ret.getFullYear() ); + pad = true; + if ( length === 2 ) { + ret = ret.substr( ret.length - 2 ); + } + break; + + case "u": // Extended year. Need to be implemented. + case "U": // Cyclic year name. Need to be implemented. + throw new Error( "Not implemented" ); + + // Quarter + case "Q": + case "q": + ret = Math.ceil( ( date.getMonth() + 1 ) / 3 ); + if ( length <= 2 ) { + pad = true; + } else { + // http://unicode.org/cldr/trac/ticket/6788 + ret = cldr.main([ + "dates/calendars/gregorian/quarters", + chr === "Q" ? "format" : "stand-alone", + widths[ length - 3 ], + ret + ]); + } + break; + + // Month + case "M": + case "L": + ret = date.getMonth() + 1; + if ( length <= 2 ) { + pad = true; + } else { + ret = cldr.main([ + "dates/calendars/gregorian/months", + chr === "M" ? "format" : "stand-alone", + widths[ length - 3 ], + ret + ]); + } + break; + + // Week + case "w": + // Week of Year. + // woy = ceil( ( doy + dow of 1/1 ) / 7 ) - minDaysStuff ? 1 : 0. + // TODO should pad on ww? Not documented, but I guess so. + ret = datetimeDayOfWeek( datetimeStartOf( date, "year" ), cldr ); + ret = Math.ceil( ( datetimeDayOfYear( date ) + ret ) / 7 ) - ( 7 - ret >= cldr.supplemental.weekData.minDays() ? 0 : 1 ); + pad = true; + break; + + case "W": + // Week of Month. + // wom = ceil( ( dom + dow of `1/month` ) / 7 ) - minDaysStuff ? 1 : 0. + ret = datetimeDayOfWeek( datetimeStartOf( date, "month" ), cldr ); + ret = Math.ceil( ( date.getDate() + ret ) / 7 ) - ( 7 - ret >= cldr.supplemental.weekData.minDays() ? 0 : 1 ); + break; + + // Day + case "d": + ret = date.getDate(); + pad = true; + break; + + case "D": + ret = datetimeDayOfYear( date ) + 1; + pad = true; + break; + + case "F": + // Day of Week in month. eg. 2nd Wed in July. + ret = Math.floor( date.getDate() / 7 ) + 1; + break; + + case "g+": + // Modified Julian day. Need to be implemented. + throw new Error( "Not implemented" ); + + // Week day + case "e": + case "c": + if ( length <= 2 ) { + // Range is [1-7] (deduced by example provided on documentation) + // TODO Should pad with zeros (not specified in the docs)? + ret = datetimeDayOfWeek( date, cldr ) + 1; + pad = true; + break; + } + + /* falls through */ + case "E": + ret = datetimeWeekDays[ date.getDay() ]; + if ( length === 6 ) { + // If short day names are not explicitly specified, abbreviated day names are used instead. + // http://www.unicode.org/reports/tr35/tr35-dates.html#months_days_quarters_eras + // http://unicode.org/cldr/trac/ticket/6790 + ret = cldr.main([ + "dates/calendars/gregorian/days", + [ chr === "c" ? "stand-alone" : "format" ], + "short", + ret + ]) || cldr.main([ + "dates/calendars/gregorian/days", + [ chr === "c" ? "stand-alone" : "format" ], + "abbreviated", + ret + ]); + } else { + ret = cldr.main([ + "dates/calendars/gregorian/days", + [ chr === "c" ? "stand-alone" : "format" ], + widths[ length < 3 ? 0 : length - 3 ], + ret + ]); + } + break; + + // Period (AM or PM) + case "a": + ret = cldr.main([ + "dates/calendars/gregorian/dayPeriods/format/wide", + date.getHours() < 12 ? "am" : "pm" + ]); break; - case "tt": case "t": - add = "(\\D*)"; + + // Hour + case "h": // 1-12 + ret = ( date.getHours() % 12 ) || 12; + pad = true; break; - case "yyyy": - case "fff": - case "ff": - case "f": - add = "(\\d{" + len + "})"; + + case "H": // 0-23 + ret = date.getHours(); + pad = true; break; - case "dd": case "d": - case "MM": case "M": - case "yy": case "y": - case "HH": case "H": - case "hh": case "h": - case "mm": case "m": - case "ss": case "s": - add = "(\\d\\d?)"; + + case "K": // 0-11 + ret = date.getHours() % 12; + pad = true; + break; + + case "k": // 1-24 + ret = date.getHours() || 24; + pad = true; + break; + + // Minute + case "m": + ret = date.getMinutes(); + pad = true; break; - case "zzz": - add = "([+-]?\\d\\d?:\\d{2})"; + + // Second + case "s": + ret = date.getSeconds(); + pad = true; break; - case "zz": case "z": - add = "([+-]?\\d\\d?)"; + + case "S": + ret = Math.round( date.getMilliseconds() * Math.pow( 10, length - 3 ) ); + pad = true; break; - case "/": - add = "(\\/)"; + + case "A": + ret = Math.round( datetimeMillisecondsInDay( date ) * Math.pow( 10, length - 3 ) ); + pad = true; break; + + // Zone + // see http://www.unicode.org/reports/tr35/tr35-dates.html#Using_Time_Zone_Names ? + // Need to be implemented. + case "z": + case "Z": + case "O": + case "v": + case "V": + case "X": + case "x": + throw new Error( "Not implemented" ); + + // Anything else is considered a literal, including [ ,:/.'@#], chinese, japonese, and arabic characters. default: - throw "Invalid date format pattern \'" + m + "\'."; + return current; } - if ( add ) { - regexp.push( add ); + if ( pad ) { + ret = stringPad( ret, length ); } - groups.push( match[0] ); - } - appendPreOrPostMatch( expFormat.slice(index), regexp ); - regexp.push( "$" ); - - // allow whitespace to differ when matching formats. - var regexpStr = regexp.join( "" ).replace( /\s+/g, "\\s+" ), - parseRegExp = { "regExp": regexpStr, "groups": groups }; - - // cache the regex for this format. - return re[ format ] = parseRegExp; + return ret; + }); }; - outOfRange = function( value, low, high ) { - return value < low || value > high; - }; - toUpper = function( value ) { - // "he-IL" has non-breaking space in weekday names. - return value.split( "\u00A0" ).join( " " ).toUpperCase(); - }; - toUpperArray = function( arr ) { - var results = []; - for ( var i = 0, l = arr.length; i < l; i++ ) { - results[ i ] = toUpper( arr[i] ); + + var arrayEvery = function( array, callback ) { + var i, length; + if ( array.every ) { + return array.every( callback ); + } + for ( i = 0, length = array.length; i < length; i++ ) { + if ( !callback( array[ i ], i, array ) ) { + return false; + } } - return results; + return true; }; - parseExact = function( value, format, culture ) { - // try to parse the date string by matching against the format string - // while using the specified culture for date field names. - value = trim( value ); - var cal = culture.calendar, - // convert date formats into regular expressions with groupings. - // use the regexp to determine the input format and extract the date fields. - parseInfo = getParseRegExp( cal, format ), - match = new RegExp( parseInfo.regExp ).exec( value ); - if ( match === null ) { - return null; - } - // found a date format that matches the input. - var groups = parseInfo.groups, - era = null, year = null, month = null, date = null, weekDay = null, - hour = 0, hourOffset, min = 0, sec = 0, msec = 0, tzMinOffset = null, - pmHour = false; - // iterate the format groups to extract and set the date fields. - for ( var j = 0, jl = groups.length; j < jl; j++ ) { - var matchGroup = match[ j + 1 ]; - if ( matchGroup ) { - var current = groups[ j ], - clength = current.length, - matchInt = parseInt( matchGroup, 10 ); - switch ( current ) { - case "dd": case "d": - // Day of month. - date = matchInt; - // check that date is generally in valid range, also checking overflow below. - if ( outOfRange(date, 1, 31) ) return null; - break; - case "MMM": case "MMMM": - month = getMonthIndex( cal, matchGroup, clength === 3 ); - if ( outOfRange(month, 0, 11) ) return null; - break; - case "M": case "MM": - // Month. - month = matchInt - 1; - if ( outOfRange(month, 0, 11) ) return null; - break; - case "y": case "yy": - case "yyyy": - year = clength < 4 ? expandYear( cal, matchInt ) : matchInt; - if ( outOfRange(year, 0, 9999) ) return null; - break; - case "h": case "hh": - // Hours (12-hour clock). - hour = matchInt; - if ( hour === 12 ) hour = 0; - if ( outOfRange(hour, 0, 11) ) return null; - break; - case "H": case "HH": - // Hours (24-hour clock). - hour = matchInt; - if ( outOfRange(hour, 0, 23) ) return null; - break; - case "m": case "mm": - // Minutes. - min = matchInt; - if ( outOfRange(min, 0, 59) ) return null; - break; - case "s": case "ss": - // Seconds. - sec = matchInt; - if ( outOfRange(sec, 0, 59) ) return null; - break; - case "tt": case "t": - // AM/PM designator. - // see if it is standard, upper, or lower case PM. If not, ensure it is at least one of - // the AM tokens. If not, fail the parse for this format. - pmHour = cal.PM && ( matchGroup === cal.PM[0] || matchGroup === cal.PM[1] || matchGroup === cal.PM[2] ); - if ( - !pmHour && ( - !cal.AM || ( matchGroup !== cal.AM[0] && matchGroup !== cal.AM[1] && matchGroup !== cal.AM[2] ) - ) - ) return null; - break; - case "f": - // Deciseconds. - case "ff": - // Centiseconds. - case "fff": - // Milliseconds. - msec = matchInt * Math.pow( 10, 3 - clength ); - if ( outOfRange(msec, 0, 999) ) return null; - break; - case "ddd": - // Day of week. - case "dddd": - // Day of week. - weekDay = getDayIndex( cal, matchGroup, clength === 3 ); - if ( outOfRange(weekDay, 0, 6) ) return null; - break; - case "zzz": - // Time zone offset in +/- hours:min. - var offsets = matchGroup.split( /:/ ); - if ( offsets.length !== 2 ) return null; - hourOffset = parseInt( offsets[0], 10 ); - if ( outOfRange(hourOffset, -12, 13) ) return null; - var minOffset = parseInt( offsets[1], 10 ); - if ( outOfRange(minOffset, 0, 59) ) return null; - tzMinOffset = ( hourOffset * 60 ) + ( startsWith(matchGroup, "-") ? -minOffset : minOffset ); - break; - case "z": case "zz": - // Time zone offset in +/- hours. - hourOffset = matchInt; - if ( outOfRange(hourOffset, -12, 13) ) return null; - tzMinOffset = hourOffset * 60; - break; - case "g": case "gg": - var eraName = matchGroup; - if ( !eraName || !cal.eras ) return null; - eraName = trim( eraName.toLowerCase() ); - for ( var i = 0, l = cal.eras.length; i < l; i++ ) { - if ( eraName === cal.eras[i].name.toLowerCase() ) { - era = i; - break; - } - } - // could not find an era with that name - if ( era === null ) return null; - break; + + + + /** + * tokenizer( value, pattern ) + * + * Returns an Array of tokens, eg. value "5 o'clock PM", pattern "h 'o''clock' a": + * [{ + * type: "h", + * lexeme: "5" + * }, { + * type: "literal", + * lexeme: " " + * }, { + * type: "literal", + * lexeme: "o'clock" + * }, { + * type: "literal", + * lexeme: " " + * }, { + * type: "a", + * lexeme: "PM", + * value: "pm" + * }] + * + * OBS: lexeme's are always String and may return invalid ranges depending of the token type. Eg. "99" for month number. + * + * Return an empty Array when not successfully parsed. + */ + var datetimeTokenizer = function( value, pattern, cldr ) { + var valid, + tokens = [], + widths = [ "abbreviated", "wide", "narrow" ]; + + valid = arrayEvery( pattern.match( datetimePatternRe ), function( current ) { + var chr, length, tokenRe, + token = {}; + + function oneDigitIfLengthOne() { + if ( length === 1 ) { + return tokenRe = /\d/; } } - } - var result = new Date(), defaultYear, convert = cal.convert; - defaultYear = convert ? convert.fromGregorian( result )[ 0 ] : result.getFullYear(); - if ( year === null ) { - year = defaultYear; - } - else if ( cal.eras ) { - // year must be shifted to normal gregorian year - // but not if year was not specified, its already normal gregorian - // per the main if clause above. - year += cal.eras[( era || 0 )].offset; - } - // set default day and month to 1 and January, so if unspecified, these are the defaults - // instead of the current day/month. - if ( month === null ) { - month = 0; - } - if ( date === null ) { - date = 1; - } - // now have year, month, and date, but in the culture's calendar. - // convert to gregorian if necessary - if ( convert ) { - result = convert.toGregorian( year, month, date ); - // conversion failed, must be an invalid match - if ( result === null ) return null; - } - else { - // have to set year, month and date together to avoid overflow based on current date. - result.setFullYear( year, month, date ); - // check to see if date overflowed for specified month (only checked 1-31 above). - if ( result.getDate() !== date ) return null; - // invalid day of week. - if ( weekDay !== null && result.getDay() !== weekDay ) { - return null; + + function oneOrTwoDigitsIfLengthOne() { + if ( length === 1 ) { + return tokenRe = /\d\d?/; + } } - } - // if pm designator token was found make sure the hours fit the 24-hour clock. - if ( pmHour && hour < 12 ) { - hour += 12; - } - result.setHours( hour, min, sec, msec ); - if ( tzMinOffset !== null ) { - // adjust timezone to utc before applying local offset. - var adjustedMin = result.getMinutes() - ( tzMinOffset + result.getTimezoneOffset() ); - // Safari limits hours and minutes to the range of -127 to 127. We need to use setHours - // to ensure both these fields will not exceed this range. adjustedMin will range - // somewhere between -1440 and 1500, so we only need to split this into hours. - result.setHours( result.getHours() + parseInt(adjustedMin / 60, 10), adjustedMin % 60 ); - } - return result; - }; -}()); -parseNegativePattern = function( value, nf, negativePattern ) { - var neg = nf[ "-" ], - pos = nf[ "+" ], - ret; - switch ( negativePattern ) { - case "n -": - neg = " " + neg; - pos = " " + pos; - /* falls through */ - case "n-": - if ( endsWith(value, neg) ) { - ret = [ "-", value.substr(0, value.length - neg.length) ]; + function twoDigitsIfLengthTwo() { + if ( length === 2 ) { + return tokenRe = /\d\d/; + } } - else if ( endsWith(value, pos) ) { - ret = [ "+", value.substr(0, value.length - pos.length) ]; + + // Brute-force test every locale entry in an attempt to match the given value. + // Return the first found one (and set token accordingly), or null. + function lookup( path ) { + var i, re, + data = cldr.main( path ); + for ( i in data ) { + re = new RegExp( "^" + data[ i ] ); + if ( re.test( value ) ) { + token.value = i; + return tokenRe = new RegExp( data[ i ] ); + } + } + return null; } - break; - case "- n": - neg += " "; - pos += " "; - /* falls through */ - case "-n": - if ( startsWith(value, neg) ) { - ret = [ "-", value.substr(neg.length) ]; + + token.type = current; + chr = current.charAt( 0 ), + length = current.length; + + switch ( chr ) { + + // Era + case "G": + lookup([ + "dates/calendars/gregorian/eras", + length <= 3 ? "eraAbbr" : ( length === 4 ? "eraNames" : "eraNarrow" ) + ]); + break; + + // Year + case "y": + case "Y": + // number l=1:+, l=2:{2}, l=3:{3,}, l=4:{4,}, ... + if ( length === 1 ) { + tokenRe = /\d+/; + } else if ( length === 2 ) { + tokenRe = /\d\d/; + } else { + tokenRe = new RegExp( "\\d{" + length + ",}" ); + } + break; + + case "u": // Extended year. Need to be implemented. + case "U": // Cyclic year name. Need to be implemented. + throw new Error( "Not implemented" ); + + // Quarter + case "Q": + case "q": + // number l=1:{1}, l=2:{2}. + // lookup l=3... + oneDigitIfLengthOne() || twoDigitsIfLengthTwo() || lookup([ + "dates/calendars/gregorian/quarters", + chr === "Q" ? "format" : "stand-alone", + widths[ length - 3 ] + ]); + break; + + // Month + case "M": + case "L": + // number l=1:{1,2}, l=2:{2}. + // lookup l=3... + oneOrTwoDigitsIfLengthOne() || twoDigitsIfLengthTwo() || lookup([ + "dates/calendars/gregorian/months", + chr === "M" ? "format" : "stand-alone", + widths[ length - 3 ] + ]); + break; + + // Day (see d below) + case "D": + // number {l,3}. + if ( length <= 3 ) { + tokenRe = new RegExp( "\\d{" + length + ",3}" ); + } + break; + + case "W": + case "F": + // number l=1:{1}. + oneDigitIfLengthOne(); + break; + + case "g+": + // Modified Julian day. Need to be implemented. + throw new Error( "Not implemented" ); + + // Week day + case "e": + case "c": + // number l=1:{1}, l=2:{2}. + // lookup for length >=3. + if( length <= 2 ) { + oneDigitIfLengthOne() || twoDigitsIfLengthTwo(); + break; + } + + /* falls through */ + case "E": + if ( length === 6 ) { + // Note: if short day names are not explicitly specified, abbreviated day names are used instead http://www.unicode.org/reports/tr35/tr35-dates.html#months_days_quarters_eras + lookup([ + "dates/calendars/gregorian/days", + [ chr === "c" ? "stand-alone" : "format" ], + "short" + ]) || lookup([ + "dates/calendars/gregorian/days", + [ chr === "c" ? "stand-alone" : "format" ], + "abbreviated" + ]); + } else { + lookup([ + "dates/calendars/gregorian/days", + [ chr === "c" ? "stand-alone" : "format" ], + widths[ length < 3 ? 0 : length - 3 ] + ]); + } + break; + + // Period (AM or PM) + case "a": + lookup([ + "dates/calendars/gregorian/dayPeriods/format/wide" + ]); + break; + + // Week, Day, Hour, Minute, or Second + case "w": + case "d": + case "h": + case "H": + case "K": + case "k": + case "j": + case "m": + case "s": + // number l1:{1,2}, l2:{2}. + oneOrTwoDigitsIfLengthOne() || twoDigitsIfLengthTwo(); + break; + + case "S": + // number {l}. + tokenRe = new RegExp( "\\d{" + length + "}" ); + break; + + case "A": + // number {l+5}. + tokenRe = new RegExp( "\\d{" + ( length + 5 ) + "}" ); + break; + + // Zone + // see http://www.unicode.org/reports/tr35/tr35-dates.html#Using_Time_Zone_Names ? + // Need to be implemented. + case "z": + case "Z": + case "O": + case "v": + case "V": + case "X": + case "x": + throw new Error( "Not implemented" ); + + case "'": + token.type = "literal"; + if ( current.charAt( 1 ) === "'" ) { + tokenRe = /'/; + } else { + tokenRe = /'[^']+'/; + } + break; + + default: + token.type = "literal"; + tokenRe = /./; } - else if ( startsWith(value, pos) ) { - ret = [ "+", value.substr(pos.length) ]; + + if ( !tokenRe ) { + return false; } - break; - case "(n)": - if ( startsWith(value, "(") && endsWith(value, ")") ) { - ret = [ "-", value.substr(1, value.length - 2) ]; + + // Get lexeme and consume it. + value = value.replace( new RegExp( "^" + tokenRe.source ), function( lexeme ) { + token.lexeme = lexeme; + return ""; + }); + + if ( !token.lexeme ) { + return false; } - break; - } - return ret || [ "", value ]; -}; - -// -// public instance functions -// - -Globalize.prototype.findClosestCulture = function( cultureSelector ) { - return Globalize.findClosestCulture.call( this, cultureSelector ); -}; - -Globalize.prototype.format = function( value, format, cultureSelector ) { - return Globalize.format.call( this, value, format, cultureSelector ); -}; - -Globalize.prototype.localize = function( key, cultureSelector ) { - return Globalize.localize.call( this, key, cultureSelector ); -}; - -Globalize.prototype.parseInt = function( value, radix, cultureSelector ) { - return Globalize.parseInt.call( this, value, radix, cultureSelector ); -}; - -Globalize.prototype.parseFloat = function( value, radix, cultureSelector ) { - return Globalize.parseFloat.call( this, value, radix, cultureSelector ); -}; - -Globalize.prototype.culture = function( cultureSelector ) { - return Globalize.culture.call( this, cultureSelector ); -}; - -// -// public singleton functions -// - -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; - } -}; + tokens.push( token ); + return true; + }); -Globalize.findClosestCulture = function( name ) { - var match; - if ( !name ) { - return this.findClosestCulture( this.cultureSelector ) || this.cultures[ "default" ]; - } - if ( typeof name === "string" ) { - name = name.split( "," ); + return valid ? tokens : []; + }; + + + var datetimeParse = (function() { + + function outOfRange( value, low, high ) { + return value < low || value > high; } - if ( isArray(name) ) { - var lang, - cultures = this.cultures, - list = name, - i, l = list.length, - prioritized = []; - for ( i = 0; i < l; i++ ) { - name = trim( list[i] ); - var pri, parts = name.split( ";" ); - lang = trim( parts[0] ); - if ( parts.length === 1 ) { - pri = 1; - } - else { - name = trim( parts[1] ); - if ( name.indexOf("q=") === 0 ) { - name = name.substr( 2 ); - pri = parseFloat( name ); - pri = isNaN( pri ) ? 0 : pri; - } - else { - pri = 1; - } - } - prioritized.push({ lang: lang, pri: pri }); + + /** + * parse + * + * ref: http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns + */ + return function( value, pattern, cldr ) { + var amPm, era, hour24, valid, + YEAR = 0, + MONTH = 1, + DAY = 2, + HOUR = 3, + MINUTE = 4, + SECOND = 5, + MILLISECONDS = 6, + date = new Date(), + tokens = datetimeTokenizer( value, pattern, cldr ), + truncateAt = [], + units = [ "year", "month", "day", "hour", "minute", "second", "milliseconds" ]; + + if ( !tokens.length ) { + return null; } - prioritized.sort(function( a, b ) { - if ( a.pri < b.pri ) { - return 1; - } else if ( a.pri > b.pri ) { - return -1; + + valid = arrayEvery( tokens, function( token ) { + var century, chr, value, length; + + if ( token.type === "literal" ) { + // continue + return true; } - return 0; - }); - // exact match - for ( i = 0; i < l; i++ ) { - lang = prioritized[ i ].lang; - match = cultures[ lang ]; - if ( match ) { - return match; + + chr = token.type.charAt( 0 ); + length = token.type.length; + + if ( chr === "j" ) { + // Locale preferred hHKk. + // http://www.unicode.org/reports/tr35/tr35-dates.html#Time_Data + chr = cldr.supplemental.timeData.preferred(); } - } - // neutral language match - for ( i = 0; i < l; i++ ) { - lang = prioritized[ i ].lang; - do { - var index = lang.lastIndexOf( "-" ); - if ( index === -1 ) { + switch ( chr ) { + + // Era + case "G": + truncateAt.push( YEAR ); + era = +token.value; break; - } - // strip off the last part. e.g. en-US => en - lang = lang.substr( 0, index ); - match = cultures[ lang ]; - if ( match ) { - return match; - } + + // Year + case "y": + value = +token.lexeme; + if ( length === 2 ) { + if ( outOfRange( value, 0, 99 ) ) { + return false; + } + // mimic dojo/date/locale: choose century to apply, according to a sliding window of 80 years before and 20 years after present year. + century = Math.floor( date.getFullYear() / 100 ) * 100; + value += century; + if ( value > date.getFullYear() + 20 ) { + value -= 100; + } + } + date.setFullYear( value ); + truncateAt.push( YEAR ); + break; + + case "Y": // Year in "Week of Year" + case "u": // Extended year. Need to be implemented. + case "U": // Cyclic year name. Need to be implemented. + throw new Error( "Not implemented" ); + + // Quarter (skip) + case "Q": + case "q": + break; + + // Month + case "M": + case "L": + if ( length <= 2 ) { + value = +token.lexeme; + } else { + value = +token.value; + } + if( outOfRange( value, 1, 12 ) ) { + return false; + } + date.setMonth( value - 1 ); + truncateAt.push( MONTH ); + break; + + // Week (skip) + case "w": // Week of Year. + case "W": // Week of Month. + break; + + // Day + case "d": + value = +token.lexeme; + if( outOfRange( value, 1, 31 ) ) { + return false; + } + date.setDate( value ); + truncateAt.push( DAY ); + break; + + case "D": + value = +token.lexeme; + if( outOfRange( value, 1, 366 ) ) { + return false; + } + date.setMonth(0); + date.setDate( value ); + truncateAt.push( DAY ); + break; + + case "F": + // Day of Week in month. eg. 2nd Wed in July. + // Skip + break; + + case "g+": + // Modified Julian day. Need to be implemented. + throw new Error( "Not implemented" ); + + // Week day + case "e": + case "c": + case "E": + // Skip. + // value = arrayIndexOf( datetimeWeekDays, token.value ); + break; + + // Period (AM or PM) + case "a": + amPm = token.value; + break; + + // Hour + case "K": // 0-11 + value = +token.lexeme + 1; + + /* falls through */ + case "h": // 1-12 + value = value || +token.lexeme; + if( outOfRange( value, 1, 12 ) ) { + return false; + } + date.setHours( value ); + truncateAt.push( HOUR ); + break; + + case "H": // 0-23 + value = +token.lexeme + 1; + + /* falls through */ + case "k": // 1-24 + hour24 = true; + value = value || +token.lexeme; + if( outOfRange( value, 1, 24 ) ) { + return false; + } + date.setHours( value ); + truncateAt.push( HOUR ); + break; + + // Minute + case "m": + value = +token.lexeme; + if( outOfRange( value, 0, 59 ) ) { + return false; + } + date.setMinutes( value ); + truncateAt.push( MINUTE ); + break; + + // Second + case "s": + value = +token.lexeme; + if( outOfRange( value, 0, 59 ) ) { + return false; + } + date.setSeconds( value ); + truncateAt.push( SECOND ); + break; + + case "A": + date.setHours( 0 ); + date.setMinutes( 0 ); + date.setSeconds( 0 ); + + /* falls through */ + case "S": + value = Math.round( +token.lexeme * Math.pow( 10, 3 - length ) ); + date.setMilliseconds( value ); + truncateAt.push( MILLISECONDS ); + break; + + // Zone + // see http://www.unicode.org/reports/tr35/tr35-dates.html#Using_Time_Zone_Names ? + // Need to be implemented. + case "z": + case "Z": + case "O": + case "v": + case "V": + case "X": + case "x": + throw new Error( "Not implemented" ); } - while ( 1 ); + + return true; + }); + + if ( !valid || amPm && hour24 ) { + return null; } - // last resort: match first culture using that language - for ( i = 0; i < l; i++ ) { - lang = prioritized[ i ].lang; - for ( var cultureKey in cultures ) { - var culture = cultures[ cultureKey ]; - if ( culture.language === lang ) { - return culture; - } - } + if ( era === 0 ) { + // 1 BC = year 0 + date.setFullYear( date.getFullYear() * -1 + 1 ); } - } - else if ( typeof name === "object" ) { - return name; - } - return match || null; -}; -Globalize.format = function( value, format, cultureSelector ) { - var culture = this.findClosestCulture( cultureSelector ); - if ( value instanceof Date ) { - value = formatDate( value, format, culture ); - } - else if ( typeof value === "number" ) { - value = formatNumber( value, format, culture ); - } - return value; -}; + if ( amPm === "pm" && date.getHours() !== 12 ) { + date.setHours( date.getHours() + 12 ); + } -Globalize.localize = function( key, cultureSelector ) { - return this.findClosestCulture( cultureSelector ).messages[ key ] || - this.cultures[ "default" ].messages[ key ]; -}; + // Truncate date at the most precise unit defined. Eg. + // If value is "12/31", and pattern is "MM/dd": + // => new Date( <current Year>, 12, 31, 0, 0, 0, 0 ); + truncateAt = Math.max.apply( null, truncateAt ); + date = datetimeStartOf( date, units[ truncateAt ] ); -Globalize.parseDate = function( value, formats, culture ) { - culture = this.findClosestCulture( culture ); + return date; + }; - var date, prop, patterns; - if ( formats ) { - if ( typeof formats === "string" ) { - formats = [ formats ]; - } - if ( formats.length ) { - for ( var i = 0, l = formats.length; i < l; i++ ) { - var format = formats[ i ]; - if ( format ) { - date = parseExact( value, format, culture ); - if ( date ) { - break; - } - } - } +}()); + + + var arrayIsArray = Array.isArray || function( obj ) { + return Object.prototype.toString.call( obj ) === "[object Array]"; + }; + + + + + var alwaysArray = function( stringOrArray ) { + return arrayIsArray( stringOrArray ) ? stringOrArray : [ stringOrArray ]; + }; + + + + + var arraySome = function( array, callback ) { + var i, length; + if ( array.some ) { + return array.some( callback ); } - } else { - patterns = culture.calendar.patterns; - for ( prop in patterns ) { - date = parseExact( value, patterns[prop], culture ); - if ( date ) { - break; + for ( i = 0, length = array.length; i < length; i++ ) { + if ( callback( array[ i ], i, array ) ) { + return true; } } - } + return false; + }; - return date || null; -}; -Globalize.parseInt = function( value, radix, cultureSelector ) { - return truncate( Globalize.parseFloat(value, radix, cultureSelector) ); -}; -Globalize.parseFloat = function( value, radix, cultureSelector ) { - // radix argument is optional - if ( typeof radix !== "number" ) { - cultureSelector = radix; - radix = 10; - } - var culture = this.findClosestCulture( cultureSelector ); - var ret = NaN, - nf = culture.numberFormat; + var defaultLocale; - if ( value.indexOf(culture.numberFormat.currency.symbol) > -1 ) { - // remove currency symbol - value = value.replace( culture.numberFormat.currency.symbol, "" ); - // replace decimal seperator - value = value.replace( culture.numberFormat.currency["."], culture.numberFormat["."] ); + function getLocale( locale ) { + return locale ? new Cldr( locale ) : defaultLocale; } - //Remove percentage character from number string before parsing - if ( value.indexOf(culture.numberFormat.percent.symbol) > -1){ - value = value.replace( culture.numberFormat.percent.symbol, "" ); - } + var Globalize = {}; + + /** + * Globalize.load( json ) + * + * @json [JSON] + * + * Load resolved or unresolved cldr data. + * Somewhat equivalent to previous Globalize.addCultureInfo(...). + */ + Globalize.load = function( json ) { + Cldr.load( json ); + }; - // remove spaces: leading, trailing and between - and number. Used for negative currency pt-BR - value = value.replace( / /g, "" ); + /** + * Globalize.loadTranslations( locale, json ) + * + * @locale [String] + * + * @json [JSON] + * + * Load translation data per locale. + */ + Globalize.loadTranslations = function( locale, json ) { + var customData = { + "globalize-translation": {} + }; + locale = new Cldr( locale ); + customData[ "globalize-translation" ][ locale.attributes.languageId ] = json; + Cldr.load( customData ); + }; - // allow infinity or hexidecimal - if ( regexInfinity.test(value) ) { - ret = parseFloat( value ); - } - else if ( !radix && regexHex.test(value) ) { - ret = parseInt( value, 16 ); - } - else { - - // determine sign and number - var signInfo = parseNegativePattern( value, nf, nf.pattern[0] ), - sign = signInfo[ 0 ], - num = signInfo[ 1 ]; - - // #44 - try parsing as "(n)" - if ( sign === "" && nf.pattern[0] !== "(n)" ) { - signInfo = parseNegativePattern( value, nf, "(n)" ); - sign = signInfo[ 0 ]; - num = signInfo[ 1 ]; - } + /** + * Globalize.locale( locale ) + * + * @locale [String] + * + * Set default locale. + * Somewhat equivalent to previous culture( selector ). + */ + Globalize.locale = function( locale ) { + if ( arguments.length ) { + defaultLocale = new Cldr( locale ); + } + return defaultLocale; + }; - // try parsing as "-n" - if ( sign === "" && nf.pattern[0] !== "-n" ) { - signInfo = parseNegativePattern( value, nf, "-n" ); - sign = signInfo[ 0 ]; - num = signInfo[ 1 ]; - } + /** + * Globalize.format( value, pattern, locale ) + * + * @value [Date or Number] + * + * @pattern [String or Object] see datetime/expand_pattern for more info. + * + * @locale [String] + * + * Formats a date or number according to the given pattern string and the given locale (or the default locale if not specified). + */ + Globalize.format = function( value, pattern, locale ) { + locale = getLocale( locale ); + + if ( value instanceof Date ) { + + if ( !pattern ) { + throw new Error( "Missing pattern" ); + } + pattern = datetimeExpandPattern( pattern, locale ); - sign = sign || "+"; + value = datetimeFormat( value, pattern, locale ); - // determine exponent and number - var exponent, - intAndFraction, - exponentPos = num.indexOf( "e" ); - if ( exponentPos < 0 ) exponentPos = num.indexOf( "E" ); - if ( exponentPos < 0 ) { - intAndFraction = num; - exponent = null; - } - else { - intAndFraction = num.substr( 0, exponentPos ); - exponent = num.substr( exponentPos + 1 ); - } - // determine decimal position - var integer, - fraction, - decSep = nf[ "." ], - decimalPos = intAndFraction.indexOf( decSep ); - if ( decimalPos < 0 ) { - integer = intAndFraction; - fraction = null; + } else if ( typeof value === "number" ) { + // TODO value = numberFormat( value, pattern, locale ); + throw new Error( "Number Format not implemented yet" ); } - else { - integer = intAndFraction.substr( 0, decimalPos ); - fraction = intAndFraction.substr( decimalPos + decSep.length ); - } - // handle groups (e.g. 1,000,000) - var groupSep = nf[ "," ]; - integer = integer.split( groupSep ).join( "" ); - var altGroupSep = groupSep.replace( /\u00A0/g, " " ); - if ( groupSep !== altGroupSep ) { - integer = integer.split( altGroupSep ).join( "" ); - } - // build a natively parsable number string - var p = sign + integer; - if ( fraction !== null ) { - p += "." + fraction; - } - if ( exponent !== null ) { - // exponent itself may have a number patternd - var expSignInfo = parseNegativePattern( exponent, nf, "-n" ); - p += "e" + ( expSignInfo[0] || "+" ) + expSignInfo[ 1 ]; - } - if ( regexParseFloat.test(p) ) { - ret = parseFloat( p ); - } - } - return ret; -}; -Globalize.culture = function( cultureSelector ) { - // setter - if ( typeof cultureSelector !== "undefined" ) { - this.cultureSelector = cultureSelector; - } - // getter - return this.findClosestCulture( cultureSelector ) || this.cultures[ "default" ]; -}; + return value; + }; + + /** + * Globalize.parseDate( value, patterns, locale ) + * + * @value [Date] + * + * @patterns [Array] Optional. See datetime/expand_pattern for more info about each pattern. Defaults to the list of all presets defined in the locale (see datetime/all_presets for more info). + * + * @locale [String] + * + * Return a Date instance or null. + */ + Globalize.parseDate = function( value, patterns, locale ) { + var date; + locale = getLocale( locale ); + + if ( typeof value !== "string" ) { + throw new Error( "invalid value (" + value + "), string expected" ); + } + + if ( !patterns ) { + patterns = datetimeAllPresets( locale ); + } else { + patterns = alwaysArray( patterns ); + } + + arraySome( patterns, function( pattern ) { + pattern = datetimeExpandPattern( pattern, locale ); + date = datetimeParse( value, pattern, locale ); + return !!date; + }); + + return date || null; + }; + + /** + * Globalize.translate( path, locale ) + * + * @path [String or Array] + * + * @locale [String] + * + * Translate item given its path. + */ + Globalize.translate = function( path , locale ) { + locale = getLocale( locale ); + path = alwaysArray( path ); + return locale.get( [ "globalize-translation/{languageId}" ].concat( path ) ); + }; + + return Globalize; + + -}( this ));
\ No newline at end of file +})); diff --git a/external/localization.js b/external/localization.js index d81e997b5..98d8f8130 100644 --- a/external/localization.js +++ b/external/localization.js @@ -1,436 +1,3119 @@ -// regional data +/** + * CLDR locale data + */ +Globalize.load({ + "main": { + "en": { + "identity": { + "version": { + "_cldrVersion": "24", + "_number": "$Revision: 9287 $" + }, + "generation": { + "_date": "$Date: 2013-08-28 21:32:04 -0500 (Wed, 28 Aug 2013) $" + }, + "language": "en" + }, + "dates": { + "calendars": { + "gregorian": { + "months": { + "format": { + "abbreviated": { + "1": "Jan", + "2": "Feb", + "3": "Mar", + "4": "Apr", + "5": "May", + "6": "Jun", + "7": "Jul", + "8": "Aug", + "9": "Sep", + "10": "Oct", + "11": "Nov", + "12": "Dec" + }, + "narrow": { + "1": "J", + "2": "F", + "3": "M", + "4": "A", + "5": "M", + "6": "J", + "7": "J", + "8": "A", + "9": "S", + "10": "O", + "11": "N", + "12": "D" + }, + "wide": { + "1": "January", + "2": "February", + "3": "March", + "4": "April", + "5": "May", + "6": "June", + "7": "July", + "8": "August", + "9": "September", + "10": "October", + "11": "November", + "12": "December" + } + }, + "stand-alone": { + "abbreviated": { + "1": "Jan", + "2": "Feb", + "3": "Mar", + "4": "Apr", + "5": "May", + "6": "Jun", + "7": "Jul", + "8": "Aug", + "9": "Sep", + "10": "Oct", + "11": "Nov", + "12": "Dec" + }, + "narrow": { + "1": "J", + "2": "F", + "3": "M", + "4": "A", + "5": "M", + "6": "J", + "7": "J", + "8": "A", + "9": "S", + "10": "O", + "11": "N", + "12": "D" + }, + "wide": { + "1": "January", + "2": "February", + "3": "March", + "4": "April", + "5": "May", + "6": "June", + "7": "July", + "8": "August", + "9": "September", + "10": "October", + "11": "November", + "12": "December" + } + } + }, + "days": { + "format": { + "abbreviated": { + "sun": "Sun", + "mon": "Mon", + "tue": "Tue", + "wed": "Wed", + "thu": "Thu", + "fri": "Fri", + "sat": "Sat" + }, + "narrow": { + "sun": "S", + "mon": "M", + "tue": "T", + "wed": "W", + "thu": "T", + "fri": "F", + "sat": "S" + }, + "short": { + "sun": "Su", + "mon": "Mo", + "tue": "Tu", + "wed": "We", + "thu": "Th", + "fri": "Fr", + "sat": "Sa" + }, + "wide": { + "sun": "Sunday", + "mon": "Monday", + "tue": "Tuesday", + "wed": "Wednesday", + "thu": "Thursday", + "fri": "Friday", + "sat": "Saturday" + } + }, + "stand-alone": { + "abbreviated": { + "sun": "Sun", + "mon": "Mon", + "tue": "Tue", + "wed": "Wed", + "thu": "Thu", + "fri": "Fri", + "sat": "Sat" + }, + "narrow": { + "sun": "S", + "mon": "M", + "tue": "T", + "wed": "W", + "thu": "T", + "fri": "F", + "sat": "S" + }, + "short": { + "sun": "Su", + "mon": "Mo", + "tue": "Tu", + "wed": "We", + "thu": "Th", + "fri": "Fr", + "sat": "Sa" + }, + "wide": { + "sun": "Sunday", + "mon": "Monday", + "tue": "Tuesday", + "wed": "Wednesday", + "thu": "Thursday", + "fri": "Friday", + "sat": "Saturday" + } + } + }, + "quarters": { + "format": { + "abbreviated": { + "1": "Q1", + "2": "Q2", + "3": "Q3", + "4": "Q4" + }, + "narrow": { + "1": "1", + "2": "2", + "3": "3", + "4": "4" + }, + "wide": { + "1": "1st quarter", + "2": "2nd quarter", + "3": "3rd quarter", + "4": "4th quarter" + } + }, + "stand-alone": { + "abbreviated": { + "1": "Q1", + "2": "Q2", + "3": "Q3", + "4": "Q4" + }, + "narrow": { + "1": "1", + "2": "2", + "3": "3", + "4": "4" + }, + "wide": { + "1": "1st quarter", + "2": "2nd quarter", + "3": "3rd quarter", + "4": "4th quarter" + } + } + }, + "dayPeriods": { + "format": { + "abbreviated": { + "am": "AM", + "am-alt-variant": "a.m.", + "noon": "noon", + "pm": "PM", + "pm-alt-variant": "p.m." + }, + "narrow": { + "am": "a", + "am-alt-variant": "a.m.", + "noon": "n", + "pm": "p", + "pm-alt-variant": "p.m." + }, + "wide": { + "am": "AM", + "am-alt-variant": "a.m.", + "noon": "noon", + "pm": "PM", + "pm-alt-variant": "p.m." + } + }, + "stand-alone": { + "abbreviated": { + "am": "AM", + "am-alt-variant": "a.m.", + "noon": "noon", + "pm": "PM", + "pm-alt-variant": "p.m." + }, + "narrow": { + "am": "a", + "am-alt-variant": "a.m.", + "noon": "n", + "pm": "p", + "pm-alt-variant": "p.m." + }, + "wide": { + "am": "AM", + "am-alt-variant": "a.m.", + "noon": "noon", + "pm": "PM", + "pm-alt-variant": "p.m." + } + } + }, + "eras": { + "eraNames": { + "0": "Before Christ", + "0-alt-variant": "Before Common Era", + "1": "Anno Domini", + "1-alt-variant": "Common Era" + }, + "eraAbbr": { + "0": "BC", + "0-alt-variant": "BCE", + "1": "AD", + "1-alt-variant": "CE" + }, + "eraNarrow": { + "0": "B", + "0-alt-variant": "BCE", + "1": "A", + "1-alt-variant": "CE" + } + }, + "dateFormats": { + "full": "EEEE, MMMM d, y", + "long": "MMMM d, y", + "medium": "MMM d, y", + "short": "M/d/yy" + }, + "timeFormats": { + "full": "h:mm:ss a zzzz", + "long": "h:mm:ss a z", + "medium": "h:mm:ss a", + "short": "h:mm a" + }, + "dateTimeFormats": { + "full": "{1} 'at' {0}", + "long": "{1} 'at' {0}", + "medium": "{1}, {0}", + "short": "{1}, {0}", + "availableFormats": { + "d": "d", + "Ed": "d E", + "Ehm": "E h:mm a", + "EHm": "E HH:mm", + "Ehms": "E h:mm:ss a", + "EHms": "E HH:mm:ss", + "Gy": "y G", + "GyMMM": "MMM y G", + "GyMMMd": "MMM d, y G", + "GyMMMEd": "E, MMM d, y G", + "h": "h a", + "H": "HH", + "hm": "h:mm a", + "Hm": "HH:mm", + "hms": "h:mm:ss a", + "Hms": "HH:mm:ss", + "M": "L", + "Md": "M/d", + "MEd": "E, M/d", + "MMM": "LLL", + "MMMd": "MMM d", + "MMMEd": "E, MMM d", + "ms": "mm:ss", + "y": "y", + "yM": "M/y", + "yMd": "M/d/y", + "yMEd": "E, M/d/y", + "yMMM": "MMM y", + "yMMMd": "MMM d, y", + "yMMMEd": "E, MMM d, y", + "yQQQ": "QQQ y", + "yQQQQ": "QQQQ y" + }, + "appendItems": { + "Day": "{0} ({2}: {1})", + "Day-Of-Week": "{0} {1}", + "Era": "{0} {1}", + "Hour": "{0} ({2}: {1})", + "Minute": "{0} ({2}: {1})", + "Month": "{0} ({2}: {1})", + "Quarter": "{0} ({2}: {1})", + "Second": "{0} ({2}: {1})", + "Timezone": "{0} {1}", + "Week": "{0} ({2}: {1})", + "Year": "{0} {1}" + }, + "intervalFormats": { + "intervalFormatFallback": "{0} – {1}", + "d": { + "d": "d – d" + }, + "h": { + "a": "h a – h a", + "h": "h – h a" + }, + "H": { + "H": "HH – HH" + }, + "hm": { + "a": "h:mm a – h:mm a", + "h": "h:mm – h:mm a", + "m": "h:mm – h:mm a" + }, + "Hm": { + "H": "HH:mm – HH:mm", + "m": "HH:mm – HH:mm" + }, + "hmv": { + "a": "h:mm a – h:mm a v", + "h": "h:mm – h:mm a v", + "m": "h:mm – h:mm a v" + }, + "Hmv": { + "H": "HH:mm – HH:mm v", + "m": "HH:mm – HH:mm v" + }, + "hv": { + "a": "h a – h a v", + "h": "h – h a v" + }, + "Hv": { + "H": "HH – HH v" + }, + "M": { + "M": "M – M" + }, + "Md": { + "d": "M/d – M/d", + "M": "M/d – M/d" + }, + "MEd": { + "d": "E, M/d – E, M/d", + "M": "E, M/d – E, M/d" + }, + "MMM": { + "M": "MMM – MMM" + }, + "MMMd": { + "d": "MMM d – d", + "M": "MMM d – MMM d" + }, + "MMMEd": { + "d": "E, MMM d – E, MMM d", + "M": "E, MMM d – E, MMM d" + }, + "y": { + "y": "y – y" + }, + "yM": { + "M": "M/y – M/y", + "y": "M/y – M/y" + }, + "yMd": { + "d": "M/d/y – M/d/y", + "M": "M/d/y – M/d/y", + "y": "M/d/y – M/d/y" + }, + "yMEd": { + "d": "E, M/d/y – E, M/d/y", + "M": "E, M/d/y – E, M/d/y", + "y": "E, M/d/y – E, M/d/y" + }, + "yMMM": { + "M": "MMM – MMM y", + "y": "MMM y – MMM y" + }, + "yMMMd": { + "d": "MMM d – d, y", + "M": "MMM d – MMM d, y", + "y": "MMM d, y – MMM d, y" + }, + "yMMMEd": { + "d": "E, MMM d – E, MMM d, y", + "M": "E, MMM d – E, MMM d, y", + "y": "E, MMM d, y – E, MMM d, y" + }, + "yMMMM": { + "M": "MMMM – MMMM y", + "y": "MMMM y – MMMM y" + } + } + } + } + } + } + } + } +}); + +Globalize.load({ + "main": { + "de": { + "identity": { + "version": { + "_cldrVersion": "24", + "_number": "$Revision: 9287 $" + }, + "generation": { + "_date": "$Date: 2013-08-28 21:32:04 -0500 (Wed, 28 Aug 2013) $" + }, + "language": "de" + }, + "dates": { + "calendars": { + "gregorian": { + "months": { + "format": { + "abbreviated": { + "1": "Jan.", + "2": "Feb.", + "3": "März", + "4": "Apr.", + "5": "Mai", + "6": "Juni", + "7": "Juli", + "8": "Aug.", + "9": "Sep.", + "10": "Okt.", + "11": "Nov.", + "12": "Dez." + }, + "narrow": { + "1": "J", + "2": "F", + "3": "M", + "4": "A", + "5": "M", + "6": "J", + "7": "J", + "8": "A", + "9": "S", + "10": "O", + "11": "N", + "12": "D" + }, + "wide": { + "1": "Januar", + "2": "Februar", + "3": "März", + "4": "April", + "5": "Mai", + "6": "Juni", + "7": "Juli", + "8": "August", + "9": "September", + "10": "Oktober", + "11": "November", + "12": "Dezember" + } + }, + "stand-alone": { + "abbreviated": { + "1": "Jan", + "2": "Feb", + "3": "Mär", + "4": "Apr", + "5": "Mai", + "6": "Jun", + "7": "Jul", + "8": "Aug", + "9": "Sep", + "10": "Okt", + "11": "Nov", + "12": "Dez" + }, + "narrow": { + "1": "J", + "2": "F", + "3": "M", + "4": "A", + "5": "M", + "6": "J", + "7": "J", + "8": "A", + "9": "S", + "10": "O", + "11": "N", + "12": "D" + }, + "wide": { + "1": "Januar", + "2": "Februar", + "3": "März", + "4": "April", + "5": "Mai", + "6": "Juni", + "7": "Juli", + "8": "August", + "9": "September", + "10": "Oktober", + "11": "November", + "12": "Dezember" + } + } + }, + "days": { + "format": { + "abbreviated": { + "sun": "So.", + "mon": "Mo.", + "tue": "Di.", + "wed": "Mi.", + "thu": "Do.", + "fri": "Fr.", + "sat": "Sa." + }, + "narrow": { + "sun": "S", + "mon": "M", + "tue": "D", + "wed": "M", + "thu": "D", + "fri": "F", + "sat": "S" + }, + "short": { + "sun": "So.", + "mon": "Mo.", + "tue": "Di.", + "wed": "Mi.", + "thu": "Do.", + "fri": "Fr.", + "sat": "Sa." + }, + "wide": { + "sun": "Sonntag", + "mon": "Montag", + "tue": "Dienstag", + "wed": "Mittwoch", + "thu": "Donnerstag", + "fri": "Freitag", + "sat": "Samstag" + } + }, + "stand-alone": { + "abbreviated": { + "sun": "So", + "mon": "Mo", + "tue": "Di", + "wed": "Mi", + "thu": "Do", + "fri": "Fr", + "sat": "Sa" + }, + "narrow": { + "sun": "S", + "mon": "M", + "tue": "D", + "wed": "M", + "thu": "D", + "fri": "F", + "sat": "S" + }, + "short": { + "sun": "So.", + "mon": "Mo.", + "tue": "Di.", + "wed": "Mi.", + "thu": "Do.", + "fri": "Fr.", + "sat": "Sa." + }, + "wide": { + "sun": "Sonntag", + "mon": "Montag", + "tue": "Dienstag", + "wed": "Mittwoch", + "thu": "Donnerstag", + "fri": "Freitag", + "sat": "Samstag" + } + } + }, + "quarters": { + "format": { + "abbreviated": { + "1": "Q1", + "2": "Q2", + "3": "Q3", + "4": "Q4" + }, + "narrow": { + "1": "1", + "2": "2", + "3": "3", + "4": "4" + }, + "wide": { + "1": "1. Quartal", + "2": "2. Quartal", + "3": "3. Quartal", + "4": "4. Quartal" + } + }, + "stand-alone": { + "abbreviated": { + "1": "Q1", + "2": "Q2", + "3": "Q3", + "4": "Q4" + }, + "narrow": { + "1": "1", + "2": "2", + "3": "3", + "4": "4" + }, + "wide": { + "1": "1. Quartal", + "2": "2. Quartal", + "3": "3. Quartal", + "4": "4. Quartal" + } + } + }, + "dayPeriods": { + "format": { + "abbreviated": { + "afternoon": "nachmittags", + "am": "vorm.", + "earlyMorning": "morgens", + "evening": "abends", + "morning": "vormittags", + "night": "nachts", + "noon": "Mittag", + "pm": "nachm." + }, + "narrow": { + "afternoon": "nachmittags", + "am": "vorm.", + "earlyMorning": "morgens", + "evening": "abends", + "morning": "vormittags", + "night": "nachts", + "noon": "Mittag", + "pm": "nachm." + }, + "wide": { + "afternoon": "nachmittags", + "am": "vorm.", + "earlyMorning": "morgens", + "evening": "abends", + "morning": "vormittags", + "night": "nachts", + "noon": "Mittag", + "pm": "nachm." + } + }, + "stand-alone": { + "abbreviated": { + "afternoon": "nachmittags", + "am": "vorm.", + "earlyMorning": "morgens", + "evening": "abends", + "morning": "vormittags", + "night": "nachts", + "noon": "Mittag", + "pm": "nachm." + }, + "narrow": { + "afternoon": "nachmittags", + "am": "vorm.", + "earlyMorning": "morgens", + "evening": "abends", + "morning": "vormittags", + "night": "nachts", + "noon": "Mittag", + "pm": "nachm." + }, + "wide": { + "afternoon": "Nachmittag", + "am": "vorm.", + "earlyMorning": "Morgen", + "evening": "Abend", + "morning": "Vormittag", + "night": "Nacht", + "noon": "Mittag", + "pm": "nachm." + } + } + }, + "eras": { + "eraNames": { + "0": "v. Chr.", + "0-alt-variant": "vor der gewöhnlichen Zeitrechnung", + "1": "n. Chr.", + "1-alt-variant": "der gewöhnlichen Zeitrechnung" + }, + "eraAbbr": { + "0": "v. Chr.", + "0-alt-variant": "v. u. Z.", + "1": "n. Chr.", + "1-alt-variant": "u. Z." + }, + "eraNarrow": { + "0": "v. Chr.", + "0-alt-variant": "vdZ", + "1": "n. Chr.", + "1-alt-variant": "dZ" + } + }, + "dateFormats": { + "full": "EEEE, d. MMMM y", + "long": "d. MMMM y", + "medium": "dd.MM.y", + "short": "dd.MM.yy" + }, + "timeFormats": { + "full": "HH:mm:ss zzzz", + "long": "HH:mm:ss z", + "medium": "HH:mm:ss", + "short": "HH:mm" + }, + "dateTimeFormats": { + "full": "{1} {0}", + "long": "{1} {0}", + "medium": "{1} {0}", + "short": "{1} {0}", + "availableFormats": { + "d": "d", + "Ed": "E, d.", + "Ehm": "E h:mm a", + "EHm": "E, HH:mm", + "Ehms": "E, h:mm:ss a", + "EHms": "E, HH:mm:ss", + "Gy": "y G", + "GyMMM": "MMM y G", + "GyMMMd": "d. MMM y G", + "GyMMMEd": "E, d. MMM y G", + "h": "h a", + "H": "HH 'Uhr'", + "hm": "h:mm a", + "Hm": "HH:mm", + "hms": "h:mm:ss a", + "Hms": "HH:mm:ss", + "M": "L", + "Md": "d.M.", + "MEd": "E, d.M.", + "MMd": "d.MM.", + "MMdd": "dd.MM.", + "MMM": "LLL", + "MMMd": "d. MMM", + "MMMEd": "E, d. MMM", + "MMMMdd": "dd. MMMM", + "MMMMEd": "E, d. MMMM", + "ms": "mm:ss", + "y": "y", + "yM": "M.y", + "yMd": "d.M.y", + "yMEd": "E, d.M.y", + "yMM": "MM.y", + "yMMdd": "dd.MM.y", + "yMMM": "MMM y", + "yMMMd": "d. MMM y", + "yMMMEd": "E, d. MMM y", + "yMMMM": "MMMM y", + "yQQQ": "QQQ y", + "yQQQQ": "QQQQ y" + }, + "appendItems": { + "Day": "{0} ({2}: {1})", + "Day-Of-Week": "{0} {1}", + "Era": "{1} {0}", + "Hour": "{0} ({2}: {1})", + "Minute": "{0} ({2}: {1})", + "Month": "{0} ({2}: {1})", + "Quarter": "{0} ({2}: {1})", + "Second": "{0} ({2}: {1})", + "Timezone": "{0} {1}", + "Week": "{0} ({2}: {1})", + "Year": "{1} {0}" + }, + "intervalFormats": { + "intervalFormatFallback": "{0} - {1}", + "d": { + "d": "d.-d." + }, + "h": { + "a": "h a - h a", + "h": "h-h a" + }, + "H": { + "H": "HH-HH 'Uhr'" + }, + "hm": { + "a": "h:mm a - h:mm a", + "h": "h:mm-h:mm a", + "m": "h:mm-h:mm a" + }, + "Hm": { + "H": "HH:mm-HH:mm", + "m": "HH:mm-HH:mm" + }, + "hmv": { + "a": "h:mm a - h:mm a v", + "h": "h:mm-h:mm a v", + "m": "h:mm-h:mm a v" + }, + "Hmv": { + "H": "HH:mm-HH:mm v", + "m": "HH:mm-HH:mm v" + }, + "hv": { + "a": "h a - h a v", + "h": "h-h a v" + }, + "Hv": { + "H": "HH-HH 'Uhr' v" + }, + "M": { + "M": "M.-M." + }, + "Md": { + "d": "dd.MM. - dd.MM.", + "M": "dd.MM. - dd.MM." + }, + "MEd": { + "d": "E, dd.MM. - E, dd.MM.", + "M": "E, dd.MM. - E, dd.MM." + }, + "MMM": { + "M": "MMM-MMM" + }, + "MMMd": { + "d": "d.-d. MMM", + "M": "d. MMM - d. MMM" + }, + "MMMEd": { + "d": "E, d. - E, d. MMM", + "M": "E, d. MMM - E, d. MMM" + }, + "MMMM": { + "M": "LLLL-LLLL" + }, + "y": { + "y": "y-y" + }, + "yM": { + "M": "MM.y - MM.y", + "y": "MM.y - MM.y" + }, + "yMd": { + "d": "dd.MM.y - dd.MM.y", + "M": "dd.MM.y - dd.MM.y", + "y": "dd.MM.y - dd.MM.y" + }, + "yMEd": { + "d": "E, dd.MM.y - E, dd.MM.y", + "M": "E, dd.MM.y - E, dd.MM.y", + "y": "E, dd.MM.y - E, dd.MM.y" + }, + "yMMM": { + "M": "MMM-MMM y", + "y": "MMM y - MMM y" + }, + "yMMMd": { + "d": "d.-d. MMM y", + "M": "d. MMM - d. MMM y", + "y": "d. MMM y - d. MMM y" + }, + "yMMMEd": { + "d": "E, d. - E, d. MMM y", + "M": "E, d. MMM - E, d. MMM y", + "y": "E, d. MMM y - E, d. MMM y" + }, + "yMMMM": { + "M": "MMMM-MMMM y", + "y": "MMMM y - MMMM y" + } + } + } + } + } + } + } + } +}); + +/** + * CLDR supplemental data + */ + +// likelySubtags +Globalize.load({ + "supplemental": { + "version": { + "_cldrVersion": "24", + "_number": "$Revision: 9305 $" + }, + "generation": { + "_date": "$Date: 2013-09-04 09:50:17 -0500 (Wed, 04 Sep 2013) $" + }, + "likelySubtags": { + "aa": "aa_Latn_ET", + "ab": "ab_Cyrl_GE", + "ace": "ace_Latn_ID", + "ady": "ady_Cyrl_RU", + "af": "af_Latn_ZA", + "agq": "agq_Latn_CM", + "ak": "ak_Latn_GH", + "alt": "alt_Cyrl_RU", + "am": "am_Ethi_ET", + "amo": "amo_Latn_NG", + "ar": "ar_Arab_EG", + "as": "as_Beng_IN", + "asa": "asa_Latn_TZ", + "ast": "ast_Latn_ES", + "av": "av_Cyrl_RU", + "awa": "awa_Deva_IN", + "ay": "ay_Latn_BO", + "az": "az_Latn_AZ", + "az_Arab": "az_Arab_IR", + "az_IR": "az_Arab_IR", + "az_RU": "az_Cyrl_RU", + "ba": "ba_Cyrl_RU", + "bal": "bal_Arab_PK", + "ban": "ban_Latn_ID", + "bas": "bas_Latn_CM", + "bax": "bax_Bamu_CM", + "bbc": "bbc_Latn_ID", + "be": "be_Cyrl_BY", + "bem": "bem_Latn_ZM", + "bez": "bez_Latn_TZ", + "bfq": "bfq_Taml_IN", + "bft": "bft_Arab_PK", + "bfy": "bfy_Deva_IN", + "bg": "bg_Cyrl_BG", + "bhb": "bhb_Deva_IN", + "bho": "bho_Deva_IN", + "bi": "bi_Latn_VU", + "bik": "bik_Latn_PH", + "bin": "bin_Latn_NG", + "bjj": "bjj_Deva_IN", + "bku": "bku_Latn_PH", + "bm": "bm_Latn_ML", + "bn": "bn_Beng_BD", + "bo": "bo_Tibt_CN", + "bqv": "bqv_Latn_CI", + "br": "br_Latn_FR", + "bra": "bra_Deva_IN", + "brx": "brx_Deva_IN", + "bs": "bs_Latn_BA", + "bss": "bss_Latn_CM", + "btv": "btv_Deva_PK", + "bua": "bua_Cyrl_RU", + "buc": "buc_Latn_YT", + "bug": "bug_Latn_ID", + "bya": "bya_Latn_ID", + "byn": "byn_Ethi_ER", + "ca": "ca_Latn_ES", + "cch": "cch_Latn_NG", + "ccp": "ccp_Beng_IN", + "ce": "ce_Cyrl_RU", + "ceb": "ceb_Latn_PH", + "cgg": "cgg_Latn_UG", + "ch": "ch_Latn_GU", + "chk": "chk_Latn_FM", + "chm": "chm_Cyrl_RU", + "chp": "chp_Latn_CA", + "chr": "chr_Cher_US", + "cja": "cja_Arab_KH", + "cjm": "cjm_Cham_VN", + "ckb": "ckb_Arab_IQ", + "co": "co_Latn_FR", + "cr": "cr_Cans_CA", + "crk": "crk_Cans_CA", + "cs": "cs_Latn_CZ", + "csb": "csb_Latn_PL", + "cv": "cv_Cyrl_RU", + "cy": "cy_Latn_GB", + "da": "da_Latn_DK", + "dar": "dar_Cyrl_RU", + "dav": "dav_Latn_KE", + "de": "de_Latn_DE", + "den": "den_Latn_CA", + "dgr": "dgr_Latn_CA", + "dje": "dje_Latn_NE", + "doi": "doi_Arab_IN", + "dsb": "dsb_Latn_DE", + "dua": "dua_Latn_CM", + "dv": "dv_Thaa_MV", + "dyo": "dyo_Latn_SN", + "dyu": "dyu_Latn_BF", + "dz": "dz_Tibt_BT", + "ebu": "ebu_Latn_KE", + "ee": "ee_Latn_GH", + "efi": "efi_Latn_NG", + "el": "el_Grek_GR", + "en": "en_Latn_US", + "eo": "eo_Latn_001", + "es": "es_Latn_ES", + "et": "et_Latn_EE", + "eu": "eu_Latn_ES", + "ewo": "ewo_Latn_CM", + "fa": "fa_Arab_IR", + "fan": "fan_Latn_GQ", + "ff": "ff_Latn_SN", + "fi": "fi_Latn_FI", + "fil": "fil_Latn_PH", + "fj": "fj_Latn_FJ", + "fo": "fo_Latn_FO", + "fon": "fon_Latn_BJ", + "fr": "fr_Latn_FR", + "fur": "fur_Latn_IT", + "fy": "fy_Latn_NL", + "ga": "ga_Latn_IE", + "gaa": "gaa_Latn_GH", + "gag": "gag_Latn_MD", + "gbm": "gbm_Deva_IN", + "gcr": "gcr_Latn_GF", + "gd": "gd_Latn_GB", + "gez": "gez_Ethi_ET", + "gil": "gil_Latn_KI", + "gl": "gl_Latn_ES", + "gn": "gn_Latn_PY", + "gon": "gon_Telu_IN", + "gor": "gor_Latn_ID", + "grt": "grt_Beng_IN", + "gsw": "gsw_Latn_CH", + "gu": "gu_Gujr_IN", + "guz": "guz_Latn_KE", + "gv": "gv_Latn_IM", + "gwi": "gwi_Latn_CA", + "ha": "ha_Latn_NG", + "ha_CM": "ha_Arab_CM", + "ha_SD": "ha_Arab_SD", + "haw": "haw_Latn_US", + "he": "he_Hebr_IL", + "hi": "hi_Deva_IN", + "hil": "hil_Latn_PH", + "hne": "hne_Deva_IN", + "hnn": "hnn_Latn_PH", + "ho": "ho_Latn_PG", + "hoc": "hoc_Deva_IN", + "hoj": "hoj_Deva_IN", + "hr": "hr_Latn_HR", + "ht": "ht_Latn_HT", + "hu": "hu_Latn_HU", + "hy": "hy_Armn_AM", + "ia": "ia_Latn_FR", + "ibb": "ibb_Latn_NG", + "id": "id_Latn_ID", + "ig": "ig_Latn_NG", + "ii": "ii_Yiii_CN", + "ik": "ik_Latn_US", + "ilo": "ilo_Latn_PH", + "in": "in_Latn_ID", + "inh": "inh_Cyrl_RU", + "is": "is_Latn_IS", + "it": "it_Latn_IT", + "iu": "iu_Cans_CA", + "iw": "iw_Hebr_IL", + "ja": "ja_Jpan_JP", + "jgo": "jgo_Latn_CM", + "ji": "ji_Hebr_UA", + "jmc": "jmc_Latn_TZ", + "jv": "jv_Latn_ID", + "jw": "jw_Latn_ID", + "ka": "ka_Geor_GE", + "kaa": "kaa_Cyrl_UZ", + "kab": "kab_Latn_DZ", + "kaj": "kaj_Latn_NG", + "kam": "kam_Latn_KE", + "kbd": "kbd_Cyrl_RU", + "kcg": "kcg_Latn_NG", + "kde": "kde_Latn_TZ", + "kdt": "kdt_Thai_TH", + "kea": "kea_Latn_CV", + "ken": "ken_Latn_CM", + "kfo": "kfo_Latn_CI", + "kfr": "kfr_Deva_IN", + "kg": "kg_Latn_CD", + "kha": "kha_Latn_IN", + "khb": "khb_Talu_CN", + "khq": "khq_Latn_ML", + "kht": "kht_Mymr_IN", + "ki": "ki_Latn_KE", + "kj": "kj_Latn_NA", + "kk": "kk_Cyrl_KZ", + "kk_AF": "kk_Arab_AF", + "kk_Arab": "kk_Arab_CN", + "kk_CN": "kk_Arab_CN", + "kk_IR": "kk_Arab_IR", + "kk_MN": "kk_Arab_MN", + "kkj": "kkj_Latn_CM", + "kl": "kl_Latn_GL", + "kln": "kln_Latn_KE", + "km": "km_Khmr_KH", + "kmb": "kmb_Latn_AO", + "kn": "kn_Knda_IN", + "ko": "ko_Kore_KR", + "koi": "koi_Cyrl_RU", + "kok": "kok_Deva_IN", + "kos": "kos_Latn_FM", + "kpe": "kpe_Latn_LR", + "krc": "krc_Cyrl_RU", + "kri": "kri_Latn_SL", + "krl": "krl_Latn_RU", + "kru": "kru_Deva_IN", + "ks": "ks_Arab_IN", + "ksb": "ksb_Latn_TZ", + "ksf": "ksf_Latn_CM", + "ksh": "ksh_Latn_DE", + "ku": "ku_Latn_TR", + "ku_Arab": "ku_Arab_IQ", + "ku_LB": "ku_Arab_LB", + "kum": "kum_Cyrl_RU", + "kv": "kv_Cyrl_RU", + "kw": "kw_Latn_GB", + "ky": "ky_Cyrl_KG", + "ky_Arab": "ky_Arab_CN", + "ky_CN": "ky_Arab_CN", + "ky_Latn": "ky_Latn_TR", + "ky_TR": "ky_Latn_TR", + "la": "la_Latn_VA", + "lag": "lag_Latn_TZ", + "lah": "lah_Arab_PK", + "lb": "lb_Latn_LU", + "lbe": "lbe_Cyrl_RU", + "lcp": "lcp_Thai_CN", + "lep": "lep_Lepc_IN", + "lez": "lez_Cyrl_RU", + "lg": "lg_Latn_UG", + "li": "li_Latn_NL", + "lif": "lif_Deva_NP", + "lis": "lis_Lisu_CN", + "lki": "lki_Arab_IR", + "lkt": "lkt_Latn_US", + "lmn": "lmn_Telu_IN", + "ln": "ln_Latn_CD", + "lo": "lo_Laoo_LA", + "lol": "lol_Latn_CD", + "lt": "lt_Latn_LT", + "lu": "lu_Latn_CD", + "lua": "lua_Latn_CD", + "luo": "luo_Latn_KE", + "luy": "luy_Latn_KE", + "lv": "lv_Latn_LV", + "lwl": "lwl_Thai_TH", + "mad": "mad_Latn_ID", + "mag": "mag_Deva_IN", + "mai": "mai_Deva_IN", + "mak": "mak_Latn_ID", + "man": "man_Latn_GM", + "man_GN": "man_Nkoo_GN", + "man_Nkoo": "man_Nkoo_GN", + "mas": "mas_Latn_KE", + "mdf": "mdf_Cyrl_RU", + "mdh": "mdh_Latn_PH", + "mdr": "mdr_Latn_ID", + "men": "men_Latn_SL", + "mer": "mer_Latn_KE", + "mfe": "mfe_Latn_MU", + "mg": "mg_Latn_MG", + "mgh": "mgh_Latn_MZ", + "mgo": "mgo_Latn_CM", + "mh": "mh_Latn_MH", + "mi": "mi_Latn_NZ", + "min": "min_Latn_ID", + "mk": "mk_Cyrl_MK", + "ml": "ml_Mlym_IN", + "mn": "mn_Cyrl_MN", + "mn_CN": "mn_Mong_CN", + "mn_Mong": "mn_Mong_CN", + "mni": "mni_Beng_IN", + "mnw": "mnw_Mymr_MM", + "mo": "mo_Latn_RO", + "mos": "mos_Latn_BF", + "mr": "mr_Deva_IN", + "ms": "ms_Latn_MY", + "ms_CC": "ms_Arab_CC", + "ms_ID": "ms_Arab_ID", + "mt": "mt_Latn_MT", + "mua": "mua_Latn_CM", + "mwr": "mwr_Deva_IN", + "my": "my_Mymr_MM", + "myv": "myv_Cyrl_RU", + "na": "na_Latn_NR", + "nap": "nap_Latn_IT", + "naq": "naq_Latn_NA", + "nb": "nb_Latn_NO", + "nd": "nd_Latn_ZW", + "nds": "nds_Latn_DE", + "ne": "ne_Deva_NP", + "new": "new_Deva_NP", + "ng": "ng_Latn_NA", + "niu": "niu_Latn_NU", + "nl": "nl_Latn_NL", + "nmg": "nmg_Latn_CM", + "nn": "nn_Latn_NO", + "nnh": "nnh_Latn_CM", + "no": "no_Latn_NO", + "nod": "nod_Lana_TH", + "nr": "nr_Latn_ZA", + "nso": "nso_Latn_ZA", + "nus": "nus_Latn_SD", + "nv": "nv_Latn_US", + "ny": "ny_Latn_MW", + "nym": "nym_Latn_TZ", + "nyn": "nyn_Latn_UG", + "oc": "oc_Latn_FR", + "om": "om_Latn_ET", + "or": "or_Orya_IN", + "os": "os_Cyrl_GE", + "pa": "pa_Guru_IN", + "pa_Arab": "pa_Arab_PK", + "pa_PK": "pa_Arab_PK", + "pag": "pag_Latn_PH", + "pam": "pam_Latn_PH", + "pap": "pap_Latn_AW", + "pau": "pau_Latn_PW", + "pl": "pl_Latn_PL", + "pon": "pon_Latn_FM", + "prd": "prd_Arab_IR", + "ps": "ps_Arab_AF", + "pt": "pt_Latn_BR", + "qu": "qu_Latn_PE", + "raj": "raj_Latn_IN", + "rcf": "rcf_Latn_RE", + "rej": "rej_Latn_ID", + "rjs": "rjs_Deva_NP", + "rkt": "rkt_Beng_BD", + "rm": "rm_Latn_CH", + "rn": "rn_Latn_BI", + "ro": "ro_Latn_RO", + "rof": "rof_Latn_TZ", + "ru": "ru_Cyrl_RU", + "rw": "rw_Latn_RW", + "rwk": "rwk_Latn_TZ", + "sa": "sa_Deva_IN", + "saf": "saf_Latn_GH", + "sah": "sah_Cyrl_RU", + "saq": "saq_Latn_KE", + "sas": "sas_Latn_ID", + "sat": "sat_Latn_IN", + "saz": "saz_Saur_IN", + "sbp": "sbp_Latn_TZ", + "scn": "scn_Latn_IT", + "sco": "sco_Latn_GB", + "sd": "sd_Arab_PK", + "sd_Deva": "sd_Deva_IN", + "sdh": "sdh_Arab_IR", + "se": "se_Latn_NO", + "seh": "seh_Latn_MZ", + "ses": "ses_Latn_ML", + "sg": "sg_Latn_CF", + "shi": "shi_Tfng_MA", + "shn": "shn_Mymr_MM", + "si": "si_Sinh_LK", + "sid": "sid_Latn_ET", + "sk": "sk_Latn_SK", + "sl": "sl_Latn_SI", + "sm": "sm_Latn_WS", + "sma": "sma_Latn_SE", + "smj": "smj_Latn_SE", + "smn": "smn_Latn_FI", + "sms": "sms_Latn_FI", + "sn": "sn_Latn_ZW", + "snk": "snk_Latn_ML", + "so": "so_Latn_SO", + "sq": "sq_Latn_AL", + "sr": "sr_Cyrl_RS", + "sr_ME": "sr_Latn_ME", + "sr_RO": "sr_Latn_RO", + "sr_RU": "sr_Latn_RU", + "sr_TR": "sr_Latn_TR", + "srn": "srn_Latn_SR", + "srr": "srr_Latn_SN", + "ss": "ss_Latn_ZA", + "ssy": "ssy_Latn_ER", + "st": "st_Latn_ZA", + "su": "su_Latn_ID", + "suk": "suk_Latn_TZ", + "sus": "sus_Latn_GN", + "sv": "sv_Latn_SE", + "sw": "sw_Latn_TZ", + "swb": "swb_Arab_YT", + "swc": "swc_Latn_CD", + "syl": "syl_Beng_BD", + "syr": "syr_Syrc_IQ", + "ta": "ta_Taml_IN", + "tbw": "tbw_Latn_PH", + "tcy": "tcy_Knda_IN", + "tdd": "tdd_Tale_CN", + "te": "te_Telu_IN", + "tem": "tem_Latn_SL", + "teo": "teo_Latn_UG", + "tet": "tet_Latn_TL", + "tg": "tg_Cyrl_TJ", + "tg_Arab": "tg_Arab_PK", + "tg_PK": "tg_Arab_PK", + "th": "th_Thai_TH", + "ti": "ti_Ethi_ET", + "tig": "tig_Ethi_ER", + "tiv": "tiv_Latn_NG", + "tk": "tk_Latn_TM", + "tkl": "tkl_Latn_TK", + "tl": "tl_Latn_PH", + "tmh": "tmh_Latn_NE", + "tn": "tn_Latn_ZA", + "to": "to_Latn_TO", + "tpi": "tpi_Latn_PG", + "tr": "tr_Latn_TR", + "trv": "trv_Latn_TW", + "ts": "ts_Latn_ZA", + "tsg": "tsg_Latn_PH", + "tt": "tt_Cyrl_RU", + "tts": "tts_Thai_TH", + "tum": "tum_Latn_MW", + "tvl": "tvl_Latn_TV", + "twq": "twq_Latn_NE", + "ty": "ty_Latn_PF", + "tyv": "tyv_Cyrl_RU", + "tzm": "tzm_Latn_MA", + "udm": "udm_Cyrl_RU", + "ug": "ug_Arab_CN", + "ug_Cyrl": "ug_Cyrl_KZ", + "ug_KZ": "ug_Cyrl_KZ", + "ug_MN": "ug_Cyrl_MN", + "uk": "uk_Cyrl_UA", + "uli": "uli_Latn_FM", + "umb": "umb_Latn_AO", + "und": "en_Latn_US", + "und_AD": "ca_Latn_AD", + "und_AE": "ar_Arab_AE", + "und_AF": "fa_Arab_AF", + "und_AL": "sq_Latn_AL", + "und_AM": "hy_Armn_AM", + "und_AO": "pt_Latn_AO", + "und_AQ": "und_Latn_AQ", + "und_AR": "es_Latn_AR", + "und_Arab": "ar_Arab_EG", + "und_Arab_CC": "ms_Arab_CC", + "und_Arab_CN": "ug_Arab_CN", + "und_Arab_GB": "ks_Arab_GB", + "und_Arab_ID": "ms_Arab_ID", + "und_Arab_IN": "ur_Arab_IN", + "und_Arab_KH": "cja_Arab_KH", + "und_Arab_MN": "kk_Arab_MN", + "und_Arab_MU": "ur_Arab_MU", + "und_Arab_NG": "ha_Arab_NG", + "und_Arab_PK": "ur_Arab_PK", + "und_Arab_TJ": "fa_Arab_TJ", + "und_Arab_TR": "zza_Arab_TR", + "und_Arab_YT": "swb_Arab_YT", + "und_Armi": "arc_Armi_IR", + "und_Armn": "hy_Armn_AM", + "und_AS": "sm_Latn_AS", + "und_AT": "de_Latn_AT", + "und_Avst": "ae_Avst_IR", + "und_AW": "nl_Latn_AW", + "und_AX": "sv_Latn_AX", + "und_AZ": "az_Latn_AZ", + "und_BA": "bs_Latn_BA", + "und_Bali": "ban_Bali_ID", + "und_Bamu": "bax_Bamu_CM", + "und_Batk": "bbc_Batk_ID", + "und_BD": "bn_Beng_BD", + "und_BE": "nl_Latn_BE", + "und_Beng": "bn_Beng_BD", + "und_BF": "fr_Latn_BF", + "und_BG": "bg_Cyrl_BG", + "und_BH": "ar_Arab_BH", + "und_BI": "rn_Latn_BI", + "und_BJ": "fr_Latn_BJ", + "und_BL": "fr_Latn_BL", + "und_BN": "ms_Latn_BN", + "und_BO": "es_Latn_BO", + "und_Bopo": "zh_Bopo_TW", + "und_BQ": "pap_Latn_BQ", + "und_BR": "pt_Latn_BR", + "und_Brah": "pra_Brah_IN", + "und_Brai": "und_Brai_FR", + "und_BT": "dz_Tibt_BT", + "und_Bugi": "bug_Bugi_ID", + "und_Buhd": "bku_Buhd_PH", + "und_BV": "und_Latn_BV", + "und_BY": "be_Cyrl_BY", + "und_Cakm": "ccp_Cakm_BD", + "und_Cans": "cr_Cans_CA", + "und_Cari": "xcr_Cari_TR", + "und_CD": "sw_Latn_CD", + "und_CF": "fr_Latn_CF", + "und_CG": "fr_Latn_CG", + "und_CH": "de_Latn_CH", + "und_Cham": "cjm_Cham_VN", + "und_Cher": "chr_Cher_US", + "und_CI": "fr_Latn_CI", + "und_CL": "es_Latn_CL", + "und_CM": "fr_Latn_CM", + "und_CN": "zh_Hans_CN", + "und_CO": "es_Latn_CO", + "und_Copt": "cop_Copt_EG", + "und_CP": "und_Latn_CP", + "und_Cprt": "grc_Cprt_CY", + "und_CR": "es_Latn_CR", + "und_CU": "es_Latn_CU", + "und_CV": "pt_Latn_CV", + "und_CW": "pap_Latn_CW", + "und_CY": "el_Grek_CY", + "und_Cyrl": "ru_Cyrl_RU", + "und_Cyrl_AL": "mk_Cyrl_AL", + "und_Cyrl_BA": "sr_Cyrl_BA", + "und_Cyrl_GE": "ab_Cyrl_GE", + "und_Cyrl_GR": "mk_Cyrl_GR", + "und_Cyrl_MD": "uk_Cyrl_MD", + "und_Cyrl_PL": "be_Cyrl_PL", + "und_Cyrl_RO": "bg_Cyrl_RO", + "und_Cyrl_SK": "uk_Cyrl_SK", + "und_Cyrl_TR": "kbd_Cyrl_TR", + "und_Cyrl_XK": "sr_Cyrl_XK", + "und_CZ": "cs_Latn_CZ", + "und_DE": "de_Latn_DE", + "und_Deva": "hi_Deva_IN", + "und_Deva_BT": "ne_Deva_BT", + "und_Deva_MU": "bho_Deva_MU", + "und_Deva_PK": "btv_Deva_PK", + "und_DJ": "aa_Latn_DJ", + "und_DK": "da_Latn_DK", + "und_DO": "es_Latn_DO", + "und_DZ": "ar_Arab_DZ", + "und_EA": "es_Latn_EA", + "und_EC": "es_Latn_EC", + "und_EE": "et_Latn_EE", + "und_EG": "ar_Arab_EG", + "und_Egyp": "egy_Egyp_EG", + "und_EH": "ar_Arab_EH", + "und_ER": "ti_Ethi_ER", + "und_ES": "es_Latn_ES", + "und_ET": "am_Ethi_ET", + "und_Ethi": "am_Ethi_ET", + "und_FI": "fi_Latn_FI", + "und_FM": "chk_Latn_FM", + "und_FO": "fo_Latn_FO", + "und_FR": "fr_Latn_FR", + "und_GA": "fr_Latn_GA", + "und_GE": "ka_Geor_GE", + "und_Geor": "ka_Geor_GE", + "und_GF": "fr_Latn_GF", + "und_GH": "ak_Latn_GH", + "und_GL": "kl_Latn_GL", + "und_Glag": "cu_Glag_BG", + "und_GN": "fr_Latn_GN", + "und_Goth": "got_Goth_UA", + "und_GP": "fr_Latn_GP", + "und_GQ": "es_Latn_GQ", + "und_GR": "el_Grek_GR", + "und_Grek": "el_Grek_GR", + "und_GS": "und_Latn_GS", + "und_GT": "es_Latn_GT", + "und_Gujr": "gu_Gujr_IN", + "und_Guru": "pa_Guru_IN", + "und_GW": "pt_Latn_GW", + "und_Hang": "ko_Hang_KR", + "und_Hani": "zh_Hani_CN", + "und_Hano": "hnn_Hano_PH", + "und_Hans": "zh_Hans_CN", + "und_Hant": "zh_Hant_TW", + "und_Hebr": "he_Hebr_IL", + "und_Hebr_CA": "yi_Hebr_CA", + "und_Hebr_GB": "yi_Hebr_GB", + "und_Hebr_SE": "yi_Hebr_SE", + "und_Hebr_UA": "yi_Hebr_UA", + "und_Hebr_US": "yi_Hebr_US", + "und_Hira": "ja_Hira_JP", + "und_HK": "zh_Hant_HK", + "und_HM": "und_Latn_HM", + "und_HN": "es_Latn_HN", + "und_HR": "hr_Latn_HR", + "und_HT": "ht_Latn_HT", + "und_HU": "hu_Latn_HU", + "und_IC": "es_Latn_IC", + "und_ID": "id_Latn_ID", + "und_IL": "he_Hebr_IL", + "und_IN": "hi_Deva_IN", + "und_IQ": "ar_Arab_IQ", + "und_IR": "fa_Arab_IR", + "und_IS": "is_Latn_IS", + "und_IT": "it_Latn_IT", + "und_Ital": "ett_Ital_IT", + "und_Java": "jv_Java_ID", + "und_JO": "ar_Arab_JO", + "und_JP": "ja_Jpan_JP", + "und_Jpan": "ja_Jpan_JP", + "und_Kali": "eky_Kali_MM", + "und_Kana": "ja_Kana_JP", + "und_KG": "ky_Cyrl_KG", + "und_KH": "km_Khmr_KH", + "und_Khar": "pra_Khar_PK", + "und_Khmr": "km_Khmr_KH", + "und_KM": "ar_Arab_KM", + "und_Knda": "kn_Knda_IN", + "und_Kore": "ko_Kore_KR", + "und_KP": "ko_Kore_KP", + "und_KR": "ko_Kore_KR", + "und_Kthi": "bh_Kthi_IN", + "und_KW": "ar_Arab_KW", + "und_KZ": "ru_Cyrl_KZ", + "und_LA": "lo_Laoo_LA", + "und_Lana": "nod_Lana_TH", + "und_Laoo": "lo_Laoo_LA", + "und_Latn_AF": "tk_Latn_AF", + "und_Latn_AM": "az_Latn_AM", + "und_Latn_BG": "tr_Latn_BG", + "und_Latn_CN": "za_Latn_CN", + "und_Latn_CY": "tr_Latn_CY", + "und_Latn_DZ": "fr_Latn_DZ", + "und_Latn_ET": "en_Latn_ET", + "und_Latn_GE": "ku_Latn_GE", + "und_Latn_GR": "tr_Latn_GR", + "und_Latn_IL": "ro_Latn_IL", + "und_Latn_IR": "tk_Latn_IR", + "und_Latn_KM": "fr_Latn_KM", + "und_Latn_KZ": "de_Latn_KZ", + "und_Latn_LB": "fr_Latn_LB", + "und_Latn_MA": "fr_Latn_MA", + "und_Latn_MK": "sq_Latn_MK", + "und_Latn_MO": "pt_Latn_MO", + "und_Latn_MR": "fr_Latn_MR", + "und_Latn_RU": "krl_Latn_RU", + "und_Latn_SY": "fr_Latn_SY", + "und_Latn_TN": "fr_Latn_TN", + "und_Latn_TW": "trv_Latn_TW", + "und_Latn_UA": "pl_Latn_UA", + "und_LB": "ar_Arab_LB", + "und_Lepc": "lep_Lepc_IN", + "und_LI": "de_Latn_LI", + "und_Limb": "lif_Limb_IN", + "und_Linb": "grc_Linb_GR", + "und_Lisu": "lis_Lisu_CN", + "und_LK": "si_Sinh_LK", + "und_LS": "st_Latn_LS", + "und_LT": "lt_Latn_LT", + "und_LU": "fr_Latn_LU", + "und_LV": "lv_Latn_LV", + "und_LY": "ar_Arab_LY", + "und_Lyci": "xlc_Lyci_TR", + "und_Lydi": "xld_Lydi_TR", + "und_MA": "ar_Arab_MA", + "und_Mand": "myz_Mand_IR", + "und_MC": "fr_Latn_MC", + "und_MD": "ro_Latn_MD", + "und_ME": "sr_Latn_ME", + "und_Merc": "xmr_Merc_SD", + "und_Mero": "xmr_Mero_SD", + "und_MF": "fr_Latn_MF", + "und_MG": "mg_Latn_MG", + "und_MK": "mk_Cyrl_MK", + "und_ML": "bm_Latn_ML", + "und_Mlym": "ml_Mlym_IN", + "und_MM": "my_Mymr_MM", + "und_MN": "mn_Cyrl_MN", + "und_MO": "zh_Hant_MO", + "und_Mong": "mn_Mong_CN", + "und_MQ": "fr_Latn_MQ", + "und_MR": "ar_Arab_MR", + "und_MT": "mt_Latn_MT", + "und_Mtei": "mni_Mtei_IN", + "und_MU": "mfe_Latn_MU", + "und_MV": "dv_Thaa_MV", + "und_MX": "es_Latn_MX", + "und_MY": "ms_Latn_MY", + "und_Mymr": "my_Mymr_MM", + "und_Mymr_IN": "kht_Mymr_IN", + "und_Mymr_TH": "mnw_Mymr_TH", + "und_MZ": "pt_Latn_MZ", + "und_NA": "af_Latn_NA", + "und_NC": "fr_Latn_NC", + "und_NE": "ha_Latn_NE", + "und_NI": "es_Latn_NI", + "und_Nkoo": "man_Nkoo_GN", + "und_NL": "nl_Latn_NL", + "und_NO": "nb_Latn_NO", + "und_NP": "ne_Deva_NP", + "und_Ogam": "sga_Ogam_IE", + "und_Olck": "sat_Olck_IN", + "und_OM": "ar_Arab_OM", + "und_Orkh": "otk_Orkh_MN", + "und_Orya": "or_Orya_IN", + "und_Osma": "so_Osma_SO", + "und_PA": "es_Latn_PA", + "und_PE": "es_Latn_PE", + "und_PF": "fr_Latn_PF", + "und_PG": "tpi_Latn_PG", + "und_PH": "fil_Latn_PH", + "und_Phag": "lzh_Phag_CN", + "und_Phli": "pal_Phli_IR", + "und_Phnx": "phn_Phnx_LB", + "und_PK": "ur_Arab_PK", + "und_PL": "pl_Latn_PL", + "und_Plrd": "hmd_Plrd_CN", + "und_PM": "fr_Latn_PM", + "und_PR": "es_Latn_PR", + "und_Prti": "xpr_Prti_IR", + "und_PS": "ar_Arab_PS", + "und_PT": "pt_Latn_PT", + "und_PW": "pau_Latn_PW", + "und_PY": "gn_Latn_PY", + "und_QA": "ar_Arab_QA", + "und_RE": "fr_Latn_RE", + "und_Rjng": "rej_Rjng_ID", + "und_RO": "ro_Latn_RO", + "und_RS": "sr_Cyrl_RS", + "und_RU": "ru_Cyrl_RU", + "und_Runr": "non_Runr_SE", + "und_RW": "rw_Latn_RW", + "und_SA": "ar_Arab_SA", + "und_Samr": "smp_Samr_IL", + "und_Sarb": "xsa_Sarb_YE", + "und_Saur": "saz_Saur_IN", + "und_SC": "fr_Latn_SC", + "und_SD": "ar_Arab_SD", + "und_SE": "sv_Latn_SE", + "und_Shaw": "en_Shaw_GB", + "und_Shrd": "sa_Shrd_IN", + "und_SI": "sl_Latn_SI", + "und_Sinh": "si_Sinh_LK", + "und_SJ": "nb_Latn_SJ", + "und_SK": "sk_Latn_SK", + "und_SM": "it_Latn_SM", + "und_SN": "fr_Latn_SN", + "und_SO": "so_Latn_SO", + "und_Sora": "srb_Sora_IN", + "und_SR": "nl_Latn_SR", + "und_ST": "pt_Latn_ST", + "und_Sund": "su_Sund_ID", + "und_SV": "es_Latn_SV", + "und_SY": "ar_Arab_SY", + "und_Sylo": "syl_Sylo_BD", + "und_Syrc": "syr_Syrc_IQ", + "und_Tagb": "tbw_Tagb_PH", + "und_Takr": "doi_Takr_IN", + "und_Tale": "tdd_Tale_CN", + "und_Talu": "khb_Talu_CN", + "und_Taml": "ta_Taml_IN", + "und_Tavt": "blt_Tavt_VN", + "und_TD": "fr_Latn_TD", + "und_Telu": "te_Telu_IN", + "und_TF": "fr_Latn_TF", + "und_Tfng": "zgh_Tfng_MA", + "und_TG": "fr_Latn_TG", + "und_Tglg": "fil_Tglg_PH", + "und_TH": "th_Thai_TH", + "und_Thaa": "dv_Thaa_MV", + "und_Thai": "th_Thai_TH", + "und_Thai_CN": "lcp_Thai_CN", + "und_Thai_KH": "kdt_Thai_KH", + "und_Thai_LA": "kdt_Thai_LA", + "und_Tibt": "bo_Tibt_CN", + "und_TJ": "tg_Cyrl_TJ", + "und_TK": "tkl_Latn_TK", + "und_TL": "pt_Latn_TL", + "und_TM": "tk_Latn_TM", + "und_TN": "ar_Arab_TN", + "und_TO": "to_Latn_TO", + "und_TR": "tr_Latn_TR", + "und_TV": "tvl_Latn_TV", + "und_TW": "zh_Hant_TW", + "und_TZ": "sw_Latn_TZ", + "und_UA": "uk_Cyrl_UA", + "und_UG": "sw_Latn_UG", + "und_Ugar": "uga_Ugar_SY", + "und_UY": "es_Latn_UY", + "und_UZ": "uz_Latn_UZ", + "und_VA": "la_Latn_VA", + "und_Vaii": "vai_Vaii_LR", + "und_VE": "es_Latn_VE", + "und_VN": "vi_Latn_VN", + "und_VU": "bi_Latn_VU", + "und_WF": "fr_Latn_WF", + "und_WS": "sm_Latn_WS", + "und_XK": "sq_Latn_XK", + "und_Xpeo": "peo_Xpeo_IR", + "und_Xsux": "akk_Xsux_IQ", + "und_YE": "ar_Arab_YE", + "und_Yiii": "ii_Yiii_CN", + "und_YT": "fr_Latn_YT", + "unr": "unr_Beng_IN", + "unr_Deva": "unr_Deva_NP", + "unr_NP": "unr_Deva_NP", + "unx": "unx_Beng_IN", + "ur": "ur_Arab_PK", + "uz": "uz_Latn_UZ", + "uz_AF": "uz_Arab_AF", + "uz_Arab": "uz_Arab_AF", + "uz_CN": "uz_Cyrl_CN", + "vai": "vai_Vaii_LR", + "ve": "ve_Latn_ZA", + "vi": "vi_Latn_VN", + "vo": "vo_Latn_001", + "vun": "vun_Latn_TZ", + "wa": "wa_Latn_BE", + "wae": "wae_Latn_CH", + "wal": "wal_Ethi_ET", + "war": "war_Latn_PH", + "wo": "wo_Latn_SN", + "xh": "xh_Latn_ZA", + "xog": "xog_Latn_UG", + "xsr": "xsr_Deva_NP", + "yao": "yao_Latn_MZ", + "yap": "yap_Latn_FM", + "yav": "yav_Latn_CM", + "yi": "yi_Hebr_UA", + "yo": "yo_Latn_NG", + "za": "za_Latn_CN", + "zgh": "zgh_Tfng_MA", + "zh": "zh_Hans_CN", + "zh_AU": "zh_Hant_AU", + "zh_BN": "zh_Hant_BN", + "zh_GB": "zh_Hant_GB", + "zh_GF": "zh_Hant_GF", + "zh_Hant": "zh_Hant_TW", + "zh_HK": "zh_Hant_HK", + "zh_ID": "zh_Hant_ID", + "zh_MO": "zh_Hant_MO", + "zh_MY": "zh_Hant_MY", + "zh_PA": "zh_Hant_PA", + "zh_PF": "zh_Hant_PF", + "zh_PH": "zh_Hant_PH", + "zh_SR": "zh_Hant_SR", + "zh_TH": "zh_Hant_TH", + "zh_TW": "zh_Hant_TW", + "zh_US": "zh_Hant_US", + "zh_VN": "zh_Hant_VN", + "zu": "zu_Latn_ZA", + "zza": "zza_Arab_TR" + } + } +}); + +// weekData +Globalize.load({ + "supplemental": { + "version": { + "_cldrVersion": "24", + "_number": "$Revision: 9270 $" + }, + "generation": { + "_date": "$Date: 2013-08-25 16:44:03 -0500 (Sun, 25 Aug 2013) $" + }, + "weekData": { + "minDays": { + "001": "1", + "AD": "4", + "AN": "4", + "AT": "4", + "AX": "4", + "BE": "4", + "BG": "4", + "CH": "4", + "CZ": "4", + "DE": "4", + "DK": "4", + "EE": "4", + "ES": "4", + "FI": "4", + "FJ": "4", + "FO": "4", + "FR": "4", + "GB": "4", + "GF": "4", + "GG": "4", + "GI": "4", + "GP": "4", + "GR": "4", + "GU": "1", + "HU": "4", + "IE": "4", + "IM": "4", + "IS": "4", + "IT": "4", + "JE": "4", + "LI": "4", + "LT": "4", + "LU": "4", + "MC": "4", + "MQ": "4", + "NL": "4", + "NO": "4", + "PL": "4", + "PT": "4", + "RE": "4", + "SE": "4", + "SJ": "4", + "SK": "4", + "SM": "4", + "UM": "1", + "US": "1", + "VA": "4", + "VI": "1" + }, + "firstDay": { + "001": "mon", + "AD": "mon", + "AE": "sat", + "AF": "sat", + "AG": "sun", + "AI": "mon", + "AL": "mon", + "AM": "mon", + "AN": "mon", + "AR": "sun", + "AS": "sun", + "AT": "mon", + "AU": "sun", + "AX": "mon", + "AZ": "mon", + "BA": "mon", + "BD": "fri", + "BE": "mon", + "BG": "mon", + "BH": "sat", + "BM": "mon", + "BN": "mon", + "BR": "sun", + "BS": "sun", + "BT": "sun", + "BW": "sun", + "BY": "sun", + "BZ": "sun", + "CA": "sun", + "CH": "mon", + "CL": "mon", + "CM": "mon", + "CN": "sun", + "CO": "sun", + "CR": "mon", + "CY": "mon", + "CZ": "mon", + "DE": "mon", + "DJ": "sat", + "DK": "mon", + "DM": "sun", + "DO": "sun", + "DZ": "sat", + "EC": "mon", + "EE": "mon", + "EG": "sat", + "ES": "mon", + "ET": "sun", + "FI": "mon", + "FJ": "mon", + "FO": "mon", + "FR": "mon", + "GB": "mon", + "GE": "mon", + "GF": "mon", + "GP": "mon", + "GR": "mon", + "GT": "sun", + "GU": "sun", + "HK": "sun", + "HN": "sun", + "HR": "mon", + "HU": "mon", + "ID": "sun", + "IE": "sun", + "IL": "sun", + "IN": "sun", + "IQ": "sat", + "IR": "sat", + "IS": "mon", + "IT": "mon", + "JM": "sun", + "JO": "sat", + "JP": "sun", + "KE": "sun", + "KG": "mon", + "KH": "sun", + "KR": "sun", + "KW": "sat", + "KZ": "mon", + "LA": "sun", + "LB": "mon", + "LI": "mon", + "LK": "mon", + "LT": "mon", + "LU": "mon", + "LV": "mon", + "LY": "sat", + "MA": "sat", + "MC": "mon", + "MD": "mon", + "ME": "mon", + "MH": "sun", + "MK": "mon", + "MM": "sun", + "MN": "mon", + "MO": "sun", + "MQ": "mon", + "MT": "sun", + "MV": "fri", + "MX": "sun", + "MY": "mon", + "MZ": "sun", + "NI": "sun", + "NL": "mon", + "NO": "mon", + "NP": "sun", + "NZ": "sun", + "OM": "sat", + "PA": "sun", + "PE": "sun", + "PH": "sun", + "PK": "sun", + "PL": "mon", + "PR": "sun", + "PT": "mon", + "PY": "sun", + "QA": "sat", + "RE": "mon", + "RO": "mon", + "RS": "mon", + "RU": "mon", + "SA": "sun", + "SD": "sat", + "SE": "mon", + "SG": "sun", + "SI": "mon", + "SK": "mon", + "SM": "mon", + "SV": "sun", + "SY": "sat", + "TH": "sun", + "TJ": "mon", + "TM": "mon", + "TN": "sun", + "TR": "mon", + "TT": "sun", + "TW": "sun", + "UA": "mon", + "UM": "sun", + "US": "sun", + "UY": "mon", + "UZ": "mon", + "VA": "mon", + "VE": "sun", + "VI": "sun", + "VN": "mon", + "WS": "sun", + "XK": "mon", + "YE": "sun", + "ZA": "sun", + "ZW": "sun" + }, + "firstDay-alt-variant": { + "GB": "sun" + }, + "weekendStart": { + "001": "sat", + "AE": "fri", + "AF": "thu", + "BH": "fri", + "DZ": "thu", + "EG": "fri", + "IL": "fri", + "IN": "sun", + "IQ": "fri", + "IR": "thu", + "JO": "fri", + "KW": "fri", + "LY": "fri", + "MA": "fri", + "OM": "thu", + "QA": "fri", + "SA": "fri", + "SD": "fri", + "SY": "fri", + "TN": "fri", + "YE": "fri" + }, + "weekendEnd": { + "001": "sun", + "AE": "sat", + "AF": "fri", + "BH": "sat", + "DZ": "fri", + "EG": "sat", + "IL": "sat", + "IQ": "sat", + "IR": "fri", + "JO": "sat", + "KW": "sat", + "LY": "sat", + "MA": "sat", + "OM": "fri", + "QA": "sat", + "SA": "sat", + "SD": "sat", + "SY": "sat", + "TN": "sat", + "YE": "sat" + } + } + } +}); + +// timeData +Globalize.load({ + "supplemental": { + "version": { + "_cldrVersion": "24", + "_number": "$Revision: 9270 $" + }, + "generation": { + "_date": "$Date: 2013-08-25 16:44:03 -0500 (Sun, 25 Aug 2013) $" + }, + "timeData": { + "001": { + "_allowed": "H h", + "_preferred": "H" + }, + "AD": { + "_allowed": "H", + "_preferred": "H" + }, + "AE": { + "_allowed": "H h", + "_preferred": "h" + }, + "AG": { + "_allowed": "H h", + "_preferred": "h" + }, + "AL": { + "_allowed": "H h", + "_preferred": "h" + }, + "AM": { + "_allowed": "H", + "_preferred": "H" + }, + "AO": { + "_allowed": "H", + "_preferred": "H" + }, + "AS": { + "_allowed": "H h", + "_preferred": "h" + }, + "AT": { + "_allowed": "H", + "_preferred": "H" + }, + "AU": { + "_allowed": "H h", + "_preferred": "h" + }, + "AW": { + "_allowed": "H", + "_preferred": "H" + }, + "AX": { + "_allowed": "H", + "_preferred": "H" + }, + "BB": { + "_allowed": "H h", + "_preferred": "h" + }, + "BD": { + "_allowed": "H h", + "_preferred": "h" + }, + "BE": { + "_allowed": "H", + "_preferred": "H" + }, + "BF": { + "_allowed": "H", + "_preferred": "H" + }, + "BH": { + "_allowed": "H h", + "_preferred": "h" + }, + "BJ": { + "_allowed": "H", + "_preferred": "H" + }, + "BL": { + "_allowed": "H", + "_preferred": "H" + }, + "BM": { + "_allowed": "H h", + "_preferred": "h" + }, + "BN": { + "_allowed": "H h", + "_preferred": "h" + }, + "BR": { + "_allowed": "H", + "_preferred": "H" + }, + "BS": { + "_allowed": "H h", + "_preferred": "h" + }, + "BT": { + "_allowed": "H h", + "_preferred": "h" + }, + "BW": { + "_allowed": "H h", + "_preferred": "h" + }, + "CA": { + "_allowed": "H h", + "_preferred": "h" + }, + "CD": { + "_allowed": "H", + "_preferred": "H" + }, + "CI": { + "_allowed": "H", + "_preferred": "H" + }, + "CN": { + "_allowed": "H h", + "_preferred": "h" + }, + "CO": { + "_allowed": "H h", + "_preferred": "h" + }, + "CP": { + "_allowed": "H", + "_preferred": "H" + }, + "CV": { + "_allowed": "H", + "_preferred": "H" + }, + "CY": { + "_allowed": "H h", + "_preferred": "h" + }, + "CZ": { + "_allowed": "H", + "_preferred": "H" + }, + "DE": { + "_allowed": "H", + "_preferred": "H" + }, + "DJ": { + "_allowed": "H h", + "_preferred": "h" + }, + "DK": { + "_allowed": "H", + "_preferred": "H" + }, + "DM": { + "_allowed": "H h", + "_preferred": "h" + }, + "DZ": { + "_allowed": "H h", + "_preferred": "h" + }, + "EE": { + "_allowed": "H", + "_preferred": "H" + }, + "EG": { + "_allowed": "H h", + "_preferred": "h" + }, + "EH": { + "_allowed": "H h", + "_preferred": "h" + }, + "ER": { + "_allowed": "H h", + "_preferred": "h" + }, + "ET": { + "_allowed": "H h", + "_preferred": "h" + }, + "FI": { + "_allowed": "H", + "_preferred": "H" + }, + "FJ": { + "_allowed": "H h", + "_preferred": "h" + }, + "FM": { + "_allowed": "H h", + "_preferred": "h" + }, + "FR": { + "_allowed": "H", + "_preferred": "H" + }, + "GA": { + "_allowed": "H", + "_preferred": "H" + }, + "GD": { + "_allowed": "H h", + "_preferred": "h" + }, + "GF": { + "_allowed": "H", + "_preferred": "H" + }, + "GH": { + "_allowed": "H h", + "_preferred": "h" + }, + "GL": { + "_allowed": "H h", + "_preferred": "h" + }, + "GM": { + "_allowed": "H h", + "_preferred": "h" + }, + "GN": { + "_allowed": "H", + "_preferred": "H" + }, + "GP": { + "_allowed": "H", + "_preferred": "H" + }, + "GR": { + "_allowed": "H h", + "_preferred": "h" + }, + "GU": { + "_allowed": "H h", + "_preferred": "h" + }, + "GW": { + "_allowed": "H", + "_preferred": "H" + }, + "GY": { + "_allowed": "H h", + "_preferred": "h" + }, + "HK": { + "_allowed": "H h", + "_preferred": "h" + }, + "HR": { + "_allowed": "H", + "_preferred": "H" + }, + "IL": { + "_allowed": "H", + "_preferred": "H" + }, + "IN": { + "_allowed": "H h", + "_preferred": "h" + }, + "IQ": { + "_allowed": "H h", + "_preferred": "h" + }, + "IS": { + "_allowed": "H", + "_preferred": "H" + }, + "IT": { + "_allowed": "H", + "_preferred": "H" + }, + "JM": { + "_allowed": "H h", + "_preferred": "h" + }, + "JO": { + "_allowed": "H h", + "_preferred": "h" + }, + "JP": { + "_allowed": "H K h", + "_preferred": "H" + }, + "KH": { + "_allowed": "H h", + "_preferred": "h" + }, + "KI": { + "_allowed": "H h", + "_preferred": "h" + }, + "KN": { + "_allowed": "H h", + "_preferred": "h" + }, + "KP": { + "_allowed": "H h", + "_preferred": "h" + }, + "KR": { + "_allowed": "H h", + "_preferred": "h" + }, + "KW": { + "_allowed": "H h", + "_preferred": "h" + }, + "KY": { + "_allowed": "H h", + "_preferred": "h" + }, + "LB": { + "_allowed": "H h", + "_preferred": "h" + }, + "LC": { + "_allowed": "H h", + "_preferred": "h" + }, + "LR": { + "_allowed": "H h", + "_preferred": "h" + }, + "LS": { + "_allowed": "H h", + "_preferred": "h" + }, + "LY": { + "_allowed": "H h", + "_preferred": "h" + }, + "MA": { + "_allowed": "H h", + "_preferred": "h" + }, + "MC": { + "_allowed": "H", + "_preferred": "H" + }, + "MD": { + "_allowed": "H", + "_preferred": "H" + }, + "MF": { + "_allowed": "H", + "_preferred": "H" + }, + "MH": { + "_allowed": "H h", + "_preferred": "h" + }, + "ML": { + "_allowed": "H", + "_preferred": "H" + }, + "MO": { + "_allowed": "H h", + "_preferred": "h" + }, + "MP": { + "_allowed": "H h", + "_preferred": "h" + }, + "MQ": { + "_allowed": "H", + "_preferred": "H" + }, + "MR": { + "_allowed": "H h", + "_preferred": "h" + }, + "MW": { + "_allowed": "H h", + "_preferred": "h" + }, + "MY": { + "_allowed": "H h", + "_preferred": "h" + }, + "MZ": { + "_allowed": "H", + "_preferred": "H" + }, + "NA": { + "_allowed": "H h", + "_preferred": "h" + }, + "NC": { + "_allowed": "H", + "_preferred": "H" + }, + "NE": { + "_allowed": "H", + "_preferred": "H" + }, + "NG": { + "_allowed": "H h", + "_preferred": "h" + }, + "NL": { + "_allowed": "H", + "_preferred": "H" + }, + "NZ": { + "_allowed": "H h", + "_preferred": "h" + }, + "OM": { + "_allowed": "H h", + "_preferred": "h" + }, + "PG": { + "_allowed": "H h", + "_preferred": "h" + }, + "PK": { + "_allowed": "H h", + "_preferred": "h" + }, + "PM": { + "_allowed": "H", + "_preferred": "H" + }, + "PR": { + "_allowed": "H h", + "_preferred": "h" + }, + "PS": { + "_allowed": "H h", + "_preferred": "h" + }, + "PT": { + "_allowed": "H", + "_preferred": "H" + }, + "PW": { + "_allowed": "H h", + "_preferred": "h" + }, + "QA": { + "_allowed": "H h", + "_preferred": "h" + }, + "RE": { + "_allowed": "H", + "_preferred": "H" + }, + "RO": { + "_allowed": "H", + "_preferred": "H" + }, + "RU": { + "_allowed": "H", + "_preferred": "H" + }, + "SA": { + "_allowed": "H h", + "_preferred": "h" + }, + "SB": { + "_allowed": "H h", + "_preferred": "h" + }, + "SD": { + "_allowed": "H h", + "_preferred": "h" + }, + "SE": { + "_allowed": "H", + "_preferred": "H" + }, + "SG": { + "_allowed": "H h", + "_preferred": "h" + }, + "SI": { + "_allowed": "H", + "_preferred": "H" + }, + "SJ": { + "_allowed": "H", + "_preferred": "H" + }, + "SK": { + "_allowed": "H", + "_preferred": "H" + }, + "SL": { + "_allowed": "H h", + "_preferred": "h" + }, + "SM": { + "_allowed": "H", + "_preferred": "H" + }, + "SO": { + "_allowed": "H h", + "_preferred": "h" + }, + "SR": { + "_allowed": "H", + "_preferred": "H" + }, + "SS": { + "_allowed": "H h", + "_preferred": "h" + }, + "ST": { + "_allowed": "H", + "_preferred": "H" + }, + "SY": { + "_allowed": "H h", + "_preferred": "h" + }, + "SZ": { + "_allowed": "H h", + "_preferred": "h" + }, + "TC": { + "_allowed": "H h", + "_preferred": "h" + }, + "TD": { + "_allowed": "H h", + "_preferred": "h" + }, + "TG": { + "_allowed": "H", + "_preferred": "H" + }, + "TN": { + "_allowed": "H h", + "_preferred": "h" + }, + "TR": { + "_allowed": "H", + "_preferred": "H" + }, + "TT": { + "_allowed": "H h", + "_preferred": "h" + }, + "TW": { + "_allowed": "H h", + "_preferred": "h" + }, + "UM": { + "_allowed": "H h", + "_preferred": "h" + }, + "US": { + "_allowed": "H h", + "_preferred": "h" + }, + "VC": { + "_allowed": "H h", + "_preferred": "h" + }, + "VG": { + "_allowed": "H h", + "_preferred": "h" + }, + "VI": { + "_allowed": "H h", + "_preferred": "h" + }, + "VU": { + "_allowed": "H h", + "_preferred": "h" + }, + "WF": { + "_allowed": "H", + "_preferred": "H" + }, + "WS": { + "_allowed": "H h", + "_preferred": "h" + }, + "YE": { + "_allowed": "H h", + "_preferred": "h" + }, + "YT": { + "_allowed": "H", + "_preferred": "H" + }, + "ZA": { + "_allowed": "H h", + "_preferred": "h" + }, + "ZM": { + "_allowed": "H h", + "_preferred": "h" + }, + "ZW": { + "_allowed": "H h", + "_preferred": "h" + } + } + } +}); + +/** + * jQuery UI translation data + */ var regions = { - "en": { - "closeText": "Done", - "prevText": "Prev", - "nextText": "Next", - "currentText": "Today", - "weekHeader": "Wk", - "dateFormat": "d", - "datePickerRole": "date picker" - }, - "af": { - "closeText": "Selekteer", - "prevText": "Vorige", - "nextText": "Volgende", - "currentText": "Vandag", - "weekHeader": "Wk", - "dateFormat": "d" - }, - "zh-TW": { - "closeText": "\u95dc\u9589", - "prevText": "<\u4e0a\u6708", - "nextText": "\u4e0b\u6708>", - "currentText": "\u4eca\u5929", - "weekHeader": "\u5468", - "dateFormat": "d" - }, - "ar": { - "closeText": "\u0625\u063a\u0644\u0627\u0642", - "prevText": "<\u0627\u0644\u0633\u0627\u0628\u0642", - "nextText": "\u0627\u0644\u062a\u0627\u0644\u064a>", - "currentText": "\u0627\u0644\u064a\u0648\u0645", - "weekHeader": "\u0623\u0633\u0628\u0648\u0639", - "dateFormat": "d" - }, - "az": { - "closeText": "Ba\u011fla", - "prevText": "<Geri", - "nextText": "\u0130r\u0259li>", - "currentText": "Bug\u00fcn", - "weekHeader": "Hf", - "dateFormat": "d" - }, - "bg": { - "closeText": "\u0437\u0430\u0442\u0432\u043e\u0440\u0438", - "prevText": "<\u043d\u0430\u0437\u0430\u0434", - "nextText": "\u043d\u0430\u043f\u0440\u0435\u0434>", - "currentText": "\u0434\u043d\u0435\u0441", - "weekHeader": "Wk", - "dateFormat": "d" - }, - "bs": { - "closeText": "Zatvori", - "prevText": "<", - "nextText": ">", - "currentText": "Danas", - "weekHeader": "Wk", - "dateFormat": "d" - }, - "ca": { - "closeText": "Tancar", - "prevText": "<Ant", - "nextText": "Seg>", - "currentText": "Avui", - "weekHeader": "Sm", - "dateFormat": "d" - }, - "cs": { - "closeText": "Zav\u0159\u00edt", - "prevText": "<D\u0159\u00edve", - "nextText": "Pozd\u011bji>", - "currentText": "Nyn\u00ed", - "weekHeader": "T\u00fdd", - "dateFormat": "d" - }, - "da": { - "closeText": "Luk", - "prevText": "<Forrige", - "nextText": "N\u00e6ste>", - "currentText": "Idag", - "weekHeader": "Uge", - "dateFormat": "d" - }, - "de": { - "closeText": "schlie\u00dfen", - "prevText": "<zur\u00fcck", - "nextText": "Vor>", - "currentText": "heute", - "weekHeader": "Wo", - "dateFormat": "d" - }, - "el": { - "closeText": "\u039a\u03bb\u03b5\u03af\u03c3\u03b9\u03bc\u03bf", - "prevText": "\u03a0\u03c1\u03bf\u03b7\u03b3\u03bf\u03cd\u03bc\u03b5\u03bd\u03bf\u03c2", - "nextText": "\u0395\u03c0\u03cc\u03bc\u03b5\u03bd\u03bf\u03c2", - "currentText": "\u03a4\u03c1\u03ad\u03c7\u03c9\u03bd \u039c\u03ae\u03bd\u03b1\u03c2", - "weekHeader": "\u0395\u03b2\u03b4", - "dateFormat": "d" - }, - "en-GB": { - "closeText": "Done", - "prevText": "Prev", - "nextText": "Next", - "currentText": "Today", - "weekHeader": "Wk", - "dateFormat": "d" - }, - "eo": { - "closeText": "Fermi", - "prevText": "<Anta", - "nextText": "Sekv>", - "currentText": "Nuna", - "weekHeader": "Sb", - "dateFormat": "dd/MM/yyyy" - }, - "es": { - "closeText": "Cerrar", - "prevText": "<Ant", - "nextText": "Sig>", - "currentText": "Hoy", - "weekHeader": "Sm", - "dateFormat": "d" - }, - "et": { - "closeText": "Sulge", - "prevText": "Eelnev", - "nextText": "J\u00e4rgnev", - "currentText": "T\u00e4na", - "weekHeader": "Sm", - "dateFormat": "d" - }, - "eu": { - "closeText": "Egina", - "prevText": "<Aur", - "nextText": "Hur>", - "currentText": "Gaur", - "weekHeader": "Wk", - "dateFormat": "d" - }, - "fa": { - "closeText": "\u0628\u0633\u062a\u0646", - "prevText": "<\u0642\u0628\u0644\u064a", - "nextText": "\u0628\u0639\u062f\u064a>", - "currentText": "\u0627\u0645\u0631\u0648\u0632", - "weekHeader": "\u0647\u0641", - "dateFormat": "d" - }, - "fi": { - "closeText": "Sulje", - "prevText": "«Edellinen", - "nextText": "Seuraava»", - "currentText": "Tänään", - "weekHeader": "Vk", - "dateFormat": "d" - }, - "fo": { - "closeText": "Lat aftur", - "prevText": "<Fyrra", - "nextText": "N\u00e6sta>", - "currentText": "\u00cd dag", - "weekHeader": "Vk", - "dateFormat": "d" - }, - "fr-CH": { - "closeText": "Fermer", - "prevText": "<Pr\u00e9c", - "nextText": "Suiv>", - "currentText": "Courant", - "weekHeader": "Sm", - "dateFormat": "d" - }, - "fr": { - "closeText": "Fermer", - "prevText": "<Pr\u00e9c", - "nextText": "Suiv>", - "currentText": "Courant", - "weekHeader": "Sm", - "dateFormat": "d" - }, - "he": { - "closeText": "\u05e1\u05d2\u05d5\u05e8", - "prevText": "<\u05d4\u05e7\u05d5\u05d3\u05dd", - "nextText": "\u05d4\u05d1\u05d0>", - "currentText": "\u05d4\u05d9\u05d5\u05dd", - "weekHeader": "Wk", - "dateFormat": "d" - }, - "hr": { - "closeText": "Zatvori", - "prevText": "<", - "nextText": ">", - "currentText": "Danas", - "weekHeader": "Tje", - "dateFormat": "d" - }, - "hu": { - "closeText": "bez\u00c3\u00a1r\u00c3\u00a1s", - "prevText": "« vissza", - "nextText": "el\u00c5\u2018re »", - "currentText": "ma", - "weekHeader": "H\u00c3\u00a9", - "dateFormat": "d" - }, - "hy": { - "closeText": "\u00d5\u201c\u00d5\u00a1\u00d5\u00af\u00d5\u00a5\u00d5\u00ac", - "prevText": "<\u00d5\u2020\u00d5\u00a1\u00d5\u00ad.", - "nextText": "\u00d5\u20ac\u00d5\u00a1\u00d5\u00bb.>", - "currentText": "\u00d4\u00b1\u00d5\u00b5\u00d5\u00bd\u00d6\u2026\u00d6\u20ac", - "weekHeader": "\u00d5\u2021\u00d4\u00b2\u00d5\u008f", - "dateFormat": "d" - }, - "id": { - "closeText": "Tutup", - "prevText": "<mundur", - "nextText": "maju>", - "currentText": "hari ini", - "weekHeader": "Mg", - "dateFormat": "d" - }, - "is": { - "closeText": "Loka", - "prevText": "< Fyrri", - "nextText": "Næsti >", - "currentText": "Í dag", - "weekHeader": "Vika", - "dateFormat": "d" - }, - "it": { - "closeText": "Chiudi", - "prevText": "<Prec", - "nextText": "Succ>", - "currentText": "Oggi", - "weekHeader": "Sm", - "dateFormat": "d" - }, - "ja": { - "closeText": "\u9589\u3058\u308b", - "prevText": "<\u524d", - "nextText": "\u6b21>", - "currentText": "\u4eca\u65e5", - "weekHeader": "\u9031", - "dateFormat": "d" - }, - "ko": { - "closeText": "\u00eb\u2039\u00ab\u00ea\u00b8\u00b0", - "prevText": "\u00ec\u009d\u00b4\u00ec\u00a0\u201e\u00eb\u2039\u00ac", - "nextText": "\u00eb\u2039\u00a4\u00ec\u009d\u0152\u00eb\u2039\u00ac", - "currentText": "\u00ec\u02dc\u00a4\u00eb\u0160\u02dc", - "weekHeader": "Wk", - "dateFormat": "d" - }, - "lt": { - "closeText": "U\u00c5\u00bedaryti", - "prevText": "<Atgal", - "nextText": "Pirmyn>", - "currentText": "\u00c5\u00a0iandien", - "weekHeader": "Wk", - "dateFormat": "d" - }, - "lv": { - "closeText": "Aizv\u00c4\u201crt", - "prevText": "Iepr", - "nextText": "N\u00c4\u0081ka", - "currentText": "\u00c5\u00a0odien", - "weekHeader": "Nav", - "dateFormat": "d" - }, - "ms": { - "closeText": "Tutup", - "prevText": "<Sebelum", - "nextText": "Selepas>", - "currentText": "hari ini", - "weekHeader": "Mg", - "dateFormat": "d" - }, - "nl": { - "closeText": "Sluiten", - "prevText": "\u2190", - "nextText": "\u2192", - "currentText": "Vandaag", - "weekHeader": "Wk", - "dateFormat": "d" - }, - "no": { - "closeText": "Lukk", - "prevText": "«Forrige", - "nextText": "Neste»", - "currentText": "I dag", - "weekHeader": "Uke", - "dateFormat": "d" - }, - "pl": { - "closeText": "Zamknij", - "prevText": "<Poprzedni", - "nextText": "Nast\u00c4\u2122pny>", - "currentText": "Dzi\u00c5\u203a", - "weekHeader": "Tydz", - "dateFormat": "d" - }, - "pt-BR": { - "closeText": "Fechar", - "prevText": "<Anterior", - "nextText": "Próximo>", - "currentText": "Hoje", - "weekHeader": "Sm", - "dateFormat": "d" - }, - "ro": { - "closeText": "\u00cenchide", - "prevText": "« Luna precedent\u0103", - "nextText": "Luna urm\u0103toare »", - "currentText": "Azi", - "weekHeader": "S\u0103pt", - "dateFormat": "d" - }, - "ru": { - "closeText": "\u00d0\u2014\u00d0\u00b0\u00d0\u00ba\u00d1\u20ac\u00d1\u2039\u00d1\u201a\u00d1\u0152", - "prevText": "<\u00d0\u0178\u00d1\u20ac\u00d0\u00b5\u00d0\u00b4", - "nextText": "\u00d0\u00a1\u00d0\u00bb\u00d0\u00b5\u00d0\u00b4>", - "currentText": "\u00d0\u00a1\u00d0\u00b5\u00d0\u00b3\u00d0\u00be\u00d0\u00b4\u00d0\u00bd\u00d1\u008f", - "weekHeader": "\u00d0\u009d\u00d0\u00b5", - "dateFormat": "d" - }, - "sk": { - "closeText": "Zavrie\u00c5\u00a5", - "prevText": "<Predch\u00c3\u00a1dzaj\u00c3\u00baci", - "nextText": "Nasleduj\u00c3\u00baci>", - "currentText": "Dnes", - "weekHeader": "Ty", - "dateFormat": "d" - }, - "sl": { - "closeText": "Zapri", - "prevText": "<Prejšnji", - "nextText": "Naslednji>", - "currentText": "Trenutni", - "weekHeader": "Teden", - "dateFormat": "d" - }, - "sq": { - "closeText": "mbylle", - "prevText": "<mbrapa", - "nextText": "P\u00ebrpara>", - "currentText": "sot", - "weekHeader": "Ja", - "dateFormat": "d" - }, - "sr-SR": { - "closeText": "Zatvori", - "prevText": "<", - "nextText": ">", - "currentText": "Danas", - "weekHeader": "Sed", - "dateFormat": "dd/MM/yyyy" - }, - "sr": { - "closeText": "\u0417\u0430\u0442\u0432\u043e\u0440\u0438", - "prevText": "<", - "nextText": ">", - "currentText": "\u0414\u0430\u043d\u0430\u0441", - "weekHeader": "\u0421\u0435\u0434", - "dateFormat": "d" - }, - "sv": { - "closeText": "St\u00e4ng", - "prevText": "«F\u00f6rra", - "nextText": "N\u00e4sta»", - "currentText": "Idag", - "weekHeader": "Ve", - "dateFormat": "d" - }, - "ta": { - "closeText": "\u0bae\u0bc2\u0b9f\u0bc1", - "prevText": "\u0bae\u0bc1\u0ba9\u0bcd\u0ba9\u0bc8\u0baf\u0ba4\u0bc1", - "nextText": "\u0b85\u0b9f\u0bc1\u0ba4\u0bcd\u0ba4\u0ba4\u0bc1", - "currentText": "\u0b87\u0ba9\u0bcd\u0bb1\u0bc1", - "weekHeader": "\u041d\u0435", - "dateFormat": "d" - }, - "th": { - "closeText": "\u0e1b\u0e34\u0e14", - "prevText": "« \u0e22\u0e49\u0e2d\u0e19", - "nextText": "\u0e16\u0e31\u0e14\u0e44\u0e1b »", - "currentText": "\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49", - "weekHeader": "Wk", - "dateFormat": "d" - }, - "tr": { - "closeText": "kapat", - "prevText": "<geri", - "nextText": "ileri>", - "currentText": "bug\u00c3\u00bcn", - "weekHeader": "Hf", - "dateFormat": "d" - }, - "uk": { - "closeText": "\u00d0\u2014\u00d0\u00b0\u00d0\u00ba\u00d1\u20ac\u00d0\u00b8\u00d1\u201a\u00d0\u00b8", - "prevText": "<", - "nextText": ">", - "currentText": "\u00d0\u00a1\u00d1\u0152\u00d0\u00be\u00d0\u00b3\u00d0\u00be\u00d0\u00b4\u00d0\u00bd\u00d1\u2013", - "weekHeader": "\u00d0\u009d\u00d0\u00b5", - "dateFormat": "d" - }, - "vi": { - "closeText": "\u0110\u00f3ng", - "prevText": "<Tr\u01b0\u1edbc", - "nextText": "Ti\u1ebfp>", - "currentText": "H\u00f4m nay", - "weekHeader": "Tu", - "dateFormat": "d" - }, - "zh-CN": { - "closeText": "\u00e5\u2026\u00b3\u00e9\u2014\u00ad", - "prevText": "<\u00e4\u00b8\u0160\u00e6\u0153\u02c6", - "nextText": "\u00e4\u00b8\u2039\u00e6\u0153\u02c6>", - "currentText": "\u00e4\u00bb\u0160\u00e5\u00a4\u00a9", - "weekHeader": "\u00e5\u2018\u00a8", - "dateFormat": "d" - }, - "zh-HK": { - "closeText": "\u00e9\u2014\u0153\u00e9\u2013\u2030", - "prevText": "<\u00e4\u00b8\u0160\u00e6\u0153\u02c6", - "nextText": "\u00e4\u00b8\u2039\u00e6\u0153\u02c6>", - "currentText": "\u00e4\u00bb\u0160\u00e5\u00a4\u00a9", - "weekHeader": "\u00e5\u2018\u00a8", - "dateFormat": "d" - } + "en": { + "closeText": "Done", + "prevText": "Prev", + "nextText": "Next", + "currentText": "Today", + "weekHeader": "Wk", + "dateFormat": "d", + "datePickerRole": "date picker" + }, + "af": { + "closeText": "Selekteer", + "prevText": "Vorige", + "nextText": "Volgende", + "currentText": "Vandag", + "weekHeader": "Wk", + "dateFormat": "d" + }, + "zh-TW": { + "closeText": "\u95dc\u9589", + "prevText": "<\u4e0a\u6708", + "nextText": "\u4e0b\u6708>", + "currentText": "\u4eca\u5929", + "weekHeader": "\u5468", + "dateFormat": "d" + }, + "ar": { + "closeText": "\u0625\u063a\u0644\u0627\u0642", + "prevText": "<\u0627\u0644\u0633\u0627\u0628\u0642", + "nextText": "\u0627\u0644\u062a\u0627\u0644\u064a>", + "currentText": "\u0627\u0644\u064a\u0648\u0645", + "weekHeader": "\u0623\u0633\u0628\u0648\u0639", + "dateFormat": "d" + }, + "az": { + "closeText": "Ba\u011fla", + "prevText": "<Geri", + "nextText": "\u0130r\u0259li>", + "currentText": "Bug\u00fcn", + "weekHeader": "Hf", + "dateFormat": "d" + }, + "bg": { + "closeText": "\u0437\u0430\u0442\u0432\u043e\u0440\u0438", + "prevText": "<\u043d\u0430\u0437\u0430\u0434", + "nextText": "\u043d\u0430\u043f\u0440\u0435\u0434>", + "currentText": "\u0434\u043d\u0435\u0441", + "weekHeader": "Wk", + "dateFormat": "d" + }, + "bs": { + "closeText": "Zatvori", + "prevText": "<", + "nextText": ">", + "currentText": "Danas", + "weekHeader": "Wk", + "dateFormat": "d" + }, + "ca": { + "closeText": "Tancar", + "prevText": "<Ant", + "nextText": "Seg>", + "currentText": "Avui", + "weekHeader": "Sm", + "dateFormat": "d" + }, + "cs": { + "closeText": "Zav\u0159\u00edt", + "prevText": "<D\u0159\u00edve", + "nextText": "Pozd\u011bji>", + "currentText": "Nyn\u00ed", + "weekHeader": "T\u00fdd", + "dateFormat": "d" + }, + "da": { + "closeText": "Luk", + "prevText": "<Forrige", + "nextText": "N\u00e6ste>", + "currentText": "Idag", + "weekHeader": "Uge", + "dateFormat": "d" + }, + "de": { + "closeText": "schlie\u00dfen", + "prevText": "<zur\u00fcck", + "nextText": "Vor>", + "currentText": "heute", + "weekHeader": "Wo", + "dateFormat": "d" + }, + "el": { + "closeText": "\u039a\u03bb\u03b5\u03af\u03c3\u03b9\u03bc\u03bf", + "prevText": "\u03a0\u03c1\u03bf\u03b7\u03b3\u03bf\u03cd\u03bc\u03b5\u03bd\u03bf\u03c2", + "nextText": "\u0395\u03c0\u03cc\u03bc\u03b5\u03bd\u03bf\u03c2", + "currentText": "\u03a4\u03c1\u03ad\u03c7\u03c9\u03bd \u039c\u03ae\u03bd\u03b1\u03c2", + "weekHeader": "\u0395\u03b2\u03b4", + "dateFormat": "d" + }, + "en-GB": { + "closeText": "Done", + "prevText": "Prev", + "nextText": "Next", + "currentText": "Today", + "weekHeader": "Wk", + "dateFormat": "d" + }, + "eo": { + "closeText": "Fermi", + "prevText": "<Anta", + "nextText": "Sekv>", + "currentText": "Nuna", + "weekHeader": "Sb", + "dateFormat": "dd/MM/yyyy" + }, + "es": { + "closeText": "Cerrar", + "prevText": "<Ant", + "nextText": "Sig>", + "currentText": "Hoy", + "weekHeader": "Sm", + "dateFormat": "d" + }, + "et": { + "closeText": "Sulge", + "prevText": "Eelnev", + "nextText": "J\u00e4rgnev", + "currentText": "T\u00e4na", + "weekHeader": "Sm", + "dateFormat": "d" + }, + "eu": { + "closeText": "Egina", + "prevText": "<Aur", + "nextText": "Hur>", + "currentText": "Gaur", + "weekHeader": "Wk", + "dateFormat": "d" + }, + "fa": { + "closeText": "\u0628\u0633\u062a\u0646", + "prevText": "<\u0642\u0628\u0644\u064a", + "nextText": "\u0628\u0639\u062f\u064a>", + "currentText": "\u0627\u0645\u0631\u0648\u0632", + "weekHeader": "\u0647\u0641", + "dateFormat": "d" + }, + "fi": { + "closeText": "Sulje", + "prevText": "«Edellinen", + "nextText": "Seuraava»", + "currentText": "Tänään", + "weekHeader": "Vk", + "dateFormat": "d" + }, + "fo": { + "closeText": "Lat aftur", + "prevText": "<Fyrra", + "nextText": "N\u00e6sta>", + "currentText": "\u00cd dag", + "weekHeader": "Vk", + "dateFormat": "d" + }, + "fr-CH": { + "closeText": "Fermer", + "prevText": "<Pr\u00e9c", + "nextText": "Suiv>", + "currentText": "Courant", + "weekHeader": "Sm", + "dateFormat": "d" + }, + "fr": { + "closeText": "Fermer", + "prevText": "<Pr\u00e9c", + "nextText": "Suiv>", + "currentText": "Courant", + "weekHeader": "Sm", + "dateFormat": "d" + }, + "he": { + "closeText": "\u05e1\u05d2\u05d5\u05e8", + "prevText": "<\u05d4\u05e7\u05d5\u05d3\u05dd", + "nextText": "\u05d4\u05d1\u05d0>", + "currentText": "\u05d4\u05d9\u05d5\u05dd", + "weekHeader": "Wk", + "dateFormat": "d" + }, + "hr": { + "closeText": "Zatvori", + "prevText": "<", + "nextText": ">", + "currentText": "Danas", + "weekHeader": "Tje", + "dateFormat": "d" + }, + "hu": { + "closeText": "bez\u00c3\u00a1r\u00c3\u00a1s", + "prevText": "« vissza", + "nextText": "el\u00c5\u2018re »", + "currentText": "ma", + "weekHeader": "H\u00c3\u00a9", + "dateFormat": "d" + }, + "hy": { + "closeText": "\u00d5\u201c\u00d5\u00a1\u00d5\u00af\u00d5\u00a5\u00d5\u00ac", + "prevText": "<\u00d5\u2020\u00d5\u00a1\u00d5\u00ad.", + "nextText": "\u00d5\u20ac\u00d5\u00a1\u00d5\u00bb.>", + "currentText": "\u00d4\u00b1\u00d5\u00b5\u00d5\u00bd\u00d6\u2026\u00d6\u20ac", + "weekHeader": "\u00d5\u2021\u00d4\u00b2\u00d5\u008f", + "dateFormat": "d" + }, + "id": { + "closeText": "Tutup", + "prevText": "<mundur", + "nextText": "maju>", + "currentText": "hari ini", + "weekHeader": "Mg", + "dateFormat": "d" + }, + "is": { + "closeText": "Loka", + "prevText": "< Fyrri", + "nextText": "Næsti >", + "currentText": "Í dag", + "weekHeader": "Vika", + "dateFormat": "d" + }, + "it": { + "closeText": "Chiudi", + "prevText": "<Prec", + "nextText": "Succ>", + "currentText": "Oggi", + "weekHeader": "Sm", + "dateFormat": "d" + }, + "ja": { + "closeText": "\u9589\u3058\u308b", + "prevText": "<\u524d", + "nextText": "\u6b21>", + "currentText": "\u4eca\u65e5", + "weekHeader": "\u9031", + "dateFormat": "d" + }, + "ko": { + "closeText": "\u00eb\u2039\u00ab\u00ea\u00b8\u00b0", + "prevText": "\u00ec\u009d\u00b4\u00ec\u00a0\u201e\u00eb\u2039\u00ac", + "nextText": "\u00eb\u2039\u00a4\u00ec\u009d\u0152\u00eb\u2039\u00ac", + "currentText": "\u00ec\u02dc\u00a4\u00eb\u0160\u02dc", + "weekHeader": "Wk", + "dateFormat": "d" + }, + "lt": { + "closeText": "U\u00c5\u00bedaryti", + "prevText": "<Atgal", + "nextText": "Pirmyn>", + "currentText": "\u00c5\u00a0iandien", + "weekHeader": "Wk", + "dateFormat": "d" + }, + "lv": { + "closeText": "Aizv\u00c4\u201crt", + "prevText": "Iepr", + "nextText": "N\u00c4\u0081ka", + "currentText": "\u00c5\u00a0odien", + "weekHeader": "Nav", + "dateFormat": "d" + }, + "ms": { + "closeText": "Tutup", + "prevText": "<Sebelum", + "nextText": "Selepas>", + "currentText": "hari ini", + "weekHeader": "Mg", + "dateFormat": "d" + }, + "nl": { + "closeText": "Sluiten", + "prevText": "\u2190", + "nextText": "\u2192", + "currentText": "Vandaag", + "weekHeader": "Wk", + "dateFormat": "d" + }, + "no": { + "closeText": "Lukk", + "prevText": "«Forrige", + "nextText": "Neste»", + "currentText": "I dag", + "weekHeader": "Uke", + "dateFormat": "d" + }, + "pl": { + "closeText": "Zamknij", + "prevText": "<Poprzedni", + "nextText": "Nast\u00c4\u2122pny>", + "currentText": "Dzi\u00c5\u203a", + "weekHeader": "Tydz", + "dateFormat": "d" + }, + "pt-BR": { + "closeText": "Fechar", + "prevText": "<Anterior", + "nextText": "Próximo>", + "currentText": "Hoje", + "weekHeader": "Sm", + "dateFormat": "d" + }, + "ro": { + "closeText": "\u00cenchide", + "prevText": "« Luna precedent\u0103", + "nextText": "Luna urm\u0103toare »", + "currentText": "Azi", + "weekHeader": "S\u0103pt", + "dateFormat": "d" + }, + "ru": { + "closeText": "\u00d0\u2014\u00d0\u00b0\u00d0\u00ba\u00d1\u20ac\u00d1\u2039\u00d1\u201a\u00d1\u0152", + "prevText": "<\u00d0\u0178\u00d1\u20ac\u00d0\u00b5\u00d0\u00b4", + "nextText": "\u00d0\u00a1\u00d0\u00bb\u00d0\u00b5\u00d0\u00b4>", + "currentText": "\u00d0\u00a1\u00d0\u00b5\u00d0\u00b3\u00d0\u00be\u00d0\u00b4\u00d0\u00bd\u00d1\u008f", + "weekHeader": "\u00d0\u009d\u00d0\u00b5", + "dateFormat": "d" + }, + "sk": { + "closeText": "Zavrie\u00c5\u00a5", + "prevText": "<Predch\u00c3\u00a1dzaj\u00c3\u00baci", + "nextText": "Nasleduj\u00c3\u00baci>", + "currentText": "Dnes", + "weekHeader": "Ty", + "dateFormat": "d" + }, + "sl": { + "closeText": "Zapri", + "prevText": "<Prejšnji", + "nextText": "Naslednji>", + "currentText": "Trenutni", + "weekHeader": "Teden", + "dateFormat": "d" + }, + "sq": { + "closeText": "mbylle", + "prevText": "<mbrapa", + "nextText": "P\u00ebrpara>", + "currentText": "sot", + "weekHeader": "Ja", + "dateFormat": "d" + }, + "sr-SR": { + "closeText": "Zatvori", + "prevText": "<", + "nextText": ">", + "currentText": "Danas", + "weekHeader": "Sed", + "dateFormat": "dd/MM/yyyy" + }, + "sr": { + "closeText": "\u0417\u0430\u0442\u0432\u043e\u0440\u0438", + "prevText": "<", + "nextText": ">", + "currentText": "\u0414\u0430\u043d\u0430\u0441", + "weekHeader": "\u0421\u0435\u0434", + "dateFormat": "d" + }, + "sv": { + "closeText": "St\u00e4ng", + "prevText": "«F\u00f6rra", + "nextText": "N\u00e4sta»", + "currentText": "Idag", + "weekHeader": "Ve", + "dateFormat": "d" + }, + "ta": { + "closeText": "\u0bae\u0bc2\u0b9f\u0bc1", + "prevText": "\u0bae\u0bc1\u0ba9\u0bcd\u0ba9\u0bc8\u0baf\u0ba4\u0bc1", + "nextText": "\u0b85\u0b9f\u0bc1\u0ba4\u0bcd\u0ba4\u0ba4\u0bc1", + "currentText": "\u0b87\u0ba9\u0bcd\u0bb1\u0bc1", + "weekHeader": "\u041d\u0435", + "dateFormat": "d" + }, + "th": { + "closeText": "\u0e1b\u0e34\u0e14", + "prevText": "« \u0e22\u0e49\u0e2d\u0e19", + "nextText": "\u0e16\u0e31\u0e14\u0e44\u0e1b »", + "currentText": "\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49", + "weekHeader": "Wk", + "dateFormat": "d" + }, + "tr": { + "closeText": "kapat", + "prevText": "<geri", + "nextText": "ileri>", + "currentText": "bug\u00c3\u00bcn", + "weekHeader": "Hf", + "dateFormat": "d" + }, + "uk": { + "closeText": "\u00d0\u2014\u00d0\u00b0\u00d0\u00ba\u00d1\u20ac\u00d0\u00b8\u00d1\u201a\u00d0\u00b8", + "prevText": "<", + "nextText": ">", + "currentText": "\u00d0\u00a1\u00d1\u0152\u00d0\u00be\u00d0\u00b3\u00d0\u00be\u00d0\u00b4\u00d0\u00bd\u00d1\u2013", + "weekHeader": "\u00d0\u009d\u00d0\u00b5", + "dateFormat": "d" + }, + "vi": { + "closeText": "\u0110\u00f3ng", + "prevText": "<Tr\u01b0\u1edbc", + "nextText": "Ti\u1ebfp>", + "currentText": "H\u00f4m nay", + "weekHeader": "Tu", + "dateFormat": "d" + }, + "zh-CN": { + "closeText": "\u00e5\u2026\u00b3\u00e9\u2014\u00ad", + "prevText": "<\u00e4\u00b8\u0160\u00e6\u0153\u02c6", + "nextText": "\u00e4\u00b8\u2039\u00e6\u0153\u02c6>", + "currentText": "\u00e4\u00bb\u0160\u00e5\u00a4\u00a9", + "weekHeader": "\u00e5\u2018\u00a8", + "dateFormat": "d" + }, + "zh-HK": { + "closeText": "\u00e9\u2014\u0153\u00e9\u2013\u2030", + "prevText": "<\u00e4\u00b8\u0160\u00e6\u0153\u02c6", + "nextText": "\u00e4\u00b8\u2039\u00e6\u0153\u02c6>", + "currentText": "\u00e4\u00bb\u0160\u00e5\u00a4\u00a9", + "weekHeader": "\u00e5\u2018\u00a8", + "dateFormat": "d" + } }; + $.each( regions, function( name, value ) { - var culture = Globalize.findClosestCulture( name ); - Globalize.addCultureInfo( culture && culture.name || name, { - messages : { - datepicker : value - } + Globalize.loadTranslations( name, { + datepicker : value }); }); diff --git a/tests/unit/date/date.html b/tests/unit/date/date.html index e3454a55b..d759fdeae 100644 --- a/tests/unit/date/date.html +++ b/tests/unit/date/date.html @@ -12,9 +12,9 @@ <script> TestHelpers.loadResources({ js: [ - "external/date.js", "external/globalize.js", - "external/globalize.culture.de-DE.js" + "external/localization.js", + "external/date.js" ] }); </script> @@ -37,4 +37,4 @@ </div> </body> -</html>
\ No newline at end of file +</html> diff --git a/tests/unit/date/date_core.js b/tests/unit/date/date_core.js index b75ef8087..3452580c8 100644 --- a/tests/unit/date/date_core.js +++ b/tests/unit/date/date_core.js @@ -53,29 +53,28 @@ test("Date Adjustments - Leap Year Edge Cases", 1, function(){ test("List days of Week", 2, function(){ var date = $.date(), offset0 = [ - { "fullname": "Sunday", "shortname": "Su" }, - { "fullname": "Monday", "shortname": "Mo" }, - { "fullname": "Tuesday", "shortname": "Tu" }, - { "fullname": "Wednesday", "shortname": "We" }, - { "fullname": "Thursday", "shortname": "Th" }, - { "fullname": "Friday", "shortname": "Fr" }, - { "fullname": "Saturday", "shortname": "Sa" } + { "fullname": "Sunday", "shortname": "Sun" }, + { "fullname": "Monday", "shortname": "Mon" }, + { "fullname": "Tuesday", "shortname": "Tue" }, + { "fullname": "Wednesday", "shortname": "Wed" }, + { "fullname": "Thursday", "shortname": "Thu" }, + { "fullname": "Friday", "shortname": "Fri" }, + { "fullname": "Saturday", "shortname": "Sat" } ], offset1 = [ - { "fullname": "Montag", "shortname": "Mo" }, - { "fullname": "Dienstag", "shortname": "Di" }, - { "fullname": "Mittwoch", "shortname": "Mi" }, - { "fullname": "Donnerstag", "shortname": "Do" }, - { "fullname": "Freitag", "shortname": "Fr" }, - { "fullname": "Samstag", "shortname": "Sa" }, - { "fullname": "Sonntag", "shortname": "So" } + { "fullname": "Montag", "shortname": "Mo." }, + { "fullname": "Dienstag", "shortname": "Di." }, + { "fullname": "Mittwoch", "shortname": "Mi." }, + { "fullname": "Donnerstag", "shortname": "Do." }, + { "fullname": "Freitag", "shortname": "Fr." }, + { "fullname": "Samstag", "shortname": "Sa." }, + { "fullname": "Sonntag", "shortname": "So." } ]; deepEqual(date.weekdays(), offset0, "Get weekdays with start of day on 0 (English)"); - Globalize.culture( "de-DE" ); - date.refresh(); + Globalize.locale( "de-DE" ); deepEqual(date.weekdays(), offset1, "Get weekdays with start of day on 1 (Germany)"); //Revert Globalize changes back to English - Globalize.culture("en-EN"); + Globalize.locale( "en" ); }); test("Leap Year Check", 8, function(){ @@ -101,10 +100,9 @@ test("Days in Month", 3, function(){ test("Month Name", 2, function(){ var date = $.date(); equal(date.setMonth(3).monthName(), "April", "Month name return April (English)"); - Globalize.culture( "de-DE" ); - date.refresh(); + Globalize.locale( "de-DE" ); equal(date.setMonth(2).monthName(), "März", "Month name return March (German)"); - Globalize.culture("en-EN"); + Globalize.locale( "en" ); }); @@ -154,13 +152,6 @@ test( "Months", 5, function(){ ok( firstMonth.month() === lastMonth.month() - 1 ); }); -test("iso8601Week", 2, function(){ - var date = $.date(); - //date.setFullDate(2012, 0, 8); - equal(date.iso8601Week(new Date(2012, 0, 8)), 1, "Test first week is 1"); - equal(date.iso8601Week(new Date(2012, 11, 31)), 1, "Test last week is 1 in next year"); -}); - test("Equal", 4, function(){ var date = $.date(); date.setFullDate(2012, 9, 16); @@ -178,45 +169,8 @@ test("Date", 1, function(){ test("Format", 4, function(){ var date = $.date(); date.setFullDate(2012, 9, 16); - equal(date.format(), "10/16/2012", "Checking default US format"); - equal(date.format("yyyy/MM/dd"), "2012/10/16", "Checking yyyy/MM/dd format"); - equal(date.format("yy/dd/MM"), "12/16/10", "Checking yy/dd/MM format"); - equal(date.format("MMMM dd, yyyy"), "October 16, 2012", "Checking MMMM dd, yyyy format"); -}); - -test("Calendar", 3, function(){ - var date = $.date(), - de_cal = { - calendars: { - standard: { - "/": ".", - firstDay: 1, - days: { - names: ["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"], - namesAbbr: ["So","Mo","Di","Mi","Do","Fr","Sa"], - namesShort: ["So","Mo","Di","Mi","Do","Fr","Sa"] - }, - months: { - names: ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember",""], - namesAbbr: ["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez",""] - }, - AM: null, - PM: null, - eras: [{"name":"n. Chr.","start":null,"offset":0}], - patterns: { - d: "dd.MM.yyyy", - D: "dddd, d. MMMM yyyy", - t: "HH:mm", - T: "HH:mm:ss", - f: "dddd, d. MMMM yyyy HH:mm", - F: "dddd, d. MMMM yyyy HH:mm:ss", - M: "dd MMMM", - Y: "MMMM yyyy" - } - } - } - }; - ok(date.calendar(), "Calendar type returned"); - ok(date.calendar(de_cal), "Calendar type changed"); - deepEqual(date.calendar(), de_cal, "Calendar change verified"); + equal(date.format({ date: "short" }), "10/16/12", "Checking default US format"); + equal(date.format({ pattern: "yyyy/MM/dd" }), "2012/10/16", "Checking yyyy/MM/dd format"); + equal(date.format({ pattern: "yy/dd/MM" }), "12/16/10", "Checking yy/dd/MM format"); + equal(date.format({ pattern: "MMMM dd, yyyy" }), "October 16, 2012", "Checking MMMM dd, yyyy format"); }); diff --git a/tests/unit/datepicker/datepicker.html b/tests/unit/datepicker/datepicker.html index 31fd709ef..b49fe5a4b 100644 --- a/tests/unit/datepicker/datepicker.html +++ b/tests/unit/datepicker/datepicker.html @@ -8,8 +8,8 @@ <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/date.js"></script> <script src="../../../external/globalize/globalize.js"></script> + <script src="../../../external/date.js"></script> <script src="../../../external/localization.js"></script> <script src="../testsuite.js"></script> <script> @@ -21,10 +21,6 @@ "ui/button.js", "ui/position.js", "ui/datepicker.js" - /* TODO: Replace with Globalize cultures - "ui/i18n/datepicker-fr.js", - "ui/i18n/datepicker-he.js", - "ui/i18n/datepicker-zh-CN.js"*/ ] }); </script> diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js index e32a0bb86..926871780 100644 --- a/tests/unit/datepicker/datepicker_core.js +++ b/tests/unit/datepicker/datepicker_core.js @@ -7,7 +7,7 @@ TestHelpers.testJshint( "datepicker" ); test( "input's value determines starting date", function() { expect( 3 ); - var input = $( "#datepicker" ).val( "1/1/2014" ).datepicker(), + var input = $( "#datepicker" ).val( "1/1/14" ).datepicker(), picker = input.datepicker( "widget" ); input.datepicker( "open" ); @@ -228,19 +228,19 @@ test( "Keyboard handling", function() { TestHelpers.datepicker.equalsDate( input.datepicker( "valueAsDate" ), date, "Keystroke enter" ); // Enter = Select today's date by default - input.val( "1/1/2014" ).datepicker( "open" ) + input.val( "1/1/14" ).datepicker( "open" ) .simulate("keydown", { keyCode: $.ui.keyCode.ENTER }); TestHelpers.datepicker.equalsDate( input.datepicker( "valueAsDate" ), new Date( 2014, 0, 1 ), "Keystroke enter - preset" ); // Control + Home = Change the calendar to the current month - input.val( "1/1/2014" ).datepicker( "open" ) + input.val( "1/1/14" ).datepicker( "open" ) .simulate( "keydown", { ctrlKey: true, keyCode: $.ui.keyCode.HOME }) .simulate( "keydown", { keyCode: $.ui.keyCode.ENTER }); TestHelpers.datepicker.equalsDate( input.datepicker( "valueAsDate" ), date, "Keystroke ctrl+home" ); // Control + End = Close the calendar and clear the input - input.val( "1/1/2014" ).datepicker( "open" ) + input.val( "1/1/14" ).datepicker( "open" ) .simulate( "keydown", { ctrlKey: true, keyCode: $.ui.keyCode.END }); equal( input.val(), "", "Keystroke ctrl+end" ); @@ -249,12 +249,12 @@ test( "Keyboard handling", function() { input.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE }); ok( !instance.isOpen, "escape closes the datepicker" ); - input.val( "1/1/2014" ).datepicker( "open" ) + input.val( "1/1/14" ).datepicker( "open" ) .simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE }); TestHelpers.datepicker.equalsDate( input.datepicker( "valueAsDate" ), new Date( 2014, 0, 1 ), "Keystroke esc - preset" ); - input.val( "1/1/2014" ).datepicker( "open" ) + input.val( "1/1/14" ).datepicker( "open" ) .simulate( "keydown", { ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP }) .simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE }); TestHelpers.datepicker.equalsDate( input.datepicker( "valueAsDate" ), new Date( 2014, 0, 1 ), diff --git a/tests/unit/datepicker/datepicker_methods.js b/tests/unit/datepicker/datepicker_methods.js index dcd6dc2c7..81d1b096b 100644 --- a/tests/unit/datepicker/datepicker_methods.js +++ b/tests/unit/datepicker/datepicker_methods.js @@ -69,16 +69,16 @@ test( "value", function() { picker = input.datepicker( "widget" ), inline = $( "#inline" ).datepicker(); - input.datepicker( "value", "1/1/2014" ); - equal( input.val(), "1/1/2014", "input's value set" ); + input.datepicker( "value", "1/1/14" ); + equal( input.val(), "1/1/14", "input's value set" ); ok( picker.find( "a[data-timestamp]:first" ).hasClass( "ui-state-focus" ), "first day marked as selected" ); - equal( input.datepicker( "value" ), "1/1/2014", "getter" ); + equal( input.datepicker( "value" ), "1/1/14", "getter" ); - inline.datepicker( "value", "1/1/2014" ); + inline.datepicker( "value", "1/1/14" ); ok( inline.find( "a[data-timestamp]:first" ).hasClass( "ui-state-focus" ), "first day marked as selected" ); - equal( inline.datepicker( "value" ), "1/1/2014", "getter" ); + equal( inline.datepicker( "value" ), "1/1/14", "getter" ); // TODO: Handle for invalid values. @@ -93,7 +93,7 @@ test( "valueAsDate", function() { inline = $( "#inline" ).datepicker(); input.datepicker( "valueAsDate", new Date( 2014, 0, 1 ) ); - equal( input.val(), "1/1/2014", "input's value set" ); + equal( input.val(), "1/1/14", "input's value set" ); ok( picker.find( "a[data-timestamp]:first" ).hasClass( "ui-state-focus" ), "first day marked as selected" ); TestHelpers.datepicker.equalsDate( input.datepicker( "valueAsDate" ), diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js index 3b69acf1a..e541b7e70 100644 --- a/tests/unit/datepicker/datepicker_options.js +++ b/tests/unit/datepicker/datepicker_options.js @@ -42,16 +42,16 @@ test( "appendTo", function() { test( "dateFormat", function() { expect( 2 ); - var input = $( "#datepicker" ).val( "1/1/2014" ).datepicker(), + var input = $( "#datepicker" ).val( "1/1/14" ).datepicker(), picker = input.datepicker( "widget" ), firstDayLink = picker.find( "td[id]:first a" ); input.datepicker( "open" ); firstDayLink.trigger( "mousedown" ); - equal( input.val(), "1/1/2014", "default formatting" ); + equal( input.val(), "1/1/14", "default formatting" ); - input.datepicker( "option", "dateFormat", "D" ); - equal( input.val(), "Wednesday, January 01, 2014", "updated formatting" ); + input.datepicker( "option", "dateFormat", { date: "full" } ); + equal( input.val(), "Wednesday, January 1, 2014", "updated formatting" ); input.datepicker( "destroy" ); }); diff --git a/ui/datepicker.js b/ui/datepicker.js index 662206912..6ee7aaed1 100644 --- a/ui/datepicker.js +++ b/ui/datepicker.js @@ -58,6 +58,7 @@ $.widget( "ui.datepicker", { select: null }, _create: function() { + this.options.dateFormat = this.options.dateFormat || { date: "short" }; this.date = $.date( null, this.options.dateFormat ); this.date.eachDay = this.options.eachDay; @@ -309,8 +310,6 @@ $.widget( "ui.datepicker", { return element; }, _createTmpl: function() { - this.date.refresh(); - this._createDatepicker(); this.picker.find( "button" ).button(); @@ -351,6 +350,7 @@ $.widget( "ui.datepicker", { i = 0; for ( i; i < months.length; i++ ) { + // TODO Shouldn't we pass date as a parameter to build* fns instead of setting this.date? this.date = months[ i ]; headerClass = months[ i ].first ? "ui-corner-left" : months[ i ].last ? "ui-corner-right" : ""; @@ -384,7 +384,7 @@ $.widget( "ui.datepicker", { "</div>"; }, _buildPreviousLink: function() { - var labels = Globalize.localize( "datepicker" ); + var labels = Globalize.translate( "datepicker" ); return "<button class='ui-datepicker-prev ui-corner-all' " + "title='" + labels.prevText + "'>" + "<span class='ui-icon ui-icon-circle-triangle-w'>" + @@ -393,7 +393,7 @@ $.widget( "ui.datepicker", { "</button>"; }, _buildNextLink: function() { - var labels = Globalize.localize( "datepicker" ); + var labels = Globalize.translate( "datepicker" ); return "<button class='ui-datepicker-next ui-corner-all' " + "title='" + labels.nextText + "'>" + "<span class='ui-icon ui-icon-circle-triangle-e'>" + @@ -402,7 +402,7 @@ $.widget( "ui.datepicker", { "</button>"; }, _buildTitlebar: function() { - var labels = Globalize.localize( "datepicker" ); + var labels = Globalize.translate( "datepicker" ); return "<div role='header' id='" + this.id + "-title'>" + "<div id='" + this.id + "-month-lbl' class='ui-datepicker-title'>" + this._buildTitle() + @@ -428,7 +428,7 @@ $.widget( "ui.datepicker", { _buildGridHeading: function() { var cells = "", i = 0, - labels = Globalize.localize( "datepicker" ); + labels = Globalize.translate( "datepicker" ); if ( this.options.showWeek ) { cells += "<th class='ui-datepicker-week-col'>" + labels.weekHeader + "</th>"; @@ -448,10 +448,12 @@ $.widget( "ui.datepicker", { "</th>"; }, _buildGridBody: function() { - var rows = "", - i = 0; - for ( i; i < this.date.days().length; i++ ) { - rows += this._buildWeekRow( this.date.days()[i] ); + // this.date.days() is not cached, and it has O(n^2) complexity. It is run O(n) times. So, it equals O(n^3). Not good at all. Caching. + var days = this.date.days(), + i = 0, + rows = ""; + for ( i; i < days.length; i++ ) { + rows += this._buildWeekRow( days[i] ); } return "<tbody role='presentation'>" + rows + "</tbody>"; }, @@ -488,7 +490,7 @@ $.widget( "ui.datepicker", { _buildDayLink: function( day ) { var link, classes = [ "ui-state-default" ], - labels = Globalize.localize( "datepicker" ); + labels = Globalize.translate( "datepicker" ); if ( day.date === this.date.day() ) { classes.push( "ui-state-focus" ); @@ -526,7 +528,7 @@ $.widget( "ui.datepicker", { day.date + "</span>"; }, _buildButtons: function() { - var labels = Globalize.localize( "datepicker" ); + var labels = Globalize.translate( "datepicker" ); return "<div class='ui-datepicker-buttonpane ui-widget-content'>" + "<button class='ui-datepicker-current'>" + labels.currentText + "</button>" + "<button class='ui-datepicker-close'>" + labels.closeText + "</button>" + @@ -544,8 +546,6 @@ $.widget( "ui.datepicker", { refresh: function() { //determine which day gridcell to focus after refresh //TODO: Prevent disabled cells from being focused - this.date.refresh(); - if ( this.options.numberOfMonths === 1 ) { this.grid = $( this._buildGrid() ); $( ".ui-datepicker-title", this.picker ).html( this._buildTitle() ); |