refactor(layout, i18n, admin): 优化布局结构与多语言支持
调整 AdminShell 组件的子组件顺序,提升代码可读性。更新 admin-breadcrumb 组件,简化导航标签翻译逻辑,确保多语言支持的一致性。重构 admin-language-switcher 组件,优化语言切换的用户体验,增强界面交互性。更新多语言配置,新增登录界面的副标题,提升用户体验。
This commit is contained in:
38
src/lib/admin-nav-label.ts
Normal file
38
src/lib/admin-nav-label.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import type { TFunction } from "i18next";
|
||||
|
||||
/** 与 {@link AdminBreadcrumb} / 侧栏共用:仅用 i18n,避免 API 旧 label 作 defaultValue 导致水合不一致 */
|
||||
const NAV_SEGMENT_I18N_KEYS: Record<string, string> = {
|
||||
dashboard: "dashboard",
|
||||
admin_users: "admin_users",
|
||||
admin_roles: "admin_roles",
|
||||
players: "players",
|
||||
currencies: "currencies",
|
||||
wallet: "wallet",
|
||||
draws: "draws",
|
||||
rules_plays: "rules_plays",
|
||||
rules_odds: "rules_odds",
|
||||
jackpot: "jackpot",
|
||||
risk_cap: "risk_cap",
|
||||
risk: "risk",
|
||||
settlement: "settlement",
|
||||
reconcile: "reconcile",
|
||||
reports: "reports",
|
||||
tickets: "tickets",
|
||||
audit: "audit",
|
||||
settings: "settings",
|
||||
integration: "integration",
|
||||
config: "config",
|
||||
};
|
||||
|
||||
export function adminNavLabel(
|
||||
segment: string,
|
||||
t: TFunction,
|
||||
apiLabel?: string | null,
|
||||
): string {
|
||||
const key = NAV_SEGMENT_I18N_KEYS[segment];
|
||||
if (key) {
|
||||
return t(`nav.${key}`, { ns: "common" });
|
||||
}
|
||||
|
||||
return apiLabel?.trim() ? apiLabel : segment;
|
||||
}
|
||||
Reference in New Issue
Block a user