Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/neg4n/si18n
- Owner: neg4n
- Created: 2020-07-28T23:20:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T20:59:24.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T22:18:43.001Z (about 1 month ago)
- Topics: i18n, internationalization, lightweight, simple
- Language: TypeScript
- Homepage:
- Size: 114 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
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...'
```