perf: optimize the naming of locale key

This commit is contained in:
vince
2024-07-10 21:55:16 +08:00
parent 25a1e93ab2
commit 4674380266
59 changed files with 664 additions and 1253 deletions

View File

@@ -52,8 +52,8 @@ const isValidPhoneNumber = computed(() => {
const btnText = computed(() => {
return countdown.value > 0
? $t('authentication.send-text', [countdown.value])
: $t('authentication.send-code');
? $t('authentication.sendText', [countdown.value])
: $t('authentication.sendCode');
});
const btnLoading = computed(() => {
return countdown.value > 0;
@@ -117,10 +117,10 @@ onBeforeUnmount(() => {
<template>
<div>
<Title>
{{ $t('authentication.welcome-back') }} 📲
{{ $t('authentication.welcomeBack') }} 📲
<template #desc>
<span class="text-muted-foreground">
{{ $t('authentication.code-subtitle') }}
{{ $t('authentication.codeSubtitle') }}
</span>
</template>
</Title>
@@ -140,7 +140,7 @@ onBeforeUnmount(() => {
:btn-loading="btnLoading"
:btn-text="btnText"
:code-length="4"
:error-tip="$t('authentication.code-tip')"
:error-tip="$t('authentication.codeTip')"
:handle-send-code="handleSendCode"
:label="$t('authentication.code')"
:placeholder="$t('authentication.code')"

View File

@@ -58,15 +58,15 @@ function goLogin() {
<template>
<div>
<Title>
{{ $t('authentication.forget-password') }} 🤦🏻
{{ $t('authentication.forgetPassword') }} 🤦🏻
<template #desc>
{{ $t('authentication.forget-password-subtitle') }}
{{ $t('authentication.forgetPasswordSubtitle') }}
</template>
</Title>
<div class="mb-6">
<VbenInput
v-model="formState.email"
:error-tip="$t('authentication.email-tip')"
:error-tip="$t('authentication.emailTip')"
:label="$t('authentication.email')"
:status="emailStatus"
autofocus
@@ -77,7 +77,7 @@ function goLogin() {
</div>
<div>
<VbenButton class="mt-2 w-full" @click="handleSubmut">
{{ $t('authentication.send-reset-link') }}
{{ $t('authentication.sendResetLink') }}
</VbenButton>
<VbenButton class="mt-4 w-full" variant="outline" @click="goLogin()">
{{ $t('common.back') }}

View File

@@ -150,10 +150,10 @@ function handleGo(path: string) {
<template>
<div @keypress.enter.prevent="handleSubmit">
<Title>
{{ $t('authentication.welcome-back') }} 👋🏻
{{ $t('authentication.welcomeBack') }} 👋🏻
<template #desc>
<span class="text-muted-foreground">
{{ $t('authentication.login-subtitle') }}
{{ $t('authentication.loginSubtitle') }}
</span>
</template>
</Title>
@@ -161,7 +161,7 @@ function handleGo(path: string) {
<VbenInput
v-model="formState.username"
:autofocus="false"
:error-tip="$t('authentication.username-tip')"
:error-tip="$t('authentication.usernameTip')"
:label="$t('authentication.username')"
:placeholder="usernamePlaceholder || $t('authentication.username')"
:status="usernameStatus"
@@ -171,7 +171,7 @@ function handleGo(path: string) {
/>
<VbenInputPassword
v-model="formState.password"
:error-tip="$t('authentication.password-tip')"
:error-tip="$t('authentication.passwordTip')"
:label="$t('authentication.password')"
:placeholder="passwordPlaceholder || $t('authentication.password')"
:status="passwordStatus"
@@ -183,7 +183,7 @@ function handleGo(path: string) {
<div class="mb-6 mt-4 flex justify-between">
<div class="flex-center flex">
<VbenCheckbox v-model:checked="formState.rememberMe" name="rememberMe">
{{ $t('authentication.remember-me') }}
{{ $t('authentication.rememberMe') }}
</VbenCheckbox>
</div>
@@ -192,7 +192,7 @@ function handleGo(path: string) {
class="text-primary hover:text-primary-hover active:text-primary-active cursor-pointer text-sm font-normal"
@click="handleGo(forgetPasswordPath)"
>
{{ $t('authentication.forget-password') }}
{{ $t('authentication.forgetPassword') }}
</span>
<!-- <VbenButton variant="ghost" @click="handleGo('/auth/forget-password')">
@@ -210,7 +210,7 @@ function handleGo(path: string) {
variant="outline"
@click="handleGo(codeLoginPath)"
>
{{ $t('authentication.mobile-login') }}
{{ $t('authentication.mobileLogin') }}
</VbenButton>
<VbenButton
v-if="showQrcodeLogin"
@@ -218,7 +218,7 @@ function handleGo(path: string) {
variant="outline"
@click="handleGo(qrCodeLoginPath)"
>
{{ $t('authentication.qrcode-login') }}
{{ $t('authentication.qrcodeLogin') }}
</VbenButton>
<!-- <VbenButton
:loading="loading"
@@ -234,12 +234,12 @@ function handleGo(path: string) {
<ThirdPartyLogin v-if="showThirdPartyLogin" />
<div v-if="showRegister" class="text-center text-sm">
{{ $t('authentication.account-tip') }}
{{ $t('authentication.accountTip') }}
<span
class="text-primary hover:text-primary-hover active:text-primary-active cursor-pointer text-sm font-normal"
@click="handleGo(registerPath)"
>
{{ $t('authentication.create-account') }}
{{ $t('authentication.createAccount') }}
</span>
</div>
</div>

View File

@@ -47,10 +47,10 @@ function goLogin() {
<template>
<div>
<Title>
{{ $t('authentication.welcome-back') }} 📱
{{ $t('authentication.welcomeBack') }} 📱
<template #desc>
<span class="text-muted-foreground">
{{ $t('authentication.qrcode-subtitle') }}
{{ $t('authentication.qrcodeSubtitle') }}
</span>
</template>
</Title>
@@ -58,7 +58,7 @@ function goLogin() {
<div class="flex-col-center mt-6">
<img :src="qrcode" alt="qrcode" class="w-1/2" />
<p class="text-muted-foreground mt-4 text-sm">
{{ $t('authentication.qrcode-prompt') }}
{{ $t('authentication.qrcodePrompt') }}
</p>
</div>

View File

@@ -86,12 +86,12 @@ function goLogin() {
<template>
<div>
<Title>
{{ $t('authentication.create-an-account') }} 🚀
<template #desc> {{ $t('authentication.sign-up-subtitle') }} </template>
{{ $t('authentication.createAnAccount') }} 🚀
<template #desc> {{ $t('authentication.signUpSubtitle') }} </template>
</Title>
<VbenInput
v-model="formState.username"
:error-tip="$t('authentication.username-tip')"
:error-tip="$t('authentication.usernameTip')"
:label="$t('authentication.username')"
:placeholder="$t('authentication.username')"
:status="usernameStatus"
@@ -101,7 +101,7 @@ function goLogin() {
<!-- Use 8 or more characters with a mix of letters, numbers & symbols. -->
<VbenInputPassword
v-model="formState.password"
:error-tip="$t('authentication.password-tip')"
:error-tip="$t('authentication.passwordTip')"
:label="$t('authentication.password')"
:password-strength="true"
:placeholder="$t('authentication.password')"
@@ -111,15 +111,15 @@ function goLogin() {
type="password"
>
<template #strengthText>
{{ $t('authentication.password-strength') }}
{{ $t('authentication.passwordStrength') }}
</template>
</VbenInputPassword>
<VbenInputPassword
v-model="formState.comfirmPassword"
:error-tip="$t('authentication.comfirm-password-tip')"
:label="$t('authentication.comfirm-password')"
:placeholder="$t('authentication.comfirm-password')"
:error-tip="$t('authentication.confirmPasswordTip')"
:label="$t('authentication.confirmPassword')"
:placeholder="$t('authentication.confirmPassword')"
:status="comfirmPasswordStatus"
name="comfirmPassword"
required
@@ -132,13 +132,13 @@ function goLogin() {
v-model:checked="formState.agreePolicy"
name="agreePolicy"
>
{{ $t('authentication.sign-up-agree') }}
{{ $t('authentication.agree') }}
<span class="text-primary hover:text-primary-hover">{{
$t('authentication.sign-up-privacy-policy')
$t('authentication.agreeprivacyPolicy')
}}</span>
&
<span class="text-primary hover:text-primary-hover">
{{ $t('authentication.sign-up-terms') }}
{{ $t('authentication.terms') }}
</span>
</VbenCheckbox>
</div>
@@ -147,22 +147,22 @@ function goLogin() {
v-show="formState.submitted && !formState.agreePolicy"
class="text-destructive absolute bottom-1 left-0 text-xs"
>
{{ $t('authentication.sign-up-agree-tip') }}
{{ $t('authentication.agreeTip') }}
</p>
</Transition>
</div>
<div>
<VbenButton :loading="loading" class="w-full" @click="handleSubmit">
{{ $t('authentication.sign-up') }}
{{ $t('authentication.signUp') }}
</VbenButton>
</div>
<div class="mt-4 text-center text-sm">
{{ $t('authentication.already-account') }}
{{ $t('authentication.alreadyHaveAccount') }}
<span
class="text-primary hover:text-primary-hover cursor-pointer text-sm font-normal"
@click="goLogin()"
>
{{ $t('authentication.go-login') }}
{{ $t('authentication.goToLogin') }}
</span>
</div>
</div>

View File

@@ -13,7 +13,7 @@ defineOptions({
<div class="mt-4 flex items-center justify-between">
<span class="border-input w-[35%] border-b dark:border-gray-600"></span>
<span class="text-muted-foreground text-center text-xs uppercase">
{{ $t('authentication.third-party-login') }}
{{ $t('authentication.thirdPartyLogin') }}
</span>
<span class="border-input w-[35%] border-b dark:border-gray-600"></span>
</div>

View File

@@ -43,13 +43,13 @@ const titleText = computed(() => {
return $t('fallback.forbidden');
}
case '404': {
return $t('fallback.page-not-found');
return $t('fallback.pageNotFound');
}
case '500': {
return $t('fallback.internal-error');
return $t('fallback.internalError');
}
case 'offline': {
return $t('fallback.offline-error');
return $t('fallback.offlineError');
}
case 'comming-soon': {
return $t('fallback.coming-soon');
@@ -66,16 +66,16 @@ const descText = computed(() => {
}
switch (props.status) {
case '403': {
return $t('fallback.forbidden-desc');
return $t('fallback.forbiddenDesc');
}
case '404': {
return $t('fallback.page-not-found-desc');
return $t('fallback.pageNotFoundDesc');
}
case '500': {
return $t('fallback.internal-error-desc');
return $t('fallback.internalErrorDesc');
}
case 'offline': {
return $t('fallback.offline-error-desc');
return $t('fallback.offlineErrorDesc');
}
default: {
return '';
@@ -152,7 +152,7 @@ function refresh() {
<slot v-if="$slots.action" name="action"></slot>
<VbenButton v-else-if="showBack" size="lg" @click="back">
<IcRoundArrowBackIosNew class="mr-2" />
{{ $t('common.back-to-home') }}
{{ $t('common.backToHome') }}
</VbenButton>
<VbenButton v-else-if="showRefresh" size="lg" @click="refresh">
<IcRoundRefresh class="mr-2" />