import Vue from 'vue'
import VueI18n from 'vue-i18n'
Vue.use(VueI18n)
const LANGUAGE = uni.getStorageSync('LANGS') || uni.getSystemInfoSync().language || 'ru'
const i18n = new VueI18n({
locale: LANGUAGE,
fallbackLocale: 'ru',
messages: {
'zh_CN': require('@/locale/cn.json'),
'zh': require('@/locale/cn.json'),
'ru': require('@/locale/ru.json'),
'en': require('@/locale/ru.json'),
}
});
let gloubTimes = null
const i18nPlugin = {};
i18nPlugin.install = function(Vue, options) {
Vue.mixin({
methods: {
changeLanguage(language = 'zh-CN') {
uni.setLocale(language == 'ru'? 'ru': 'zh-Hans')
uni.setStorageSync('LANGS', language)
this._i18n.locale = language
},
},
});
Vue.prototype._i18n = i18n;
}
//
export {
i18n,
i18nPlugin
}
恭喜n发财
能否新建一个空项目引入这个插件试试,还有问题的话上传一下
2025-04-09 15:03
LOOKINGFFuture (作者)
回复 恭喜n发财: 4.56的版本不会,4.57的版本就会,
2025-04-09 15:42