Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xinix-technology/xin-lang
https://github.com/xinix-technology/xin-lang
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/xinix-technology/xin-lang
- Owner: xinix-technology
- License: mit
- Created: 2016-12-01T03:19:57.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-20T11:41:30.000Z (over 6 years ago)
- Last Synced: 2024-04-14T09:17:37.650Z (8 months ago)
- Language: JavaScript
- Size: 68.4 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-xinix - xin-lang - Multi language component - [reekoheek](https://github.com/reekoheek) (Grouping / Xin)
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")]]
```