语言设置

This commit is contained in:
浅念
2025-03-22 09:36:06 +08:00
parent 08824389a6
commit 02b8800bc6
2 changed files with 13 additions and 5 deletions
+12 -4
View File
@@ -23,12 +23,20 @@ import Eyu from '@/common/locales/ru.js';
// 引入并使用vue-i18n
import VueI18n from 'vue-i18n'
Vue.use(VueI18n)
let i18nConfig = {
locale: uni.getLocale(),// 获取已设置的语言
messages: {
// 这里的属性名是任意的,您也可以把zh设置为cn等,只是后续切换语言时
// 要标识这里的语言属性,如:this.$i18n.locale = zh|en|cn|xxx
'zh-Hans': Chinese,
'en': English,
'ru': Eyu,
}
}
// 构造i18n对象
const i18n = new VueI18n({
// 默认语言,这里的local属性,对应message中的cn、en属性
locale: 'zh-Hans',
locale:uni.getLocale(),
// 引入语言文件
messages: {
// 这里的属性名是任意的,您也可以把zh设置为cn等,只是后续切换语言时
@@ -38,7 +46,7 @@ const i18n = new VueI18n({
'ru': Eyu,
}
})
uni.setStorageSync('i18locale', 'zh-Hans');
// uni.setStorageSync('i18locale', 'zh-Hans');
App.mpType = 'app'
Vue.prototype._i18n = i18n
const app = new Vue({
+1 -1
View File
@@ -7,7 +7,7 @@
"style" :
{
"navigationBarTitleText": "登录",
"enablePullDownRefresh": true,
"enablePullDownRefresh": false,
"navigationStyle":"custom",// 去掉微信小程序顶部导航
"app-plus":{
"titleNView":false //去掉app+h5顶部导航