2.0.2 • Published 4 years ago

@lengoo/locales-normalizer v2.0.2

Weekly downloads
35
License
MIT
Repository
-
Last release
4 years ago

Overview

Node.js Package

Small package to normalize locales across different standards.

Installation

npm install --save locales-normalizer

Usage

The normalizer has two methods, normalize() and getLanguage():

  • normalize() receives the language code and returns a normal version (e.g. en_US -> en-US)
  • getLanguage() receives the language code and returns some extra information about the language.

Example

const localeNormalizer = require('locales-normalizer');

const locale = 'en_US'; // Coming from PHP-ICU.

console.log(localeNormalizer.normalize(locale)); // output: en-US

console.log(localeNormalizer.getLanguage(locale)); 
/**
 * Output:
 * {
 *  code: 'en-US',
 *  locale: 'en',
 *  territory: 'US'
 * }
*/
2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.1

4 years ago

1.0.0

5 years ago