globalize
Advanced tools
Comparing version 1.1.0-rc.2 to 1.1.0-rc.3
/** | ||
* Globalize Runtime v1.1.0-rc.2 | ||
* Globalize Runtime v1.1.0-rc.3 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-08-24T01:28Z | ||
* Date: 2015-10-02T16:26Z | ||
*/ | ||
/*! | ||
* Globalize Runtime v1.1.0-rc.2 2015-08-24T01:28Z Released under the MIT license | ||
* Globalize Runtime v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/** | ||
* Globalize Runtime v1.1.0-rc.2 | ||
* Globalize Runtime v1.1.0-rc.3 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-08-24T01:28Z | ||
* Date: 2015-10-02T16:26Z | ||
*/ | ||
/*! | ||
* Globalize Runtime v1.1.0-rc.2 2015-08-24T01:28Z Released under the MIT license | ||
* Globalize Runtime v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/** | ||
* Globalize Runtime v1.1.0-rc.2 | ||
* Globalize Runtime v1.1.0-rc.3 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-08-24T01:28Z | ||
* Date: 2015-10-02T16:26Z | ||
*/ | ||
/*! | ||
* Globalize Runtime v1.1.0-rc.2 2015-08-24T01:28Z Released under the MIT license | ||
* Globalize Runtime v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/** | ||
* Globalize Runtime v1.1.0-rc.2 | ||
* Globalize Runtime v1.1.0-rc.3 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-08-24T01:28Z | ||
* Date: 2015-10-02T16:26Z | ||
*/ | ||
/*! | ||
* Globalize Runtime v1.1.0-rc.2 2015-08-24T01:28Z Released under the MIT license | ||
* Globalize Runtime v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/** | ||
* Globalize Runtime v1.1.0-rc.2 | ||
* Globalize Runtime v1.1.0-rc.3 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-08-24T01:28Z | ||
* Date: 2015-10-02T16:26Z | ||
*/ | ||
/*! | ||
* Globalize Runtime v1.1.0-rc.2 2015-08-24T01:28Z Released under the MIT license | ||
* Globalize Runtime v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -472,2 +472,7 @@ */ | ||
// Add padding zero to leading decimal. | ||
if ( value.charAt( 0 ) === "." ) { | ||
value = "0" + value; | ||
} | ||
// Is it a valid number? | ||
@@ -474,0 +479,0 @@ value = value.match( numberNumberRe ); |
/** | ||
* Globalize Runtime v1.1.0-rc.2 | ||
* Globalize Runtime v1.1.0-rc.3 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-08-24T01:28Z | ||
* Date: 2015-10-02T16:26Z | ||
*/ | ||
/*! | ||
* Globalize Runtime v1.1.0-rc.2 2015-08-24T01:28Z Released under the MIT license | ||
* Globalize Runtime v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/** | ||
* Globalize Runtime v1.1.0-rc.2 | ||
* Globalize Runtime v1.1.0-rc.3 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-08-24T01:28Z | ||
* Date: 2015-10-02T16:26Z | ||
*/ | ||
/*! | ||
* Globalize Runtime v1.1.0-rc.2 2015-08-24T01:28Z Released under the MIT license | ||
* Globalize Runtime v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/** | ||
* Globalize v1.1.0-rc.2 | ||
* Globalize v1.1.0-rc.3 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-08-24T01:28Z | ||
* Date: 2015-10-02T16:26Z | ||
*/ | ||
/*! | ||
* Globalize v1.1.0-rc.2 2015-08-24T01:28Z Released under the MIT license | ||
* Globalize v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/*! | ||
* Globalize v1.1.0-rc.2 | ||
* Globalize v1.1.0-rc.3 | ||
* | ||
@@ -10,3 +10,3 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-08-24T01:28Z | ||
* Date: 2015-10-02T16:26Z | ||
*/ | ||
@@ -13,0 +13,0 @@ (function( root, factory ) { |
/** | ||
* Globalize v1.1.0-rc.2 | ||
* Globalize v1.1.0-rc.3 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-08-24T01:28Z | ||
* Date: 2015-10-02T16:26Z | ||
*/ | ||
/*! | ||
* Globalize v1.1.0-rc.2 2015-08-24T01:28Z Released under the MIT license | ||
* Globalize v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/** | ||
* Globalize v1.1.0-rc.2 | ||
* Globalize v1.1.0-rc.3 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-08-24T01:28Z | ||
* Date: 2015-10-02T16:26Z | ||
*/ | ||
/*! | ||
* Globalize v1.1.0-rc.2 2015-08-24T01:28Z Released under the MIT license | ||
* Globalize v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/** | ||
* Globalize v1.1.0-rc.2 | ||
* Globalize v1.1.0-rc.3 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-08-24T01:28Z | ||
* Date: 2015-10-02T16:26Z | ||
*/ | ||
/*! | ||
* Globalize v1.1.0-rc.2 2015-08-24T01:28Z Released under the MIT license | ||
* Globalize v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -979,2 +979,7 @@ */ | ||
// Add padding zero to leading decimal. | ||
if ( value.charAt( 0 ) === "." ) { | ||
value = "0" + value; | ||
} | ||
// Is it a valid number? | ||
@@ -1148,2 +1153,28 @@ value = value.match( numberNumberRe ); | ||
function validateDigits( properties ) { | ||
var minimumIntegerDigits = properties[ 2 ], | ||
minimumFractionDigits = properties[ 3 ], | ||
maximumFractionDigits = properties[ 4 ], | ||
minimumSignificantDigits = properties[ 5 ], | ||
maximumSignificantDigits = properties[ 6 ]; | ||
// Validate significant digit format properties | ||
if ( !isNaN( minimumSignificantDigits * maximumSignificantDigits ) ) { | ||
validateParameterRange( minimumSignificantDigits, "minimumSignificantDigits", 1, 21 ); | ||
validateParameterRange( maximumSignificantDigits, "maximumSignificantDigits", | ||
minimumSignificantDigits, 21 ); | ||
} else if ( !isNaN( minimumSignificantDigits ) || !isNaN( maximumSignificantDigits ) ) { | ||
throw new Error( "Neither or both the minimum and maximum significant digits must be " + | ||
"present" ); | ||
// Validate integer and fractional format | ||
} else { | ||
validateParameterRange( minimumIntegerDigits, "minimumIntegerDigits", 1, 21 ); | ||
validateParameterRange( minimumFractionDigits, "minimumFractionDigits", 0, 20 ); | ||
validateParameterRange( maximumFractionDigits, "maximumFractionDigits", | ||
minimumFractionDigits, 20 ); | ||
} | ||
} | ||
/** | ||
@@ -1161,4 +1192,3 @@ * .numberFormatter( [options] ) | ||
Globalize.prototype.numberFormatter = function( options ) { | ||
var args, cldr, maximumFractionDigits, maximumSignificantDigits, minimumFractionDigits, | ||
minimumIntegerDigits, minimumSignificantDigits, pattern, properties, returnFn; | ||
var args, cldr, pattern, properties, returnFn; | ||
@@ -1186,27 +1216,4 @@ validateParameterTypePlainObject( options, "options" ); | ||
minimumIntegerDigits = properties[ 2 ]; | ||
minimumFractionDigits = properties[ 3 ]; | ||
maximumFractionDigits = properties[ 4 ]; | ||
validateDigits( properties ); | ||
minimumSignificantDigits = properties[ 5 ]; | ||
maximumSignificantDigits = properties[ 6 ]; | ||
// Validate significant digit format properties | ||
if ( !isNaN( minimumSignificantDigits * maximumSignificantDigits ) ) { | ||
validateParameterRange( minimumSignificantDigits, "minimumSignificantDigits", 1, 21 ); | ||
validateParameterRange( maximumSignificantDigits, "maximumSignificantDigits", | ||
minimumSignificantDigits, 21 ); | ||
} else if ( !isNaN( minimumSignificantDigits ) || !isNaN( maximumSignificantDigits ) ) { | ||
throw new Error( "Neither or both the minimum and maximum significant digits must be " + | ||
"present" ); | ||
// Validate integer and fractional format | ||
} else { | ||
validateParameterRange( minimumIntegerDigits, "minimumIntegerDigits", 1, 21 ); | ||
validateParameterRange( minimumFractionDigits, "minimumFractionDigits", 0, 20 ); | ||
validateParameterRange( maximumFractionDigits, "maximumFractionDigits", | ||
minimumFractionDigits, 20 ); | ||
} | ||
returnFn = numberFormatterFn( properties ); | ||
@@ -1213,0 +1220,0 @@ |
/** | ||
* Globalize v1.1.0-rc.2 | ||
* Globalize v1.1.0-rc.3 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-08-24T01:28Z | ||
* Date: 2015-10-02T16:26Z | ||
*/ | ||
/*! | ||
* Globalize v1.1.0-rc.2 2015-08-24T01:28Z Released under the MIT license | ||
* Globalize v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/** | ||
* Globalize v1.1.0-rc.2 | ||
* Globalize v1.1.0-rc.3 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-08-24T01:28Z | ||
* Date: 2015-10-02T16:26Z | ||
*/ | ||
/*! | ||
* Globalize v1.1.0-rc.2 2015-08-24T01:28Z Released under the MIT license | ||
* Globalize v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/*! | ||
* Globalize v1.1.0-rc.2 | ||
* Globalize v1.1.0-rc.3 | ||
* | ||
@@ -10,3 +10,3 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2015-08-24T01:28Z | ||
* Date: 2015-10-02T16:26Z | ||
*/ | ||
@@ -13,0 +13,0 @@ |
@@ -84,3 +84,3 @@ ## .currencyFormatter( currency [, options] ) ➜ function( value ) | ||
```javascript | ||
var formatter Globalize( "en" ).currencyFormatter( "USD", { | ||
var formatter = Globalize( "en" ).currencyFormatter( "USD", { | ||
style: "accounting" | ||
@@ -87,0 +87,0 @@ }); |
@@ -53,4 +53,4 @@ ## .dateFormatter( [options] ) ➜ function( value ) | ||
> String value indicating a machine | ||
> [raw pattern](http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table) | ||
> eg. `{ pattern: "dd/mm" }`. Note this is NOT recommended for i18n in general. | ||
> [raw pattern (anything in the "Sym." column)](http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table) | ||
> eg. `{ raw: "dd/mm" }`. Note this is NOT recommended for i18n in general. | ||
> Use `skeleton` instead. | ||
@@ -57,0 +57,0 @@ |
@@ -5,3 +5,3 @@ # Migrating from Globalize 0.x | ||
On the API side, things have also changed, to simplify usage, remove ambiguity and add features. The rest of this document provies a brief function-by-function list. | ||
On the API side, things have also changed, to simplify usage, remove ambiguity and add features. The rest of this document provides a brief function-by-function list. | ||
@@ -8,0 +8,0 @@ If you still need help with migration, let us know. We may extend this guide later as necessary. |
{ | ||
"name": "globalize", | ||
"version": "1.1.0-rc.2", | ||
"version": "1.1.0-rc.3", | ||
"description": "A JavaScript library for internationalization and localization that leverage the official Unicode CLDR JSON data.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -25,2 +25,3 @@ # Globalize | ||
- [Compilation and the Runtime modules](#compilation-and-the-runtime-modules) | ||
- [Examples](#examples) | ||
- [API](#api) | ||
@@ -217,2 +218,4 @@ - [Core](#core-module) | ||
As an alternative to deducing this yourself, use this [online tool](http://johnnyreilly.github.io/globalize-so-what-cha-want/). The tool allows you to select the modules you're interested in using and tells you the Globalize files *and* CLDR JSON that you need. | ||
*(b) How am I supposed to get and load CLDR content?* | ||
@@ -253,9 +256,5 @@ | ||
An example is worth a thousand words. Check out our Hello World demo (available | ||
to you in different flavors): | ||
- [Hello World (AMD + bower)](examples/amd-bower/). | ||
- [Hello World (Node.js + npm)](examples/node-npm/). | ||
- [Hello World (plain JavaScript)](examples/plain-javascript/). | ||
An example is worth a thousand words. Check out our [Examples](#examples) | ||
section below. | ||
### Performance | ||
@@ -296,3 +295,2 @@ | ||
[Basic Globalize Compiler example]: examples/globalize-compiler/ | ||
@@ -306,2 +304,32 @@ #### Globalize Compiler | ||
### Examples | ||
The fastest and easiest way to use Globalize is by integrating it into your | ||
existing tools. | ||
- [Application example using webpack and npm](examples/app-npm-webpack/): easy to | ||
get started, automated CLDR loading and precompilation for production, but | ||
requires npm and webpack knowledge. | ||
If you're using a different tool than the one above, but you're comfortable | ||
using JavaScript modules (such as ES6 modules, CommonJS, or AMD) and package | ||
managers like npm or bower, you may want to check out the following examples. | ||
Note you'll need to compile your code for production yourself. | ||
- [Basic example using AMD and bower](examples/amd-bower/): feeding Globalize on | ||
CLDR is not completely transparent. | ||
- [Basic example using Node.js and npm](examples/node-npm/): feeding Globalize | ||
on CLDR is not completely transparent. | ||
- [Basic Globalize Compiler example][]: shows how to use Globalize Compiler CLI. | ||
[Basic Globalize Compiler example]: examples/globalize-compiler/ | ||
If you're using none of the tools above, but instead you're using the plain and | ||
old script tags only, the following example may interest you. Note Globalize | ||
allows you to go low level like this. But, acknowledge that you'll need to | ||
handle dependencies and CLDR loading manually yourself. | ||
- [Basic example using plain JavaScript](examples/plain-javascript/): requires | ||
loading CLDR and handling dependencies manually. | ||
## API | ||
@@ -308,0 +336,0 @@ |
364580
77
8171
731