npm i xin-lang
Create instance of xin-lang
at global.
import { Lang } from 'xin-lang';
let lang = window.lang = new Lang();
lang.putTranslations('en', {
'Home': 'Home',
});
lang.putTranslations('en', {
'Home': 'Rumah',
});
To use programmatically in javascript
let result = window.lang.translate('Home');
console.log(result); // show me the result
To use from component template scope
<a href="#">[[__global.lang.translate("Home")]]</a>