Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 519 Bytes

README.md

File metadata and controls

34 lines (25 loc) · 519 Bytes

xin-lang

npm i xin-lang

How to use

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>