feat(i18n): 优化国际化配置并设置默认语言为英文

- 在 app.vue 中设置 locale 为 'en-US'
- 更新协议签署页面的国际化使用方式- 修改首页物品列表的显示逻辑
- 禁用浏览器语言检测,设置默认语言为中文
This commit is contained in:
xingyy 2025-02-25 19:17:34 +08:00
parent 3afb867c14
commit 3205ecd547
5 changed files with 14 additions and 17 deletions

View File

@ -15,7 +15,8 @@ useHead({
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
const slideDirection = ref('slide-left') const slideDirection = ref('slide-left')
const { locale } = useI18n()
locale.value = 'en-US'
// //
const routeHistory = ref([]) const routeHistory = ref([])

View File

@ -3,10 +3,12 @@ import pdfView from './pdfView'
import { contractView } from "~/api/goods/index.js" import { contractView } from "~/api/goods/index.js"
import {codeAuthStore} from "~/stores-collect-code/auth/index.js"; import {codeAuthStore} from "~/stores-collect-code/auth/index.js";
import {signOffline} from "~/api/goods/index.js"; import {signOffline} from "~/api/goods/index.js";
import {useI18n} from "vue-i18n";
definePageMeta({ definePageMeta({
title:'签署' title:'签署'
}) })
const {t} =useI18n()
const {formData,number,qrData}=codeAuthStore() const {formData,number,qrData}=codeAuthStore()
const activeNames = ref([]) const activeNames = ref([])
const router = useRouter() const router = useRouter()
@ -16,15 +18,15 @@ const pmblUrl = ref('') // 存储拍卖笔录的URL
const protocolList = computed(() => { const protocolList = computed(() => {
if(number.value==1){ if(number.value==1){
return [ return [
{ id: '4', title: $t('signature.agreement.buyerAgreement'), pdfName: 'jmxy', type: 'local' }, { id: '4', title: t('signature.agreement.buyerAgreement'), pdfName: 'jmxy', type: 'local' },
{ id: '3', title: $t('signature.agreement.buyerGuide'), pdfName: 'jmxz', type: 'local' }, { id: '3', title: t('signature.agreement.buyerGuide'), pdfName: 'jmxz', type: 'local' },
{ id: '1', title: $t('signature.agreement.notice'), pdfName: 'pmgg', type: 'local' }, { id: '1', title: t('signature.agreement.notice'), pdfName: 'pmgg', type: 'local' },
{ id: '2', title: $t('signature.agreement.rules'), pdfName: 'pmgz', type: 'local' }, { id: '2', title: t('signature.agreement.rules'), pdfName: 'pmgz', type: 'local' },
] ]
}else if(number.value==2) { }else if(number.value==2) {
return [ return [
{ id: '6', title: $t('signature.agreement.transfer'), pdfName: 'pmyjqrs', type: 'local' }, { id: '6', title: t('signature.agreement.transfer'), pdfName: 'pmyjqrs', type: 'local' },
{ id: '5', title: $t('signature.agreement.record'), pdfName: pmblUrl.value, type: 'remote' } { id: '5', title: t('signature.agreement.record'), pdfName: pmblUrl.value, type: 'remote' }
] ]
} }
}) })
@ -77,7 +79,7 @@ const goSignature = () => {
<template> <template>
<div class="bg-#EBEBEB h-screen-nav flex flex-col"> <div class="bg-#EBEBEB h-screen-nav flex flex-col">
<div class="h-50px text-14px text-#191919 bg-#fff flex items-center px-21px mb-6px shrink-0"> <div class="h-50px text-14px text-#191919 bg-#fff flex items-center px-21px mb-6px shrink-0">
{{ $t('signature.tips.prePayment') }} {{ t('signature.tips.prePayment') }}
</div> </div>
<van-collapse <van-collapse
@ -109,7 +111,7 @@ const goSignature = () => {
class="w-213px van-btn-h-38px" class="w-213px van-btn-h-38px"
@click="confirm" @click="confirm"
> >
{{ $t('signature.action.agree') }} {{ t('signature.action.agree') }}
</van-button> </van-button>
</div> </div>
</div> </div>

View File

@ -78,7 +78,7 @@ const openShow = async (item) => {
</div> </div>
<div class="pt-[8px]"> <div class="pt-[8px]">
<div class="text-[14px] text-[#000000] leading-[20px]"> <div class="text-[14px] text-[#000000] leading-[20px]">
{{ item.name }} {{ item?.artwork?.name }} | {{item?.artwork?.artistName}}
</div> </div>
<div class="mt-[4px] text-[12px] text-[#575757]"> <div class="mt-[4px] text-[12px] text-[#575757]">
{{ $t('home.start_price') }}{{ item?.startPrice??0 }} {{ $t('home.start_price') }}{{ item?.startPrice??0 }}

View File

@ -56,13 +56,7 @@ export default defineNuxtConfig({
locales: currentLocales, locales: currentLocales,
lazy: true, lazy: true,
strategy: 'no_prefix', strategy: 'no_prefix',
detectBrowserLanguage: { detectBrowserLanguage: false,
useCookie: true,
cookieKey: 'i18n_redirected',
redirectOn: 'root',
alwaysRedirect: true,
fallbackLocale: 'zh-CN'
},
defaultLocale: 'zh-CN', defaultLocale: 'zh-CN',
vueI18n: './i18n/i18n.config.ts', vueI18n: './i18n/i18n.config.ts',
}, },

Binary file not shown.