Feat/i18n restructure (#2529)

This commit is contained in:
crazywoola 2024-02-23 14:31:06 +08:00 • committed by GitHub
commit 9574730050
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
140 changed files with 448 additions and 659 deletions

View file

@ -1,8 +1,8 @@
export type FormValue = Record<string, any>
export type TypeWithI18N<T = string> = {
'en_US': T
'zh_Hans': T
'en-US': T
'zh-Hans': T
[key: string]: T
}
@ -67,16 +67,16 @@ export enum ModelStatusEnum {
export const MODEL_STATUS_TEXT: { [k: string]: TypeWithI18N } = {
'no-configure': {
en_US: 'No Configure',
zh_Hans: '未配置凭据',
'en-US': 'No Configure',
'zh-Hans': '未配置凭据',
},
'quota-exceeded': {
en_US: 'Quota Exceeded',
zh_Hans: '额度不足',
'en-US': 'Quota Exceeded',
'zh-Hans': '额度不足',
},
'no-permission': {
en_US: 'No Permission',
zh_Hans: '无使用权限',
'en-US': 'No Permission',
'zh-Hans': '无使用权限',
},
}

View file

@ -16,7 +16,6 @@ import {
ConfigurateMethodEnum,
ModelTypeEnum,
} from './declarations'
import { getModelRuntimeSupported } from '@/utils/language'
import I18n from '@/context/i18n'
import {
fetchDefaultModal,
@ -59,7 +58,7 @@ export const useSystemDefaultModelAndModelList: UseDefaultModelAndModelList = (
export const useLanguage = () => {
const { locale } = useContext(I18n)
return getModelRuntimeSupported(locale)
return locale.replace('-', '_')
}
export const useProviderCrenditialsFormSchemasValue = (