左边栏header用户信息下拉弹窗增加多语言支持

This commit is contained in:
jingrow 2025-12-29 18:59:59 +08:00
parent 570586c450
commit d05f2215b2
4 changed files with 24 additions and 14 deletions

View File

@ -56,6 +56,7 @@ import { NMenu, NDropdown, NIcon } from 'naive-ui';
import NavigationItems from './NavigationItems.vue';
import JLogo from '@/components/icons/JLogo.vue';
import ChevronDown from '~icons/lucide/chevron-down';
import { t } from '../utils/i18n';
export default {
name: 'AppSidebar',
@ -96,12 +97,12 @@ export default {
(team.valid_teams?.length > 1 || team.is_desk_user)
) {
options.push({
label: '切换团队',
label: t('Switch Team'),
key: 'switch-team',
});
}
options.push({
label: '退出登录',
label: t('Logout'),
key: 'logout',
});
return options;
@ -221,7 +222,7 @@ export default {
const teamUserText = computed(() => {
const team = instance?.appContext.config.globalProperties.$team;
if (team?.get?.loading) {
return '加载中...';
return t('Loading...');
}
return team?.pg?.user || '';
});

View File

@ -14,12 +14,12 @@
class="ml-auto"
:options="[
{
label: '切换团队',
label: $t('Switch Team'),
icon: 'command',
onClick: () => (showTeamSwitcher = true)
},
{
label: '注销',
label: $t('Logout'),
icon: 'log-out',
onClick: $session.logout.submit
}
@ -30,7 +30,7 @@
<template #suffix>
<i-lucide-chevron-down class="h-3.5 w-3.5 text-gray-700" />
</template>
{{ $team?.get.loading ? '加载中...' : $team?.pg?.user }}
{{ $team?.get.loading ? $t('Loading...') : $team?.pg?.user }}
</Button>
</template>
</Dropdown>

View File

@ -1,13 +1,13 @@
<template>
<Dialog :options="{ title: '切换团队' }" v-model="show">
<Dialog :options="{ title: $t('Switch Team') }" v-model="show">
<template #body-content v-if="$team?.pg">
<div class="rounded bg-gray-100 px-3 py-2.5">
<div class="text-base text-gray-900">
您当前登录的用户是
{{ $t('You are currently logged in as') }}
<span class="font-medium">{{ $session.user }}</span>
</div>
<div class="mt-2 text-base text-gray-900">
您正在查看的团队仪表板是
{{ $t('The team dashboard you are viewing is') }}
<component
:is="$team.pg.is_desk_user ? 'a' : 'span'"
class="font-medium"
@ -39,23 +39,23 @@
<Badge
class="whitespace-nowrap"
v-if="$team.name === team.name"
label="当前激活"
:label="$t('Currently Active')"
theme="green"
/>
<Button v-else @click="switchToTeam(team.name)">切换</Button>
<Button v-else @click="switchToTeam(team.name)">{{ $t('Switch') }}</Button>
</div>
</div>
<div class="mt-6 flex items-end gap-2" v-if="$session.isSystemUser">
<LinkControl
class="w-full"
label="选择团队"
:label="$t('Select Team')"
:options="{ pagetype: 'Team', filters: { enabled: 1 } }"
v-model="selectedTeam"
description="此功能仅对系统用户可用"
:description="$t('This feature is only available for system users')"
/>
<div class="pb-5">
<Button :disabled="!selectedTeam" @click="switchToTeam(selectedTeam)">
切换
{{ $t('Switch') }}
</Button>
</div>
</div>

View File

@ -1075,3 +1075,12 @@ Log Browser,日志浏览器,
Database Analyzer,数据库分析器,
Recharge,充值,
Partner Portal,合作伙伴门户,
Switch Team,切换团队,
Logout,退出登录,
Loading...,加载中...,
You are currently logged in as,您当前登录的用户是,
The team dashboard you are viewing is,您正在查看的团队仪表板是,
Currently Active,当前激活,
Switch,切换,
Select Team,选择团队,
This feature is only available for system users,此功能仅对系统用户可用,

Can't render this file because it has a wrong number of fields in line 390.