refactor(language): move language constants to common module and improve language handling
This commit is contained in:
@@ -53,9 +53,9 @@ import { zhCN, enUS } from '@mui/x-data-grid/locales';
|
||||
import type { IKnowledgeFile } from '@/interfaces/database/knowledge';
|
||||
import type { IDocumentInfoFilter } from '@/interfaces/database/document';
|
||||
import { RunningStatus } from '@/constants/knowledge';
|
||||
import { LanguageAbbreviation } from '@/locales';
|
||||
import dayjs from 'dayjs';
|
||||
import logger from '@/utils/logger';
|
||||
import { LanguageAbbreviation } from '@/constants/common';
|
||||
|
||||
|
||||
interface DocumentListComponentProps {
|
||||
|
||||
@@ -9,9 +9,10 @@ import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import { useKnowledgeOverview, useKnowledgeDetail } from '@/hooks/knowledge-hooks';
|
||||
import logger from '@/utils/logger';
|
||||
import i18n, { LanguageAbbreviation } from '@/locales';
|
||||
import i18n from '@/locales';
|
||||
import { enUS, zhCN } from '@mui/x-data-grid/locales';
|
||||
import KnowledgeBreadcrumbs from './components/KnowledgeBreadcrumbs';
|
||||
import { LanguageAbbreviation } from '@/constants/common';
|
||||
|
||||
|
||||
const PROCESSING_TYPES = {
|
||||
|
||||
@@ -20,18 +20,10 @@ import { useProfileSetting } from '@/hooks/setting-hooks';
|
||||
import { useMessage } from '@/hooks/useSnackbar';
|
||||
import type { IUserInfo } from '@/interfaces/database/user-setting';
|
||||
import { TimezoneList } from '@/constants/setting';
|
||||
import { LanguageList, LanguageMap } from '@/constants/common';
|
||||
|
||||
// 语言选项
|
||||
const languageOptions = [
|
||||
{ value: 'Chinese', label: '简体中文' },
|
||||
{ value: 'English', label: 'English' },
|
||||
{ value: 'Spanish', label: 'Español' },
|
||||
{ value: 'French', label: 'Français' },
|
||||
{ value: 'German', label: 'Deutsch' },
|
||||
{ value: 'Japanese', label: '日本語' },
|
||||
{ value: 'Korean', label: '한국어' },
|
||||
{ value: 'Vietnamese', label: 'Tiếng Việt' }
|
||||
];
|
||||
const languageOptions = LanguageList.map(x => ({ value: x, label: LanguageMap[x as keyof typeof LanguageMap] }));
|
||||
|
||||
// 时区选项
|
||||
const timezoneOptions = TimezoneList.map(x => ({ value: x, label: x }));
|
||||
|
||||
Reference in New Issue
Block a user