diff --git a/src/App.vue b/src/App.vue index bde78c9..7c1f251 100644 --- a/src/App.vue +++ b/src/App.vue @@ -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"); diff --git a/src/i18n/init.ts b/src/i18n/init.ts new file mode 100644 index 0000000..fc5ca04 --- /dev/null +++ b/src/i18n/init.ts @@ -0,0 +1,9 @@ +import zh from "./zh" + + +export default { + locale: "zh", //默认语言 + messages:{ + zh + } +} \ No newline at end of file diff --git a/src/i18n/zh.ts b/src/i18n/zh.ts new file mode 100644 index 0000000..6c2afcb --- /dev/null +++ b/src/i18n/zh.ts @@ -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: "请输入想要搜索的学生姓名" +} \ No newline at end of file diff --git a/src/utils/i18n.ts b/src/utils/i18n.ts index e9ae3b4..90250c8 100644 --- a/src/utils/i18n.ts +++ b/src/utils/i18n.ts @@ -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 } });