Comparing version 0.4.1 to 0.4.2
/** | ||
* CLDR JavaScript Library v0.4.1 | ||
* CLDR JavaScript Library v0.4.2 | ||
* http://jquery.com/ | ||
@@ -9,6 +9,6 @@ * | ||
* | ||
* Date: 2015-02-25T13:51Z | ||
* Date: 2015-08-23T21:17Z | ||
*/ | ||
/*! | ||
* CLDR JavaScript Library v0.4.1 2015-02-25T13:51Z MIT license © Rafael Xavier | ||
* CLDR JavaScript Library v0.4.2 2015-08-23T21:17Z MIT license © Rafael Xavier | ||
* http://git.io/h4lmVg | ||
@@ -467,9 +467,4 @@ */ | ||
for ( prop in source ) { | ||
if ( prop in destination && arrayIsArray( destination[ prop ] ) ) { | ||
if ( prop in destination && typeof destination[ prop ] === "object" ) { | ||
// Concat Arrays | ||
destination[ prop ] = destination[ prop ].concat( source[ prop ] ); | ||
} else if ( prop in destination && typeof destination[ prop ] === "object" ) { | ||
// Merge Objects | ||
@@ -476,0 +471,0 @@ destination[ prop ] = merge( destination[ prop ], source[ prop ] ); |
/** | ||
* CLDR JavaScript Library v0.4.1 | ||
* CLDR JavaScript Library v0.4.2 | ||
* http://jquery.com/ | ||
@@ -9,6 +9,6 @@ * | ||
* | ||
* Date: 2015-02-25T13:51Z | ||
* Date: 2015-08-23T21:17Z | ||
*/ | ||
/*! | ||
* CLDR JavaScript Library v0.4.1 2015-02-25T13:51Z MIT license © Rafael Xavier | ||
* CLDR JavaScript Library v0.4.2 2015-08-23T21:17Z MIT license © Rafael Xavier | ||
* http://git.io/h4lmVg | ||
@@ -15,0 +15,0 @@ */ |
/** | ||
* CLDR JavaScript Library v0.4.1 | ||
* CLDR JavaScript Library v0.4.2 | ||
* http://jquery.com/ | ||
@@ -9,6 +9,6 @@ * | ||
* | ||
* Date: 2015-02-25T13:51Z | ||
* Date: 2015-08-23T21:17Z | ||
*/ | ||
/*! | ||
* CLDR JavaScript Library v0.4.1 2015-02-25T13:51Z MIT license © Rafael Xavier | ||
* CLDR JavaScript Library v0.4.2 2015-08-23T21:17Z MIT license © Rafael Xavier | ||
* http://git.io/h4lmVg | ||
@@ -15,0 +15,0 @@ */ |
/** | ||
* CLDR JavaScript Library v0.4.1 | ||
* CLDR JavaScript Library v0.4.2 | ||
* http://jquery.com/ | ||
@@ -9,6 +9,6 @@ * | ||
* | ||
* Date: 2015-02-25T13:51Z | ||
* Date: 2015-08-23T21:17Z | ||
*/ | ||
/*! | ||
* CLDR JavaScript Library v0.4.1 2015-02-25T13:51Z MIT license © Rafael Xavier | ||
* CLDR JavaScript Library v0.4.2 2015-08-23T21:17Z MIT license © Rafael Xavier | ||
* http://git.io/h4lmVg | ||
@@ -15,0 +15,0 @@ */ |
/** | ||
* CLDR JavaScript Library v0.4.1 | ||
* CLDR JavaScript Library v0.4.2 | ||
* http://jquery.com/ | ||
@@ -9,6 +9,6 @@ * | ||
* | ||
* Date: 2015-02-25T13:51Z | ||
* Date: 2015-08-23T21:17Z | ||
*/ | ||
/*! | ||
* CLDR JavaScript Library v0.4.1 2015-02-25T13:51Z MIT license © Rafael Xavier | ||
* CLDR JavaScript Library v0.4.2 2015-08-23T21:17Z MIT license © Rafael Xavier | ||
* http://git.io/h4lmVg | ||
@@ -15,0 +15,0 @@ */ |
{ | ||
"name": "cldrjs", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Simple CLDR traverser", | ||
@@ -23,2 +23,10 @@ "keywords": [ | ||
"main": "dist/node_main.js", | ||
"files": [ | ||
"CHANGELOG.md", | ||
"DCO.md", | ||
"dist/", | ||
"doc/", | ||
"LICENSE-MIT", | ||
"README.md" | ||
], | ||
"repository": { | ||
@@ -25,0 +33,0 @@ "type": "git", |
@@ -17,2 +17,3 @@ # cldr.js - Simple CLDR traverser | ||
- [How to get CLDR JSON data?](#how-to-get-cldr-json-data) | ||
- [How do I load CLDR data into Cldrjs?](#how-do-i-load-cldr-data-into-cldrjs) | ||
- [API](#api) | ||
@@ -59,3 +60,3 @@ - [Error reference](#error) | ||
en.attributes; | ||
// { | ||
// > { | ||
// "bundle": "en", | ||
@@ -72,3 +73,3 @@ // "minLanguageId": "en", | ||
zh.attributes; | ||
// { | ||
// > { | ||
// "bundle": "zh-Hant", | ||
@@ -110,11 +111,11 @@ // "minLanguageId": "zh", | ||
```javascript | ||
en.main( "numbers/symbols-numberSystem-latn/decimal" ); | ||
// ➡ "." | ||
// Equivalent to: | ||
// .get( "main/{bundle}/numbers/symbols-numberSystem-latn/decimal" ); | ||
en.main( "numbers/symbols-numberSystem-latn/decimal" ); | ||
// > "." | ||
ptBr.main( "numbers/symbols-numberSystem-latn/decimal" ); | ||
// ➡ "," | ||
// Equivalent to: | ||
// .get( "main/{bundle}/numbers/symbols-numberSystem-latn/decimal" ); | ||
ptBr.main( "numbers/symbols-numberSystem-latn/decimal" ); | ||
// > "," | ||
``` | ||
@@ -125,19 +126,20 @@ | ||
```javascript | ||
var enGender = en.get( "supplemental/gender/personList/{language}" ); | ||
// ➡ "neutral" | ||
// Notice the more complete way to get this data is: | ||
// cldr.get( "supplemental/gender/personList/{language}" ) || | ||
// cldr.get( "supplemental/gender/personList/001" ); | ||
var enGender = en.get( "supplemental/gender/personList/{language}" ); | ||
// > "neutral" | ||
var USCurrencies = en.get( "supplemental/currencyData/region/{territory}" ); | ||
// ➡ | ||
// [ { USD: { _from: "1792-01-01" } }, | ||
// > [ | ||
// { USD: { _from: "1792-01-01" } }, | ||
// { USN: { _tender: "false" } }, | ||
// { USS: { _tender: "false" } } ] | ||
// { USS: { _tender: "false" } } | ||
// ] | ||
var enMeasurementSystem = en.get( "supplemental/measurementData/measurementSystem/{territory}" ); | ||
// ➡ "US" | ||
// Notice the more complete way to get this data is: | ||
// cldr.get( "supplemental/measurementData/measurementSystem/{territory}" ) || | ||
// cldr.get( "supplemental/measurementData/measurementSystem/001" ); | ||
var enMeasurementSystem = en.get( "supplemental/measurementData/measurementSystem/{territory}" ); | ||
// > "US" | ||
``` | ||
@@ -170,11 +172,11 @@ | ||
enIn.main( "dates/calendars/gregorian/dateTimeFormats/availableFormats/yMd" ); | ||
// ➡ "dd/MM/y" | ||
// 1st time retrieved by resolving: en-IN ➡ en-GB (parent locale lookup). | ||
// Further times retrieved straight from the resolved cache. | ||
enIn.main( "dates/calendars/gregorian/dateTimeFormats/availableFormats/yMd" ); | ||
// > "dd/MM/y" | ||
enIn.main( "numbers/symbols-numberSystem-latn/decimal" ); | ||
// ➡ "." | ||
// 1st time retrieved by resolving: en-IN ➡ en-GB (parent locale lookup) ➡ en (truncate lookup) | ||
// Further times retrieved straight from the resolved cache. | ||
enIn.main( "numbers/symbols-numberSystem-latn/decimal" ); | ||
// > "." | ||
``` | ||
@@ -239,6 +241,6 @@ | ||
// Get CLDR item data given its path. | ||
ptBr.main( "numbers/symbols-numberSystem-latn/decimal" ); | ||
// ➡ "," | ||
// Equivalent to: | ||
// .get( "main/{bundle}/numbers/symbols-numberSystem-latn/decimal" ); | ||
ptBr.main( "numbers/symbols-numberSystem-latn/decimal" ); | ||
// > "," | ||
``` | ||
@@ -278,4 +280,21 @@ | ||
The Unicode CLDR is available for download as JSON ([`json.zip`](http://www.unicode.org/Public/cldr/latest/json.zip)). This file contains the complete data of what the Unicode CLDR Project considers the top 20 languages (at the time of this writing). | ||
*By downloading the JSON packages individually...* | ||
Unicode CLDR is available as JSON at https://github.com/unicode-cldr/ (after this [json-packaging proposal][] took place). Please, read https://github.com/unicode-cldr/cldr-json for more information about package organization. | ||
[json-packaging proposal]: http://cldr.unicode.org/development/development-process/design-proposals/json-packaging | ||
*By using a package manager...* | ||
`cldr-data` can be used for convenience. It always downloads from the correct source. | ||
Use bower `bower install cldr-data` ([detailed instructions][]) or npm `npm install cldr-data`. For more information, see: | ||
- https://github.com/rxaviers/cldr-data-npm | ||
- https://github.com/rxaviers/cldr-data-bower | ||
[detailed instructions]: https://github.com/rxaviers/cldr-data-bower | ||
*By generating the JSON mappings yourself...* | ||
You can generate the JSON representation of the languages not available in the ZIP file by using the official conversion tool ([`tools.zip`](http://www.unicode.org/Public/cldr/latest/)). This ZIP contains a README with instructions on how to build the data. | ||
@@ -285,2 +304,6 @@ | ||
### How do I load CLDR data into Cldrjs? | ||
The short answer is by using `Cldr.load()` and passing the JSON data as the first argument. Below, follow several examples on how this could be accomplished. | ||
For the examples below, first fetch CLDR JSON data: | ||
@@ -349,3 +372,3 @@ | ||
| cldr.js | `cldr/supplemental/likelySubtags.json` | | ||
| cldr/unresolved.js | - | | ||
| cldr/unresolved.js | `cldr/supplemental/parentLocales.json` | | ||
| cldr/supplemental.js | `cldr/supplemental/{timeData, weekData}.json` | | ||
@@ -352,0 +375,0 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
156197
553
0
76
3259
1