Fix/language support (#2154)

This commit is contained in:
crazywoola 2024-01-24 11:08:11 +08:00 • committed by GitHub
commit e58c3ac374
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 103 additions and 71 deletions

View file

@ -10,6 +10,7 @@ import Button from '@/app/components/base/button'
import Drawer from '@/app/components/base/drawer-plus'
import I18n from '@/context/i18n'
import { testAPIAvailable } from '@/service/tools'
import { getModelRuntimeSupported } from '@/utils/language'
type Props = {
customCollection: CustomCollectionBackend
@ -26,6 +27,7 @@ const TestApi: FC<Props> = ({
}) => {
const { t } = useTranslation()
const { locale } = useContext(I18n)
const language = getModelRuntimeSupported(locale)
const [credentialsModalShow, setCredentialsModalShow] = useState(false)
const [tempCredential, setTempCredential] = React.useState<Credential>(customCollection.credentials)
const [result, setResult] = useState<string>('')
@ -78,7 +80,7 @@ const TestApi: FC<Props> = ({
{parameters.map((item, index) => (
<tr key={index} className='border-b last:border-0 border-gray-200'>
<td className="py-2 pl-3 pr-2.5">
{item.label[locale === 'en' ? 'en_US' : 'zh_Hans']}
{item.label[language]}
</td>
<td className="">
<input