Comparing version 1.0.0-alpha.15 to 1.0.0-alpha.16
{ | ||
"name": "globalize", | ||
"version": "1.0.0-alpha.15", | ||
"version": "1.0.0-alpha.16", | ||
"license": "MIT", | ||
@@ -12,3 +12,3 @@ "ignore": [ | ||
"dependencies": { | ||
"cldrjs": "0.3.10", | ||
"cldrjs": "0.4.0", | ||
"cldr-data": ">=25" | ||
@@ -15,0 +15,0 @@ }, |
/** | ||
* Globalize v1.0.0-alpha.15 | ||
* Globalize v1.0.0-alpha.16 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-01-13T15:01Z | ||
* Date: 2015-01-22T13:16Z | ||
*/ | ||
/*! | ||
* Globalize v1.0.0-alpha.15 2015-01-13T15:01Z Released under the MIT license | ||
* Globalize v1.0.0-alpha.16 2015-01-22T13:16Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/*! | ||
* Globalize v1.0.0-alpha.15 | ||
* Globalize v1.0.0-alpha.16 | ||
* | ||
@@ -10,3 +10,3 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-01-13T15:01Z | ||
* Date: 2015-01-22T13:16Z | ||
*/ | ||
@@ -13,0 +13,0 @@ (function( root, factory ) { |
/** | ||
* Globalize v1.0.0-alpha.15 | ||
* Globalize v1.0.0-alpha.16 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-01-13T15:01Z | ||
* Date: 2015-01-22T13:16Z | ||
*/ | ||
/*! | ||
* Globalize v1.0.0-alpha.15 2015-01-13T15:01Z Released under the MIT license | ||
* Globalize v1.0.0-alpha.16 2015-01-22T13:16Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/** | ||
* Globalize v1.0.0-alpha.15 | ||
* Globalize v1.0.0-alpha.16 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-01-13T15:01Z | ||
* Date: 2015-01-22T13:16Z | ||
*/ | ||
/*! | ||
* Globalize v1.0.0-alpha.15 2015-01-13T15:01Z Released under the MIT license | ||
* Globalize v1.0.0-alpha.16 2015-01-22T13:16Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -25,3 +25,4 @@ */ | ||
"cldr", | ||
"../globalize" | ||
"../globalize", | ||
"cldr/event" | ||
], factory ); | ||
@@ -1705,2 +1706,16 @@ } else if ( typeof exports === "object" ) { | ||
var validateMessageBundle = function( cldr ) { | ||
validate( | ||
"E_MISSING_MESSAGE_BUNDLE", | ||
"Missing message bundle for locale `{locale}`.", | ||
cldr.attributes.bundle && cldr.get( "globalize-messages/{bundle}" ) !== undefined, | ||
{ | ||
locale: cldr.locale | ||
} | ||
); | ||
}; | ||
var validateMessagePresence = function( path, value ) { | ||
@@ -1772,5 +1787,7 @@ path = path.join( "/" ); | ||
Globalize.loadMessages = function( json ) { | ||
var customData = { | ||
"globalize-messages": json | ||
}; | ||
var locale, | ||
customData = { | ||
"globalize-messages": json, | ||
"main": {} | ||
}; | ||
@@ -1780,2 +1797,9 @@ validateParameterPresence( json, "json" ); | ||
// Set available bundles by populating customData main dataset. | ||
for ( locale in json ) { | ||
if ( json.hasOwnProperty( locale ) ) { | ||
customData.main[ locale ] = {}; | ||
} | ||
} | ||
Cldr.load( customData ); | ||
@@ -1803,4 +1827,5 @@ }; | ||
validateDefaultLocale( cldr ); | ||
validateMessageBundle( cldr ); | ||
message = cldr.get( [ "globalize-messages/{languageId}" ].concat( path ) ); | ||
message = cldr.get( [ "globalize-messages/{bundle}" ].concat( path ) ); | ||
validateMessagePresence( path, message ); | ||
@@ -1807,0 +1832,0 @@ |
/** | ||
* Globalize v1.0.0-alpha.15 | ||
* Globalize v1.0.0-alpha.16 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-01-13T15:01Z | ||
* Date: 2015-01-22T13:16Z | ||
*/ | ||
/*! | ||
* Globalize v1.0.0-alpha.15 2015-01-13T15:01Z Released under the MIT license | ||
* Globalize v1.0.0-alpha.16 2015-01-22T13:16Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/** | ||
* Globalize v1.0.0-alpha.15 | ||
* Globalize v1.0.0-alpha.16 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-01-13T15:01Z | ||
* Date: 2015-01-22T13:16Z | ||
*/ | ||
/*! | ||
* Globalize v1.0.0-alpha.15 2015-01-13T15:01Z Released under the MIT license | ||
* Globalize v1.0.0-alpha.16 2015-01-22T13:16Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/*! | ||
* Globalize v1.0.0-alpha.15 | ||
* Globalize v1.0.0-alpha.16 | ||
* | ||
@@ -10,3 +10,3 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-01-13T15:01Z | ||
* Date: 2015-01-22T13:16Z | ||
*/ | ||
@@ -13,0 +13,0 @@ |
{ | ||
"name": "globalize", | ||
"version": "1.0.0-alpha.15", | ||
"version": "1.0.0-alpha.16", | ||
"description": "A JavaScript library for internationalization and localization that leverage the official Unicode CLDR JSON data.", | ||
@@ -67,3 +67,3 @@ "keywords": [ | ||
"dependencies": { | ||
"cldrjs": "0.3.10" | ||
"cldrjs": "0.4.0" | ||
}, | ||
@@ -70,0 +70,0 @@ "peerDependencies": { |
@@ -102,4 +102,4 @@ # Globalize | ||
| globalize/currency.js | +2.6KB | [Currency module](#currency_module) provides currency formatting and parsing | | ||
| globalize/date.js | +4.8KB | [Date module](#date_module) provides date formatting and parsing | | ||
| globalize/message.js | +5.5KB | [Message module](#message_module) provides ICU message format support | | ||
| globalize/date.js | +4.9KB | [Date module](#date_module) provides date formatting and parsing | | ||
| globalize/message.js | +5.6KB | [Message module](#message_module) provides ICU message format support | | ||
| globalize/number.js | +2.9KB | [Number module](#number_module) provides number formatting and parsing | | ||
@@ -106,0 +106,0 @@ | globalize/plural.js | +1.7KB | [Plural module](#plural_module) provides pluralization support | |
@@ -24,3 +24,4 @@ /** | ||
"cldr", | ||
"../globalize" | ||
"../globalize", | ||
"cldr/event" | ||
], factory ); | ||
@@ -27,0 +28,0 @@ } else if ( typeof exports === "object" ) { |
@@ -7,2 +7,3 @@ define([ | ||
"./common/validate/default-locale", | ||
"./common/validate/message-bundle", | ||
"./common/validate/message-presence", | ||
@@ -15,6 +16,8 @@ "./common/validate/message-type", | ||
"./common/validate/plural-module-presence", | ||
"./util/always-array" | ||
"./util/always-array", | ||
"cldr/event" | ||
], function( Cldr, MessageFormat, Globalize, createError, validateDefaultLocale, | ||
validateMessagePresence, validateMessageType, validateParameterPresence, validateParameterType, | ||
validateParameterTypeMessageVariables, validateParameterTypePlainObject, | ||
validateMessageBundle, validateMessagePresence, validateMessageType, validateParameterPresence, | ||
validateParameterType, validateParameterTypeMessageVariables, validateParameterTypePlainObject, | ||
validatePluralModulePresence, alwaysArray ) { | ||
@@ -43,5 +46,7 @@ | ||
Globalize.loadMessages = function( json ) { | ||
var customData = { | ||
"globalize-messages": json | ||
}; | ||
var locale, | ||
customData = { | ||
"globalize-messages": json, | ||
"main": {} | ||
}; | ||
@@ -51,2 +56,9 @@ validateParameterPresence( json, "json" ); | ||
// Set available bundles by populating customData main dataset. | ||
for ( locale in json ) { | ||
if ( json.hasOwnProperty( locale ) ) { | ||
customData.main[ locale ] = {}; | ||
} | ||
} | ||
Cldr.load( customData ); | ||
@@ -74,4 +86,5 @@ }; | ||
validateDefaultLocale( cldr ); | ||
validateMessageBundle( cldr ); | ||
message = cldr.get( [ "globalize-messages/{languageId}" ].concat( path ) ); | ||
message = cldr.get( [ "globalize-messages/{bundle}" ].concat( path ) ); | ||
validateMessagePresence( path, message ); | ||
@@ -78,0 +91,0 @@ |
@@ -19,2 +19,4 @@ require.config({ | ||
"./functional/core", | ||
"./functional/core/load", | ||
"./functional/core/locale", | ||
@@ -21,0 +23,0 @@ // currency |
define([ | ||
"globalize", | ||
"../util" | ||
"../../util" | ||
], function( Globalize, util ) { | ||
@@ -13,3 +13,3 @@ | ||
util.assertPlainObjectParameter( assert, "json", function( invalidValue ) { | ||
util.assertCldrJsonDataParameter( assert, "json", function( invalidValue ) { | ||
return function() { | ||
@@ -16,0 +16,0 @@ Globalize.load( invalidValue ); |
define([ | ||
"globalize", | ||
"../util", | ||
"../../util", | ||
@@ -21,2 +21,6 @@ "globalize/date", | ||
QUnit.test( "should validate whether default locale is defined on static calls", function( assert ) { | ||
// Ensure default locale is not set. | ||
delete Globalize.cldr; | ||
util.assertDefaultLocalePresence( assert, function() { | ||
@@ -39,3 +43,3 @@ Globalize.formatDate( new Date(), "GyMMMEd" ); | ||
util.assertDefaultLocalePresence( assert, function() { | ||
Globalize.translate( "amen" ); | ||
Globalize.formatMessage( "amen" ); | ||
}); | ||
@@ -42,0 +46,0 @@ }); |
@@ -40,3 +40,7 @@ define([ | ||
setup: function() { | ||
Globalize.load( likelySubtags ); | ||
Globalize.load( likelySubtags, { | ||
main: { | ||
en: {} | ||
} | ||
}); | ||
Globalize.locale( "en" ); | ||
@@ -43,0 +47,0 @@ }, |
@@ -27,3 +27,7 @@ define([ | ||
setup: function() { | ||
Globalize.load( likelySubtags ); | ||
Globalize.load( likelySubtags, { | ||
main: { | ||
en: {} | ||
} | ||
}); | ||
Globalize.locale( "en" ); | ||
@@ -30,0 +34,0 @@ }, |
@@ -29,3 +29,7 @@ define([ | ||
setup: function() { | ||
Globalize.load( likelySubtags ); | ||
Globalize.load( likelySubtags, { | ||
main: { | ||
en: {} | ||
} | ||
}); | ||
Globalize.locale( "en" ); | ||
@@ -32,0 +36,0 @@ }, |
@@ -36,3 +36,7 @@ define([ | ||
setup: function() { | ||
Globalize.load( likelySubtags ); | ||
Globalize.load( likelySubtags, { | ||
main: { | ||
en: {} | ||
} | ||
}); | ||
Globalize.locale( "en" ); | ||
@@ -39,0 +43,0 @@ }, |
@@ -43,3 +43,7 @@ define([ | ||
setup: function() { | ||
Globalize.load( likelySubtags ); | ||
Globalize.load( likelySubtags, { | ||
main: { | ||
en: {} | ||
} | ||
}); | ||
Globalize.locale( "en" ); | ||
@@ -46,0 +50,0 @@ }, |
@@ -43,3 +43,7 @@ define([ | ||
setup: function() { | ||
Globalize.load( likelySubtags ); | ||
Globalize.load( likelySubtags, { | ||
main: { | ||
en: {} | ||
} | ||
}); | ||
Globalize.locale( "en" ); | ||
@@ -46,0 +50,0 @@ }, |
@@ -20,2 +20,9 @@ define([ | ||
QUnit.assert.messageBundlePresence = function( fn ) { | ||
this.throws( fn, function E_MISSING_MESSAGE_BUNDLE( error ) { | ||
return error.code === "E_MISSING_MESSAGE_BUNDLE" && | ||
"locale" in error; | ||
}, "Expected \"E_MISSING_MESSAGE_BUNDLE\" to be thrown" ); | ||
}; | ||
QUnit.module( ".messageFormatter( path )", { | ||
@@ -29,8 +36,3 @@ setup: function() { | ||
}, | ||
pt: { | ||
amen: "Amém" | ||
}, | ||
zh: { | ||
amen: "阿门" | ||
}, | ||
de: {}, | ||
en: { | ||
@@ -64,2 +66,11 @@ greetings: { | ||
] | ||
}, | ||
"en-GB": {}, | ||
fr: {}, | ||
pt: { | ||
amen: "Amém" | ||
}, | ||
"pt-PT": {}, | ||
zh: { | ||
amen: "阿门" | ||
} | ||
@@ -71,2 +82,10 @@ }); | ||
QUnit.test( "should pass test's prerequisites", function( assert ) { | ||
var sr = new Globalize( "sr" ); | ||
// OBS: Ensure `sr` cldr/main dataset hasn't being loaded elsewhere. It's a prerequisites for | ||
// the below messageBundlePresence test. | ||
assert.deepEqual( sr.cldr.attributes.bundle, null, "`sr` cldr/main dataset cannot be loaded" ); | ||
}); | ||
QUnit.test( "should validate parameters", function( assert ) { | ||
@@ -85,2 +104,6 @@ util.assertParameterPresence( assert, "path", function() { | ||
QUnit.test( "should validate messages", function( assert ) { | ||
assert.messageBundlePresence(function() { | ||
Globalize( "sr" ).messageFormatter( "path" ); | ||
}); | ||
util.assertMessagePresence( assert, "non-existent/path", function() { | ||
@@ -87,0 +110,0 @@ Globalize( "en" ).messageFormatter( "non-existent/path" ); |
@@ -29,3 +29,7 @@ define([ | ||
setup: function() { | ||
Globalize.load( likelySubtags ); | ||
Globalize.load( likelySubtags, { | ||
main: { | ||
en: {} | ||
} | ||
}); | ||
Globalize.locale( "en" ); | ||
@@ -32,0 +36,0 @@ }, |
@@ -24,3 +24,7 @@ define([ | ||
setup: function() { | ||
Globalize.load( likelySubtags ); | ||
Globalize.load( likelySubtags, { | ||
main: { | ||
en: {} | ||
} | ||
}); | ||
Globalize.locale( "en" ); | ||
@@ -27,0 +31,0 @@ }, |
@@ -16,3 +16,7 @@ define([ | ||
setup: function() { | ||
Globalize.load( likelySubtags ); | ||
Globalize.load( likelySubtags, { | ||
main: { | ||
en: {} | ||
} | ||
}); | ||
Globalize.locale( "en" ); | ||
@@ -19,0 +23,0 @@ }, |
@@ -31,3 +31,11 @@ define([ | ||
setup: function() { | ||
Globalize.load( likelySubtags ); | ||
Globalize.load( likelySubtags, { | ||
main: { | ||
ar: {}, | ||
en: {}, | ||
es: {}, | ||
sv: {}, | ||
zh: {} | ||
} | ||
}); | ||
ar = new Globalize( "ar" ); | ||
@@ -34,0 +42,0 @@ es = new Globalize( "es" ); |
@@ -30,3 +30,7 @@ define([ | ||
setup: function() { | ||
Globalize.load( likelySubtags ); | ||
Globalize.load( likelySubtags, { | ||
main: { | ||
en: {} | ||
} | ||
}); | ||
Globalize.locale( "en" ); | ||
@@ -33,0 +37,0 @@ }, |
@@ -17,2 +17,3 @@ require.config({ | ||
// core | ||
"./unit/core", | ||
"./unit/core/locale", | ||
@@ -19,0 +20,0 @@ |
@@ -14,12 +14,13 @@ define([ | ||
QUnit.test( "should allow String locale", function( assert ) { | ||
var en = Globalize.locale( "en" ); | ||
assert.equal( en.locale, "en" ); | ||
assert.equal( en instanceof Cldr, true ); | ||
Globalize.locale( "en" ); | ||
assert.ok( Globalize.cldr instanceof Cldr ); | ||
assert.equal( Globalize.cldr.locale, "en" ); | ||
}); | ||
QUnit.test( "should allow Cldr instance to be passed as locale", function( assert ) { | ||
var en = new Cldr( "en" ); | ||
assert.equal( Globalize.locale( en ).locale, "en" ); | ||
Globalize.locale( new Cldr( "pt" ) ); | ||
assert.ok( Globalize.cldr instanceof Cldr ); | ||
assert.equal( Globalize.cldr.locale, "pt" ); | ||
}); | ||
}); |
@@ -6,4 +6,9 @@ define([ | ||
"src/util/string/pad", | ||
"json!cldr-data/main/de/ca-gregorian.json", | ||
"json!cldr-data/main/en/ca-gregorian.json", | ||
"json!cldr-data/main/en/timeZoneNames.json", | ||
"json!cldr-data/main/en-GB/ca-gregorian.json", | ||
"json!cldr-data/main/en-IN/ca-gregorian.json", | ||
"json!cldr-data/main/pt/ca-gregorian.json", | ||
"json!cldr-data/main/ru/ca-gregorian.json", | ||
"json!cldr-data/supplemental/likelySubtags.json", | ||
@@ -15,3 +20,4 @@ "json!cldr-data/supplemental/timeData.json", | ||
"cldr/supplemental" | ||
], function( Cldr, format, formatProperties, stringPad, enCaGregorian, timeZoneNames, likelySubtags, | ||
], function( Cldr, format, formatProperties, stringPad, deCaGregorian, enCaGregorian, | ||
enTimeZoneNames, enGbCaGregorian, enInCaGregorian, ptCaGregorian, ruCaGregorian, likelySubtags, | ||
timeData, weekData ) { | ||
@@ -54,6 +60,11 @@ | ||
Cldr.load( | ||
deCaGregorian, | ||
enCaGregorian, | ||
enGbCaGregorian, | ||
enInCaGregorian, | ||
enTimeZoneNames, | ||
likelySubtags, | ||
ptCaGregorian, | ||
ruCaGregorian, | ||
timeData, | ||
timeZoneNames, | ||
weekData | ||
@@ -60,0 +71,0 @@ ); |
@@ -77,2 +77,6 @@ define([ | ||
assertCldrJsonDataParameter: function( assert, name, fn ) { | ||
assertParameterType( assert, [ "array", "cldr", "plainObject" ], name, fn ); | ||
}, | ||
assertCurrencyParameter: function( assert, name, fn ) { | ||
@@ -79,0 +83,0 @@ assertParameterType( assert, [ "string" ], name, fn ); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
532933
207
13993
+ Addedcldrjs@0.4.0(transitive)
- Removedcldrjs@0.3.10(transitive)
Updatedcldrjs@0.4.0