diff --git a/web/package-lock.json b/web/package-lock.json index 22992ee..36edaa7 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -11,6 +11,7 @@ "axios": "^1.6.8", "pinia": "^2.1.7", "vue": "^3.4.21", + "vue-i18n": "^9.11.0", "vue-router": "^4.3.0" }, "devDependencies": { @@ -878,6 +879,38 @@ "node": ">=12" } }, + "node_modules/@intlify/core-base": { + "version": "9.11.0", + "resolved": "https://registry.npmmirror.com/@intlify/core-base/-/core-base-9.11.0.tgz", + "integrity": "sha512-cveOqAstjLZIiyatcP/HrzrQ87cZI8ScPQna3yvoM8zjcjcIRK1MRvmxUNlPdg0rTNJMZw7rixPVM58O5aHVPA==", + "dependencies": { + "@intlify/message-compiler": "9.11.0", + "@intlify/shared": "9.11.0" + }, + "engines": { + "node": ">= 16" + } + }, + "node_modules/@intlify/message-compiler": { + "version": "9.11.0", + "resolved": "https://registry.npmmirror.com/@intlify/message-compiler/-/message-compiler-9.11.0.tgz", + "integrity": "sha512-x31Gl7cscnoI4UUY1yaIy8e7vVMVW1VVlTXZz4SIHKqoSEUkfmgqK8NAx1e7RcoHEbICR7uyCbud0ZL1s4OGXQ==", + "dependencies": { + "@intlify/shared": "9.11.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": ">= 16" + } + }, + "node_modules/@intlify/shared": { + "version": "9.11.0", + "resolved": "https://registry.npmmirror.com/@intlify/shared/-/shared-9.11.0.tgz", + "integrity": "sha512-KHSNgi7sRjmSm7aD8QH8WFt9VfKaekJuJ473opbJlkGY3EDnDUU8ikIhG8PbasQbgNvbY3m3tWNGqk2omIdwMA==", + "engines": { + "node": ">= 16" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", @@ -2500,6 +2533,22 @@ } } }, + "node_modules/vue-i18n": { + "version": "9.11.0", + "resolved": "https://registry.npmmirror.com/vue-i18n/-/vue-i18n-9.11.0.tgz", + "integrity": "sha512-vU4gY6lu8Pdfs9BgKGiDAJmFDf88cceR47KcSB0VW4xJzUrXR/7qwqM7A8dQ2nedhoIDxoOm5Ro4pFd2KvJqbA==", + "dependencies": { + "@intlify/core-base": "9.11.0", + "@intlify/shared": "9.11.0", + "@vue/devtools-api": "^6.5.0" + }, + "engines": { + "node": ">= 16" + }, + "peerDependencies": { + "vue": "^3.0.0" + } + }, "node_modules/vue-router": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.3.0.tgz", diff --git a/web/package.json b/web/package.json index 3e8d99d..f416a81 100644 --- a/web/package.json +++ b/web/package.json @@ -14,6 +14,7 @@ "axios": "^1.6.8", "pinia": "^2.1.7", "vue": "^3.4.21", + "vue-i18n": "^9.11.0", "vue-router": "^4.3.0" }, "devDependencies": { diff --git a/web/src/App.vue b/web/src/App.vue index 8eb6192..5cc4ce0 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -8,20 +8,27 @@ import { lightTheme, type GlobalTheme } from "naive-ui"; +import { zhCN, dateZhCN, enUS, dateEnUS, type NLocale, type NDateLocale } from 'naive-ui' import { RouterView } from "vue-router"; import { onMounted } from "vue"; const osThemeRef = useOsTheme() -const theme = defineModel() +const theme = defineModel('theme') theme.value = osThemeRef.value === 'dark' ? darkTheme : lightTheme +const locale = defineModel('locale') +locale.value = navigator.language === "zh-CN" ? zhCN : enUS + +const dateLocale = defineModel('dateLocale') +dateLocale.value = navigator.language === "zh-CN" ? dateZhCN : dateEnUS + onMounted(() => { document.title = 'reCoreD-UI' })