https://github.com/zcfan/vue-localized-string
A vue plugin to use localized string object like { "en": "hello world", "zh": "你好 世界" }
https://github.com/zcfan/vue-localized-string
Last synced: about 2 months ago
JSON representation
A vue plugin to use localized string object like { "en": "hello world", "zh": "你好 世界" }
- Host: GitHub
- URL: https://github.com/zcfan/vue-localized-string
- Owner: zcfan
- Created: 2016-11-21T07:00:28.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-11-22T10:17:02.000Z (over 8 years ago)
- Last Synced: 2024-04-26T15:21:32.608Z (about 1 year ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A vue plugin to use localized string object like { "en": "hello world", "zh": "你好 世界" }
```
// If using a module system (e.g. webpack), import LocalizedString and then call Vue.use(LocalizedString).
// var LocalizedString = require('vue-Localized_string');
// Vue.use(LocalizedString);// In a component.
this.$setLang('zh'); // Set current language.
// Grab a localizedString.
var localizedStringObj = {
en: 'hello world',
zh: '你好 世界'
};console.log(this.$localizedString(localizedStringObj)); // 你好 世界