ts-node-i18n
v1.0.2
Published
Localization done minimally
Downloads
2
Readme
node-i18n
Simple i18n inspired by Laravel
Purpose
Other i18n modules are too complex and have gorilla and banana problem - i.e. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.
Install
npm install ts-node-i18n
Usage
var i18n = require('./../index').init({
fallback: 'en'
});
var output = i18n.get('activity.say:hello', { user_name: 'Tak' } , 'ja');
// Tak が挨拶をしました
var fallback = i18n.get('activity.say:hello', { user_name: 'Tak' });
// Tak says hello!
Structure
project root
│ resources
└─── lang
├───en
│ │ activity.json
│ │ dashboard.json
├───es
│ │ activity.json
│ │ dashboard.json
├───ja
│ │ activity.json
│ │ dashboard.json
where activity.json looks like:
{
"say:hello": ":user_name says hello!" // en/activity.json
}
{
"say:hello": ":user_name dice hola!" // es/activity.json
}
{
"say:hello": ":user_name が挨拶をしました" // ja/activity.json
}