add vue i18n

This commit is contained in:
LouisLam
2021-08-24 16:44:58 +08:00
parent 752ac05149
commit dd4c00eed3
7 changed files with 7791 additions and 477 deletions

View File

@@ -1,5 +1,6 @@
import "bootstrap";
import { createApp, h } from "vue";
import { createI18n } from "vue-i18n"
import { createRouter, createWebHistory } from "vue-router";
import Toast from "vue-toastification";
import "vue-toastification/dist/index.css";
@@ -22,6 +23,9 @@ import List from "./pages/List.vue";
import { appName } from "./util.ts";
import en from "./languages/en";
import zhHK from "./languages/zh-hk";
const routes = [
{
path: "/",
@@ -83,6 +87,19 @@ const router = createRouter({
routes,
})
const languageList = {
en,
zhHK,
};
const i18n = createI18n({
locale: localStorage.locale || "en",
fallbackLocale: "en",
silentFallbackWarn: true,
silentTranslationWarn: true,
messages: languageList
});
const app = createApp({
mixins: [
socket,
@@ -98,7 +115,8 @@ const app = createApp({
render: () => h(App),
})
app.use(router)
app.use(router);
app.use(i18n);
const options = {
position: "bottom-right",