Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/litomore/18n
A simple i18n module
https://github.com/litomore/18n
i18n
Last synced: 6 days ago
JSON representation
A simple i18n module
- Host: GitHub
- URL: https://github.com/litomore/18n
- Owner: LitoMore
- License: mit
- Created: 2018-09-08T05:00:26.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-18T02:10:12.000Z (about 6 years ago)
- Last Synced: 2024-10-19T00:59:26.341Z (28 days ago)
- Topics: i18n
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 18n
A simple i18n module
## Install
```bash
$ npm install 18n
```## Usage
`18n` will read the configuration from the `18n.config.js` in your package root.
### Configuration
```javascript
// 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](https://github.com/LitoMore)