Package Exports
- locale-helpers
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (locale-helpers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
locale-helpers
Infers the best valid locale for a given language/country combination.
Sometimes the locale is simply the language/country combination, e.g. en
+ US
= en_US
.
However, it
+ FR
≠ it_FR
(as it is not a valid locale). A better option is the valid it_IT
.
Usage
Install the library with npm install locale-helpers
var LocaleHelpers = require('locale-helpers').LocaleHelpers;
LocaleHelpers.bestLocaleFor({language: 'en', country: 'US'}); //-> 'en_US'
LocaleHelpers.bestLocaleFor({language: 'fr', country: 'FR'}); //-> 'fr_FR'
LocaleHelpers.bestLocaleFor({language: 'en', country: 'GB'}); //-> 'en_GB'
LocaleHelpers.bestLocaleFor({language: 'it', country: 'FR'}); //-> 'it_IT'