From 959d2411a9f9338a1777181ca225a54a58f8cce3 Mon Sep 17 00:00:00 2001 From: skytek_xinliang Date: Mon, 30 Mar 2026 15:43:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E4=B8=AD=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E8=AA=9E=E8=A8=80=E6=AA=94=E6=A1=88=E4=B8=A6=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=20i18n=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/language/en-US.json | 36 ++++++++++++++++++++++++++++++++++++ src/language/zh-TW.json | 36 ++++++++++++++++++++++++++++++++++++ src/plugins/i18n.ts | 21 +++++++++------------ 3 files changed, 81 insertions(+), 12 deletions(-) create mode 100644 src/language/en-US.json create mode 100644 src/language/zh-TW.json diff --git a/src/language/en-US.json b/src/language/en-US.json new file mode 100644 index 0000000..b1e0e6f --- /dev/null +++ b/src/language/en-US.json @@ -0,0 +1,36 @@ +{ + "common": { + "ok": "OK", + "notice": "Notice" + }, + "components": {}, + "features": {}, + "pages": { + "home": "Home", + "login": { + "title": "Test System", + "illustrationTitle": "Login Page", + "illustrationDescription": "Login to your account", + "welcomeText": "Welcome back 👋🏻", + "welcomeDescription": "Please enter your account password to login", + "organization": "Hyakkaou Private Academy", + "accPlaceholder": "Enter account", + "passwPlaceholder": "Enter password", + "rememberMeLabel": "Remember me", + "forgotPasswordText": "Forgot password?", + "createAccountPromptText": "Don't have an account?", + "createAccountLinkText": "Create an account", + "submitText": "Login", + "verifyText": "Verify", + "captchaPlaceholder": "Enter captcha", + "refreshTitle": "Refresh captcha", + "alert": { + "verifyRequired": "Please complete the captcha first", + "verifySuccess": "Verification successful", + "verifyFailed": "Verification failed", + "loginFailed": "Login failed", + "loginSuccess": "Login success!" + } + } + } +} diff --git a/src/language/zh-TW.json b/src/language/zh-TW.json new file mode 100644 index 0000000..02a04f7 --- /dev/null +++ b/src/language/zh-TW.json @@ -0,0 +1,36 @@ +{ + "common": { + "ok": "確定", + "notice": "提示" + }, + "components": {}, + "features": {}, + "pages": { + "home": "首頁", + "login": { + "title": "測試系統", + "illustrationTitle": "這是登入頁", + "illustrationDescription": "你可以在這頁登入", + "welcomeText": "歡迎回來 👋🏻", + "welcomeDescription": "請輸入您的帳號密碼進行登入", + "organization": "私立百花王學園", + "accPlaceholder": "請輸入帳號", + "passwPlaceholder": "請輸入密碼", + "rememberMeLabel": "記住帳號", + "forgotPasswordText": "忘記密碼?", + "createAccountPromptText": "還沒有帳號?", + "createAccountLinkText": "註冊帳號", + "submitText": "登入", + "verifyText": "驗證", + "captchaPlaceholder": "請輸入驗證碼", + "refreshTitle": "點擊刷新驗證碼", + "alert": { + "verifyRequired": "請先完成驗證碼", + "verifySuccess": "驗證成功", + "verifyFailed": "驗證失敗", + "loginFailed": "登入失敗", + "loginSuccess": "登入成功!" + } + } + } +} diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index 73640f9..4bd4d65 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -1,21 +1,18 @@ import { createI18n } from 'vue-i18n' +import en from '@/language/en-US.json' +import zh from '@/language/zh-TW.json' + const messages = { - en: { - message: { - hello: 'hello world', - }, - }, - ja: { - message: { - hello: 'こんにちは、世界', - }, - }, + 'zh-TW': zh, + 'en-US': en, } +const defaultLocale = localStorage.getItem('locale') ?? 'zh-TW' + export default createI18n({ legacy: false, - locale: 'en', - fallbackLocale: 'en', + locale: defaultLocale, + fallbackLocale: 'en-US', messages, })