Utility to help you polyfill the Node.js runtime when the Intl APIs are missing, or if the built-in Intl is missing locale data that you need.
JavaScript
Latest commit ee4036c Jun 2, 2015 @ericf ericf Merge pull request #1 from davglass/readme
typo
Permalink
Failed to load latest commit information.
test/unit Initial drop May 30, 2015
.gitignore Initialize npm May 30, 2015
.travis.yml Initial drop May 30, 2015
LICENSE Initial drop May 30, 2015
README.md typo Jun 2, 2015
index.js Initial drop May 30, 2015
package.json 1.0.0 May 30, 2015

README.md

intl-locales-supported

Utility to help you polyfill the Node.js runtime when the Intl APIs are missing, or if the built-in Intl is missing locale data that you need.

npm Version Build Status Dependency Status

Usage

var areIntlLocalesSupported = require('intl-locales-supported');

var localesMyAppSupports = [
    /* list locales here */
];

if (global.Intl) {
    // Determine if the built-in `Intl` has the locale data we need.
    if (!areIntlLocalesSupported(localesMyAppSupports)) {
        // `Intl` exists, but it doesn't have the data we need, so load the
        // polyfill and replace the constructors we need with the polyfill's.
        require('intl');
        Intl.NumberFormat   = IntlPolyfill.NumberFormat;
        Intl.DateTimeFormat = IntlPolyfill.DateTimeFormat;
    }
} else {
    // No `Intl`, so use and load the polyfill.
    global.Intl = require('intl');
}

For more details, see the FormatJS guide on polyfillying Intl in Node.js.

License

This software is free to use under the Yahoo! Inc. BSD license. See the LICENSE file for license text and copyright information.