Add i18n support with language selector on login page (#1410)

* feat: add i18n support with language selector on login page

Co-Authored-By: Junyan Qin <Chin> <rockchinq@gmail.com>

* feat: complete i18n implementation for all webui components

Co-Authored-By: Junyan Qin <Chin> <rockchinq@gmail.com>

* feat: complete all hardcoded text

* feat: dynamic label i18n

* fix: lint errors

* fix: lint errors

* delete sh fils

* fix: edit model dialog title

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Junyan Qin <Chin> <rockchinq@gmail.com>
This commit is contained in:
devin-ai-integration[bot]
2025-05-13 22:39:19 +08:00
committed by GitHub
parent 91cd8cf380
commit 2bf94539bd
25 changed files with 898 additions and 233 deletions
+7 -3
View File
@@ -15,7 +15,11 @@ import {
DialogTitle,
} from '@/components/ui/dialog';
import { toast } from 'sonner';
import { useTranslation } from 'react-i18next';
import { i18nObj } from '@/i18n/I18nProvider';
export default function BotConfigPage() {
const { t } = useTranslation();
const [modalOpen, setModalOpen] = useState<boolean>(false);
const [botList, setBotList] = useState<BotCardVO[]>([]);
const [isEditForm, setIsEditForm] = useState(false);
@@ -29,7 +33,7 @@ export default function BotConfigPage() {
const adapterListResp = await httpClient.getAdapters();
const adapterList = adapterListResp.adapters.map((adapter: Adapter) => {
return {
label: adapter.label.zh_CN,
label: i18nObj(adapter.label),
value: adapter.name,
};
});
@@ -53,7 +57,7 @@ export default function BotConfigPage() {
})
.catch((err) => {
console.error('get bot list error', err);
toast.error('获取机器人列表失败:' + err.message);
toast.error(t('bots.getBotListError') + err.message);
})
.finally(() => {
// setIsLoading(false);
@@ -78,7 +82,7 @@ export default function BotConfigPage() {
<DialogContent className="w-[700px] max-h-[80vh] p-0 flex flex-col">
<DialogHeader className="px-6 pt-6 pb-4">
<DialogTitle>
{isEditForm ? '编辑机器人' : '创建机器人'}
{isEditForm ? t('bots.editBot') : t('bots.createBot')}
</DialogTitle>
</DialogHeader>
<div className="flex-1 overflow-y-auto px-6">