i18n引入
This commit is contained in:
parent
448a305abe
commit
8c6ab14103
@ -10,9 +10,12 @@ import { defineComponent } from 'vue';
|
||||
import router from './router';
|
||||
import store from './store';
|
||||
import { getValue } from './utils/common';
|
||||
import { provideI18n } from "@/utils/i18n"
|
||||
import i18ninit from "@/i18n/init"
|
||||
|
||||
export default defineComponent({
|
||||
setup(){
|
||||
provideI18n(i18ninit);
|
||||
if(getValue('token')){
|
||||
store.commit("login", true)
|
||||
store.dispatch("setUserInfo");
|
||||
|
9
src/i18n/init.ts
Normal file
9
src/i18n/init.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import zh from "./zh"
|
||||
|
||||
|
||||
export default {
|
||||
locale: "zh", //默认语言
|
||||
messages:{
|
||||
zh
|
||||
}
|
||||
}
|
28
src/i18n/zh.ts
Normal file
28
src/i18n/zh.ts
Normal file
@ -0,0 +1,28 @@
|
||||
export default {
|
||||
zhiboguanli: "直播管理",
|
||||
shipinguanli: "视频管理",
|
||||
dingyuezheguanli: "订阅者管理",
|
||||
gerenzhongxin: "个人中心",
|
||||
rili: "日历",
|
||||
quanbuzhibo: "全部直播",
|
||||
weikaishi: "未开始",
|
||||
yijieshu: "已结束",
|
||||
zhibosousuo: "请输入想要搜索的直播标题",
|
||||
haiweikaishi: "还未开始",
|
||||
yijueshi: "已结束",
|
||||
jinruzhibo: "进入直播",
|
||||
quanbushipin: "全部视频",
|
||||
shenhezhong: "审核中",
|
||||
weitongguo: "未通过",
|
||||
yifabu: "已发布",
|
||||
shipinsousuo: "请输入想要搜索的直播标题",
|
||||
wodedingyuezhe: "我的订阅者",
|
||||
xingming: "姓名",
|
||||
suozaiguojia: "所在国家",
|
||||
nianling: "年龄",
|
||||
xueshengmuyu: "学生母语",
|
||||
xingqudian: "兴趣点",
|
||||
yuyandengji: "语言等级",
|
||||
canyupingtaishichang: "参与平台直播总时长",
|
||||
sousuoxuesheng: "请输入想要搜索的学生姓名"
|
||||
}
|
@ -14,6 +14,9 @@ const createI18n = (config: Config) => ({
|
||||
messages: config.messages,
|
||||
$t(key: string) {
|
||||
return this.messages[this.locale.value][key];
|
||||
},
|
||||
$s(){
|
||||
return this.locale.value
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user