Locale ID
Parse and normalize locale ID. ICU Locale ID
Installation
Install via npm.
npm install locale-id
Support us
Star this project on GitHub.
Usage
parse
; const locale = ;console; // => { language: 'sk', country: 'SK' } const value = ;console; // => { language: 'sk', script: 'Latin', country: 'SK' }
normalize
; const value = ;console; // => sk_SK
getLanguage
; const value = ;console; // => sk
getCountry
; const value = ;console; // => CZ
getScript
; const value = ;console; // => Latin
getVariant
; const value = ;console; // => REVISED
getKeyword
; const value = ;console; // => currency=USD
normalizeAcceptLanguage
; const value = ;console; // => ['da', 'en_GB', 'en']
getBest
; should;should;should; ;;; ;;
You can speed up getBest function:
; const supported = ; should;
Running Tests
To run the test suite, first invoke the following command within the repo, installing the development dependencies:
npm install
Then run the tests:
npm test