From 59879b7fa7d57e500c65c1df33f5384238c0630e Mon Sep 17 00:00:00 2001 From: shaw Date: Wed, 4 Mar 2026 15:58:44 +0800 Subject: [PATCH] fix(i18n): replace hardcoded English strings in EmailVerifyView with i18n calls --- frontend/src/i18n/locales/en.ts | 10 ++++++++ frontend/src/i18n/locales/zh.ts | 10 ++++++++ frontend/src/views/auth/EmailVerifyView.vue | 26 ++++++++++----------- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/frontend/src/i18n/locales/en.ts b/frontend/src/i18n/locales/en.ts index 309f7feb..f5ae2676 100644 --- a/frontend/src/i18n/locales/en.ts +++ b/frontend/src/i18n/locales/en.ts @@ -329,6 +329,16 @@ export default { sendingCode: 'Sending...', clickToResend: 'Click to resend code', resendCode: 'Resend verification code', + sendCodeDesc: "We'll send a verification code to", + codeSentSuccess: 'Verification code sent! Please check your inbox.', + verifying: 'Verifying...', + verifyAndCreate: 'Verify & Create Account', + resendCountdown: 'Resend code in {countdown}s', + backToRegistration: 'Back to registration', + sendCodeFailed: 'Failed to send verification code. Please try again.', + verifyFailed: 'Verification failed. Please try again.', + codeRequired: 'Verification code is required', + invalidCode: 'Please enter a valid 6-digit code', promoCodeLabel: 'Promo Code', promoCodePlaceholder: 'Enter promo code (optional)', promoCodeValid: 'Valid! You will receive ${amount} bonus balance', diff --git a/frontend/src/i18n/locales/zh.ts b/frontend/src/i18n/locales/zh.ts index 7dab91af..3d729ebc 100644 --- a/frontend/src/i18n/locales/zh.ts +++ b/frontend/src/i18n/locales/zh.ts @@ -328,6 +328,16 @@ export default { sendingCode: '发送中...', clickToResend: '点击重新发送验证码', resendCode: '重新发送验证码', + sendCodeDesc: '我们将发送验证码到', + codeSentSuccess: '验证码已发送!请查收您的邮箱。', + verifying: '验证中...', + verifyAndCreate: '验证并创建账户', + resendCountdown: '{countdown}秒后可重新发送', + backToRegistration: '返回注册', + sendCodeFailed: '发送验证码失败,请重试。', + verifyFailed: '验证失败,请重试。', + codeRequired: '请输入验证码', + invalidCode: '请输入有效的6位验证码', promoCodeLabel: '优惠码', promoCodePlaceholder: '输入优惠码(可选)', promoCodeValid: '有效!注册后将获得 ${amount} 赠送余额', diff --git a/frontend/src/views/auth/EmailVerifyView.vue b/frontend/src/views/auth/EmailVerifyView.vue index 3ecf0733..15c947fc 100644 --- a/frontend/src/views/auth/EmailVerifyView.vue +++ b/frontend/src/views/auth/EmailVerifyView.vue @@ -7,7 +7,7 @@ {{ t('auth.verifyYourEmail') }}

- We'll send a verification code to + {{ t('auth.sendCodeDesc') }} {{ email }}

@@ -64,7 +64,7 @@

- Verification code sent! Please check your inbox. + {{ t('auth.codeSentSuccess') }}

@@ -123,7 +123,7 @@ > - {{ isLoading ? 'Verifying...' : 'Verify & Create Account' }} + {{ isLoading ? t('auth.verifying') : t('auth.verifyAndCreate') }} @@ -134,7 +134,7 @@ disabled class="cursor-not-allowed text-sm text-gray-400 dark:text-dark-500" > - Resend code in {{ countdown }}s + {{ t('auth.resendCountdown', { countdown }) }} @@ -300,12 +300,12 @@ function onTurnstileVerify(token: string): void { function onTurnstileExpire(): void { resendTurnstileToken.value = '' - errors.value.turnstile = 'Verification expired, please try again' + errors.value.turnstile = t('auth.turnstileExpired') } function onTurnstileError(): void { resendTurnstileToken.value = '' - errors.value.turnstile = 'Verification failed, please try again' + errors.value.turnstile = t('auth.turnstileFailed') } // ==================== Send Code ==================== @@ -336,7 +336,7 @@ async function sendCode(): Promise { resendTurnstileToken.value = '' } catch (error: unknown) { errorMessage.value = buildAuthErrorMessage(error, { - fallback: 'Failed to send verification code. Please try again.' + fallback: t('auth.sendCodeFailed') }) appStore.showError(errorMessage.value) @@ -356,7 +356,7 @@ async function handleResendCode(): Promise { // If turnstile is enabled but no token yet, wait if (turnstileEnabled.value && !resendTurnstileToken.value) { - errors.value.turnstile = 'Please complete the verification' + errors.value.turnstile = t('auth.completeVerification') return } @@ -367,12 +367,12 @@ function validateForm(): boolean { errors.value.code = '' if (!verifyCode.value.trim()) { - errors.value.code = 'Verification code is required' + errors.value.code = t('auth.codeRequired') return false } if (!/^\d{6}$/.test(verifyCode.value.trim())) { - errors.value.code = 'Please enter a valid 6-digit code' + errors.value.code = t('auth.invalidCode') return false } @@ -409,13 +409,13 @@ async function handleVerify(): Promise { sessionStorage.removeItem('register_data') // Show success toast - appStore.showSuccess('Account created successfully! Welcome to ' + siteName.value + '.') + appStore.showSuccess(t('auth.accountCreatedSuccess', { siteName: siteName.value })) // Redirect to dashboard await router.push('/dashboard') } catch (error: unknown) { errorMessage.value = buildAuthErrorMessage(error, { - fallback: 'Verification failed. Please try again.' + fallback: t('auth.verifyFailed') }) appStore.showError(errorMessage.value)