mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-09 19:06:51 +08:00
Feat/portuguese support (#2075)
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 = (
|
||||
|
||||
@@ -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']
|
||||
|
||||
|
||||
@@ -2,17 +2,7 @@ import { useState } from 'react'
|
||||
import { useContext } from 'use-context-selector'
|
||||
import I18n from '@/context/i18n'
|
||||
import { X } from '@/app/components/base/icons/src/vender/line/general'
|
||||
|
||||
const NOTICE_I18N = {
|
||||
title: {
|
||||
'en': 'Important Notice',
|
||||
'zh-Hans': '重要公告',
|
||||
},
|
||||
desc: {
|
||||
'en': 'Our system will be unavailable from 19:00 to 24:00 UTC on August 28 for an upgrade. For questions, kindly contact our support team (support@dify.ai). We value your patience.',
|
||||
'zh-Hans': '为了有效提升数据检索能力及稳定性,Dify 将于 2023 年 8 月 29 日 03:00 至 08:00 期间进行服务升级,届时 Dify 云端版及应用将无法访问。感谢您的耐心与支持。',
|
||||
},
|
||||
}
|
||||
import { NOTICE_I18N } from '@/utils/language'
|
||||
|
||||
const MaintenanceNotice = () => {
|
||||
const { locale } = useContext(I18n)
|
||||
@@ -23,13 +13,16 @@ const MaintenanceNotice = () => {
|
||||
setShowNotice(false)
|
||||
}
|
||||
|
||||
const titleByLocale: { [key: string]: string } = NOTICE_I18N.title
|
||||
const descByLocale: { [key: string]: string } = NOTICE_I18N.desc
|
||||
|
||||
if (!showNotice)
|
||||
return null
|
||||
|
||||
return (
|
||||
<div className='shrink-0 flex items-center px-4 h-[38px] bg-[#FFFAEB] border-b border-[0.5px] border-b-[#FEF0C7] z-20'>
|
||||
<div className='shrink-0 flex items-center mr-2 px-2 h-[22px] bg-[#F79009] text-white text-[11px] font-medium rounded-xl'>{NOTICE_I18N.title[locale]}</div>
|
||||
<div className='grow text-xs font-medium text-gray-700'>{NOTICE_I18N.desc[locale]}</div>
|
||||
<div className='shrink-0 flex items-center mr-2 px-2 h-[22px] bg-[#F79009] text-white text-[11px] font-medium rounded-xl'>{titleByLocale[locale]}</div>
|
||||
<div className='grow text-xs font-medium text-gray-700'>{descByLocale[locale]}</div>
|
||||
<X className='shrink-0 w-4 h-4 text-gray-500 cursor-pointer' onClick={handleCloseNotice} />
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user