fix: use English as the default i18n language (#2663)

This commit is contained in:
Yeuoly
2024-03-03 12:35:28 +08:00
committed by GitHub
parent bc65ee10c0
commit e94b323e6c
9 changed files with 33 additions and 19 deletions

View File

@@ -65,7 +65,7 @@ const PopupItem: FC<PopupItemProps> = ({
return (
<div className='mb-1'>
<div className='flex items-center px-3 h-[22px] text-xs font-medium text-gray-500'>
{model.label[language]}
{model.label[language] || model.label.en_US}
</div>
{
model.models.map(modelItem => (

View File

@@ -23,7 +23,22 @@ const Popup: FC<PopupProps> = ({
const language = useLanguage()
const [searchText, setSearchText] = useState('')
const filteredModelList = modelList.filter(model => model.models.filter(modelItem => modelItem.label[language].includes(searchText)).length)
const filteredModelList = modelList.filter(
model => model.models.filter(
(modelItem) => {
if (modelItem.label[language] !== undefined)
return modelItem.label[language].includes(searchText)
let found = false
Object.keys(modelItem.label).forEach((key) => {
if (modelItem.label[key].includes(searchText))
found = true
})
return found
},
).length,
)
return (
<div className='w-[320px] max-h-[480px] rounded-lg border-[0.5px] border-gray-200 bg-white shadow-lg overflow-y-auto'>