https://github.com/djadmin/tongue.js
:stuck_out_tongue: Helps writing JavaScript code in any spoken language
https://github.com/djadmin/tongue.js
Last synced: 10 months ago
JSON representation
:stuck_out_tongue: Helps writing JavaScript code in any spoken language
- Host: GitHub
- URL: https://github.com/djadmin/tongue.js
- Owner: djadmin
- License: mit
- Created: 2016-03-08T22:57:57.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-06-12T10:33:19.000Z (over 9 years ago)
- Last Synced: 2025-03-26T06:43:15.525Z (10 months ago)
- Language: JavaScript
- Homepage: https://djadmin.in/tongue.js/
- Size: 3.88 MB
- Stars: 36
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# tongue.js [](https://www.npmjs.com/package/tongue) [](https://travis-ci.org/djadmin/tongue.js)
Helps writing multilingual JavaScript. Tongue.js transforms JavaScript written in any language to any target language.
Try it out using [tongue.js REPL](https://djadmin.in/tongue.js/)
## Usage
```js
tongue.transform(code, options);
```
## Options
`code` : source code written in any langauge
`locale`: language code of the source. Eg: 'hi'
`map`: provide any custom translations for the locale
`targetLocale`: target language code
## Example
```js
tongue.transform('मानलो ल = 1;', {locale: 'hi'});
```
returns
```"var ल = 1;"```
### Another Example
```js
tongue.transform('警报(1);', {locale: 'cn', map: {'alert': '警报'}});
```
returns
```
"alert(1);"
```
## Note
tongue.js supports both AMD and CommonJS module styles.
## Contributions
Your contributions are always welcome!
## License
Copyright (c) 2016 Dheeraj Joshi
Licensed under the [MIT license](http://opensource.org/licenses/MIT).