配置语言

This commit is contained in:
lzp
2026-03-03 11:10:43 +08:00
parent 84cc6a5607
commit 0e5b3049b6
11 changed files with 260 additions and 105 deletions

View File

@@ -1,19 +1,19 @@
<template>
<div>
<div class="label">User Name</div>
<div class="label">{{ $t('Home.userName') }}</div>
<div class="value">{{ userInfo?.username || '------' }}</div>
</div>
<div>
<div class="label">Email</div>
<div class="label">{{ $t('Home.email') }}</div>
<div class="value">{{ userInfo?.email || '------' }}</div>
</div>
<div>
<div class="label">Language</div>
<div class="label">{{ $t('Home.language') }}</div>
<dropdown-menu v-model="locale" :list="langs" @change="changeLang" />
</div>
<div>
<div class="label">Log out on this device</div>
<button class="logout-btn" @click="logout">Log out</button>
<div class="label">{{ $t('Home.logoutDevice') }}</div>
<button class="logout-btn" @click="logout">{{ $t('Home.logout') }}</button>
</div>
</template>

View File

@@ -1,11 +1,11 @@
<template>
<div>
<div class="label">User Agreement</div>
<button @click="onClickUserAgreement">View</button>
<div class="label">{{ $t('Home.userAgreement') }}</div>
<button @click="onClickUserAgreement">{{ $t('Home.view') }}</button>
</div>
<div>
<div class="label">Privacy Policy</div>
<button @click="onClickPrivacy">View</button>
<div class="label">{{ $t('Home.privacyPolicy') }}</div>
<button @click="onClickPrivacy">{{ $t('Home.view') }}</button>
</div>
</template>

View File

@@ -1,22 +1,22 @@
<template>
<div>
<div class="label">Region</div>
<div class="label">{{ $t('Home.region') }}</div>
<dropdown-menu v-model="base" :list="baseList" @change="changeBase" />
</div>
<div>
<div class="label">Role</div>
<div class="label">{{ $t('Home.role') }}</div>
<dropdown-menu v-model="role" :list="roles" @change="changeRole" />
</div>
<div>
<div class="label">Current Agent Profile</div>
<div class="label">{{ $t('Home.currentAgentProfile') }}</div>
<div class="group">
<span class="icon"><svg-icon name="xiang" size="20" color="#000" /></span>
<dropdown-menu v-model="agent" :list="agents" @change="changeAgent" />
</div>
</div>
<div>
<div class="label">Current Notification Frequency</div>
<div class="value">36 times per hour</div>
<div class="label">{{ $t('Home.currentNotificationFrequency') }}</div>
<div class="value">{{ $t('Home.timesPerHour', { time: '36' }) }}</div>
</div>
</template>
@@ -27,19 +27,19 @@
import { UpdateUserProfile } from '@/api/user'
import { useI18n } from 'vue-i18n'
const userInfoStore = useUserInfoStore()
const { locale } = useI18n()
const { t } = useI18n()
const base = ref(userInfoStore.state.userInfo.base)
const baseList = ref([
{ label: 'United States', value: 'United States' },
{ label: 'Singapore', value: 'Singapore' },
{ label: 'Australia', value: 'Australia' },
{ label: 'South Korea', value: 'South Korea' },
{ label: 'China', value: 'China' },
{ label: 'Italy', value: 'Italy' },
{ label: 'France', value: 'France' },
{ label: 'Japan', value: 'Japan' },
{ label: 'Canada', value: 'Canada' },
{ label: 'Germany', value: 'Germany' }
{ label: t('Country.unitedStates'), value: 'United States' },
{ label: t('Country.singapore'), value: 'Singapore' },
{ label: t('Country.australia'), value: 'Australia' },
{ label: t('Country.southKorea'), value: 'South Korea' },
{ label: t('Country.china'), value: 'China' },
{ label: t('Country.italy'), value: 'Italy' },
{ label: t('Country.france'), value: 'France' },
{ label: t('Country.japan'), value: 'Japan' },
{ label: t('Country.canada'), value: 'Canada' },
{ label: t('Country.germany'), value: 'Germany' }
])
const changeBase = (value: string) => {
onSubmit({ base: value })
@@ -47,17 +47,17 @@
const role = ref(userInfoStore.state.userInfo.role)
const roles = ref([
{ label: 'Designer', value: 'Designer' },
{ label: 'Student', value: 'Student' },
{ label: 'Teacher', value: 'Teacher' },
{ label: 'Parent', value: 'Parent' },
{ value: 'Other', label: 'Other' }
{ label: t('Role.designer'), value: 'Designer' },
{ label: t('Role.student'), value: 'Student' },
{ label: t('Role.teacher'), value: 'Teacher' },
{ label: t('Role.parent'), value: 'Parent' },
{ label: t('Role.other'), value: 'Other' }
])
const changeRole = (value: string) => {
onSubmit({ role: value })
}
const agent = ref("Partner")
const agent = ref('Partner')
const agents = ref([
{ label: 'Partner', value: 'Partner' },
{ label: 'Observer', value: 'Observer' },

View File

@@ -9,7 +9,7 @@
>
<template #header="{ close }">
<div class="setting-header">
<div class="title">Setting</div>
<div class="title">{{ $t('Home.setting') }}</div>
<span class="close" @click="close">
<svg-icon name="close" size="10" color="#000" />
</span>
@@ -56,9 +56,9 @@
const nav = ref('setting')
const navs = shallowRef([
{ icon: 'setting', label: 'General', component: General },
{ icon: 'profile', label: 'Profile', component: Profile },
{ icon: 'learn-more', label: 'Learn more', component: LearnMore }
{ icon: 'setting', label: $t('Home.general'), component: General },
{ icon: 'profile', label: $t('Home.profile'), component: Profile },
{ icon: 'learn-more', label: $t('Home.learnMore'), component: LearnMore }
])
</script>