Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xinix-technology/xin-lang


https://github.com/xinix-technology/xin-lang

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# xin-lang

```sh
npm i xin-lang
```

## How to use

Create instance of `xin-lang` at global.

```js
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

```js
let result = window.lang.translate('Home');
console.log(result); // show me the result
```

To use from component template scope

```html
[[__global.lang.translate("Home")]]
```