mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 09:38:02 +00:00
feat: 完成布局/仪表板/用户相关组件国际化与语言切换优化(TabBar/MainLayout/AppHeader、UsageTrend/ModelDistribution、User*、Common 组件、i18n/locale 增强)
This commit is contained in:
@@ -35,6 +35,28 @@ function getBrowserLocale() {
|
||||
const savedLocale = localStorage.getItem('app-locale')
|
||||
const defaultLocale = savedLocale || getBrowserLocale()
|
||||
|
||||
// 创建一个函数来获取本地化的语言信息
|
||||
export function getSupportedLocalesWithI18n(t) {
|
||||
return {
|
||||
'zh-cn': {
|
||||
name: t('common.languageSwitch.zhCnName'),
|
||||
flag: t('common.languageSwitch.zhCnFlag'),
|
||||
shortName: t('common.languageSwitch.zhCnFlag')
|
||||
},
|
||||
'zh-tw': {
|
||||
name: t('common.languageSwitch.zhTwName'),
|
||||
flag: t('common.languageSwitch.zhTwFlag'),
|
||||
shortName: t('common.languageSwitch.zhTwFlag')
|
||||
},
|
||||
en: {
|
||||
name: t('common.languageSwitch.enName'),
|
||||
flag: t('common.languageSwitch.enFlag'),
|
||||
shortName: t('common.languageSwitch.enFlag')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 保持原有的SUPPORTED_LOCALES作为默认值,用于不依赖i18n的场景
|
||||
export const SUPPORTED_LOCALES = {
|
||||
'zh-cn': {
|
||||
name: '简体中文',
|
||||
|
||||
Reference in New Issue
Block a user