locale-helpers

1.0.547 • Public • Published

locale-helpers

NPM version Downloads

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 + FRit_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'

/locale-helpers/

    Package Sidebar

    Install

    npm i locale-helpers

    Weekly Downloads

    283

    Version

    1.0.547

    License

    Apache-2.0

    Unpacked Size

    69.4 kB

    Total Files

    16

    Last publish

    Collaborators

    • arielh
    • falconci
    • yurynix
    • itai.benda
    • wix-ci
    • wix-ambassador
    • shahata
    • netanelgilad
    • wix-ci-publisher
    • wix-bi-publisher