Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brandonxiang/weapp-i18n
A i18n package for weapp.
https://github.com/brandonxiang/weapp-i18n
Last synced: 16 days ago
JSON representation
A i18n package for weapp.
- Host: GitHub
- URL: https://github.com/brandonxiang/weapp-i18n
- Owner: brandonxiang
- License: mit
- Created: 2017-03-28T11:51:16.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-02-04T06:42:08.000Z (almost 3 years ago)
- Last Synced: 2024-10-11T12:58:22.353Z (about 1 month ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 33
- Watchers: 5
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# weapp-i18n
It is a i18n package for weapp, which can help us to switch languages.It is inspired by [Leaflet.i18n](https://github.com/yohanboniface/Leaflet.i18n), and it is designed in es6, because weapp is compatible with es6.
## Usage
Config translation words in the json format.
```
export default {
"en": {
"Weather": "Weather"
},
"zh-Hans": {
"Weather": "天气"
}
}
```#### registerLocale
To set translation words.
#### setLocale
To set current language.
#### _
To get word you want.
#### Demo
You can check it on [weapp-weatherfine](https://github.com/brandonxiang/weapp-weatherfine). I placed the wxapp-i18n.js into [utils folder](https://github.com/brandonxiang/weapp-weatherfine/tree/master/utils).
## License
[MIT](LICENSE)