feat: 设置页i18n

This commit is contained in:
2026-05-05 09:59:44 +08:00
parent e48e369ef1
commit d50e3781db
4 changed files with 353 additions and 80 deletions

View File

@@ -5,8 +5,8 @@
<SvgIcon name="close" size="24" />
</button>
<div class="verification-dialog__title">Check your new email</div>
<div class="verification-dialog__subtitle">Enter the 6-digit code sent to</div>
<div class="verification-dialog__title">{{ t('Settings.dialog.title') }}</div>
<div class="verification-dialog__subtitle">{{ t('Settings.dialog.subtitle') }}</div>
<div class="verification-dialog__email">{{ email }}</div>
<InputCode
@@ -22,7 +22,7 @@
:disabled="saving || verificationCode.length !== 6"
@click="handleSubmit"
>
Submit
{{ t('Settings.dialog.submit') }}
</button>
<button
@@ -31,13 +31,15 @@
:disabled="resendCountdown > 0"
@click="handleResend"
>
{{ resendCountdown > 0 ? `Resend Code in ${formattedResendCountdown}` : 'Resend Code' }}
{{ resendButtonText }}
</button>
</div>
</div>
</template>
<script setup lang="ts">
import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import InputCode from '@/components/input-code.vue'
const props = withDefaults(
@@ -57,6 +59,8 @@ const emit = defineEmits<{
submit: [code: string]
}>()
const { t } = useI18n()
const RESEND_COUNTDOWN_SECONDS = 60
const verificationCode = ref('')
@@ -68,6 +72,12 @@ const formattedResendCountdown = computed(
() => `00:${String(resendCountdown.value).padStart(2, '0')}`
)
const resendButtonText = computed(() =>
resendCountdown.value > 0
? t('Settings.dialog.resendCodeIn', { time: formattedResendCountdown.value })
: t('Settings.dialog.resendCode')
)
const clearResendCountdownTimer = () => {
if (resendCountdownTimer) {
window.clearInterval(resendCountdownTimer)