5.0.1 • Published 5 years ago
the-loc v5.0.1
the-loc
Locale resolver for the-framework
Installation
$ npm install the-loc --save
Usage
Create a directory with name "loc" and put locale files like "en.json" there.
loc/en.json
{
"keys": {
"APP_NAME": "hello-world"
},
"titles": {
"WELCOME_TITLE": "Welcome to #{keys.APP_NAME}!"
}
}
loc/index.js
'use strict'
const {create: theLoc} = require('the-loc')
const env = theLoc({
en: require('./en')
})
module.exports = env
Then,
'use strict'
// Require defined locales
const loc = require('./loc/index.js')
let en = loc.bind('en')
console.log(en('titles.WELCOME_TITLE')) // -> "Welcome to hello-world!"
API Guide
License
This software is released under the MIT License.
Links
5.0.1
5 years ago
5.0.0
5 years ago
4.0.6
5 years ago
4.0.5
5 years ago
4.0.4
6 years ago
4.0.3
6 years ago
4.0.2
6 years ago
4.0.1
6 years ago
4.0.0
6 years ago
3.0.1
6 years ago
3.0.0
6 years ago
2.1.8
6 years ago
2.1.7
6 years ago
2.1.6
6 years ago
2.1.5
6 years ago
2.1.4
6 years ago
2.1.3
6 years ago
2.1.2
6 years ago
2.1.1
6 years ago
2.1.0
6 years ago
2.0.1
6 years ago
2.0.0
6 years ago
1.3.1
7 years ago
1.3.0
7 years ago
1.2.8
7 years ago
1.2.7
7 years ago
1.2.6
7 years ago
1.2.5
7 years ago
1.2.4
7 years ago
1.2.3
7 years ago
1.2.2
7 years ago
1.2.1
7 years ago
1.2.0
7 years ago
1.1.1
7 years ago
1.1.0
7 years ago
1.0.4
7 years ago
1.0.3
7 years ago
1.0.2
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago