1.0.11 • Published 4 years ago

browser-langs v1.0.11

Weekly downloads
230
License
MIT
Repository
github
Last release
4 years ago

Browser Langs

What's inside?

BCP47 defines standard for language codes that browser should use. Specification is quite wide but we will use most common setup which is used today:

<2 letter ISO 639>
// e.g. "no", "ca", "nl"

or

<2 letter ISO 639>-<ISO 3166-1>
// e.g. "es-mx", "ar-sa", "nl-be"

Installation

npm i browser-langs
# or
yarn add browser-langs

Documentation

import { all, find } from 'browser-langs';

// get list of all cultural (and not only) language codes
all() // list of `Language` objects returned

// find language matching language code
find('en') // English Language object will be returned
find('en-gb') // English (United Kingdom) Language object will be returned

// detect currently selected language in browser
detect() // current (most matching) Language object will be returned

// detect currently selected languages in browser (based on priority)
detectAll() // returns list of current Language objects

Credits

License

Please see LICENSE.txt

Author

Boostcom

Boostcom - we provide the most powerful management- and loyalty platform built for the needs of shopping centres.

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.0

5 years ago