Feat/portuguese support (#2075)

This commit is contained in:
crazywoola
2024-01-23 21:14:53 +08:00
committed by GitHub
parent 21ade71bad
commit c17baef172
78 changed files with 2849 additions and 376 deletions

View File

@@ -10,7 +10,7 @@ import { updateUserProfile } from '@/service/common'
import { ToastContext } from '@/app/components/base/toast'
import I18n from '@/context/i18n'
import { timezones } from '@/utils/timezone'
import { languageMaps, languages } from '@/utils/language'
import { languages } from '@/utils/language'
const titleClassName = `
mb-2 text-sm font-medium text-gray-900
@@ -28,7 +28,7 @@ export default function LanguagePage() {
if (type === 'language') {
url = '/account/interface-language'
bodyKey = 'interface_language'
setLocaleOnClient(item.value === 'en-US' ? 'en' : 'zh-Hans')
setLocaleOnClient(item.value.toString())
}
if (type === 'timezone') {
url = '/account/timezone'
@@ -52,7 +52,7 @@ export default function LanguagePage() {
<div className='mb-8'>
<div className={titleClassName}>{t('common.language.displayLanguage')}</div>
<SimpleSelect
defaultValue={languageMaps[locale] || userProfile.interface_language}
defaultValue={locale || userProfile.interface_language}
items={languages}
onSelect={item => handleSelect('language', item)}
disabled={editing}

View File

@@ -3,6 +3,7 @@ export type FormValue = Record<string, any>
export type TypeWithI18N<T = string> = {
'en_US': T
'zh_Hans': T
[key: string]: T
}
export enum FormTypeEnum {

View File

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

View File

@@ -15,14 +15,6 @@ import {
validateModelProvider,
} from '@/service/common'
export const languageMaps = {
'en': 'en_US',
'zh-Hans': 'zh_Hans',
} as {
'en': 'en_US'
'zh-Hans': 'zh_Hans'
}
export const MODEL_PROVIDER_QUOTA_GET_FREE = ['minimax', 'spark', 'zhipuai']
export const MODEL_PROVIDER_QUOTA_GET_PAID = ['anthropic', 'openai', 'azure_openai']