Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/neg4n/si18n

simple internationalization
https://github.com/neg4n/si18n

i18n internationalization lightweight simple

Last synced: 21 days ago
JSON representation

simple internationalization

Awesome Lists containing this project

README

        

## si18n
__very__ simple internationalization library for node.js
```
npm install @neg4n/si18n --save
```
## How to use?
1. Create directory where translations will be located.
Lets assume we name it `i18n`
2. Init Si18n:
```js
const Si18n = require('@neg4n/si18n').Si18n
const Path = require('path')

const i18n = new Si18n(Path.join(__dirname, 'i18n'))
```
3. Everything's done! Now you can access translations by:
- Creating `i18n/en.yml`:
```yml
sample:
nested:
translation: "yup..."
```
- Printing the value:
```js
console.log(i18n.get('en', 'sample.nested.translation'))
// output: 'yup...'
```