login page

This commit is contained in:
landaiqing
2024-08-11 15:21:16 +08:00
parent 438965f2a2
commit ff6a4a5d09
54 changed files with 2731 additions and 170 deletions

View File

@@ -2,6 +2,7 @@
import {createI18n} from 'vue-i18n';
import zh from './language/zh.ts';
import en from './language/en.ts';
import {parse} from "zipson/lib";
const messages = {
en,
@@ -9,12 +10,14 @@ const messages = {
};
const language = (navigator.language || 'en').toLocaleLowerCase(); // 这是获取浏览器的语言
const i18n = createI18n({
const language: string = (navigator.language || 'en').toLocaleLowerCase(); // 获取浏览器的语言
const lang: string = localStorage.getItem("lang") as string;
const i18n: any = createI18n({
legacy: false,
compositionOnly: false,
globalInjection: true,
silentTranslationWarn: true,
locale: JSON.parse(localStorage.getItem("lang") as string).lang || language.split('-')[0] || 'zh', // 首先从缓存里拿,没有的话就用浏览器语言,
locale: parse(lang).lang || language.split('-')[0] || 'zh', // 首先从缓存里拿,没有的话就用浏览器语言,
silentFallbackWarn: true,
missingWarn: true,
fallbackWarn: false,