cldr-tools

0.1.0 • Public • Published

CLDR Tools

Build Status Coverage Status

NPM

Please Note

This is an experimental project, modules or api may change frequently.

This project aim to build utility and convenient tools for CLDR(Common Locale Data Repository, which have a lot of all kinds of data in all over 200+ languages).

Hope to help front-end developers to build globalization applications.

Features (for now)

Features (to be implemented)

  • decimal formatting: some thing like 1000000000 => 1 billion(in English) but 10亿(in Chinese)
  • other many fun functions

Getting Started

$ npm install cldr-tools

search locales by language name

const search = require('cldr-tools/lib/search/available-locales')

search('English') // => ['en', 'en-AU', 'en-CA', 'en-GB']
search('英文') // => ['en', 'en-AU', 'en-CA', 'en-GB']
search('中文') // => ['zh', 'zh-Hans', 'zh-Hant']
search('Chinese') // => ['zh', 'zh-Hans', 'zh-Hant']
search('日文') // => ['ja']
search('日本語') // => ['ja']

get languages' display name

const languageDisplayNames = require('cldr-tools/lib/display-names/languages')

languageDisplayNames(['zh', 'en'])
// => [{
   locale: 'zh',
   displayName: '中文'
}, {
   locale: 'en',
   displayName: 'English'
}]

languageDisplayNames(['zh', 'en'], 'en')
// => [{
   locale: 'zh',
   displayName: 'Chinese'
}, {
   locale: 'en',
   displayName: 'English'
}]


languageDisplayNames(['zh', 'en'], 'en', true)
// => [{
   locale: 'zh',
   displayName: 'Chinese',
   original: '中文'
}, {
   locale: 'en',
   displayName: 'English',
   original: 'English'
}]

Command line tool

could search locales in your terminal

see cldr-cli

Documentation

waiting to be write

Contribute

This project is a fresh start, welcome to contribute! Please follow the Github Flow

Requirements

  • This is open source project, so unit test is required. Using Mocha, chai, sinon so far.
  • Comments are welcome and expected

Package Sidebar

Install

npm i cldr-tools

Weekly Downloads

2

Version

0.1.0

License

MIT

Last publish

Collaborators

  • zincli