0.0.1 • Published 4 years ago

18n v0.0.1

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

18n

A simple i18n module

Install

$ npm install 18n

Usage

18n will read the configuration from the 18n.config.js in your package root.

Configuration

// 18n.config.js
module.exports = {
  langPath: 'languages',
  langPacks: [
    'en-us',
    'zh-cn'
  ],
  selector: () => {
    const {language} = navigator;
    switch (language) {
      case 'zh':
      case 'zh-cn':
        return 'zh-cn';
      default:
        return 'en-us';
    }
  }
};

License

MIT © LitoMore

0.0.1

4 years ago