feat: Support Traditional Chinese (#336)
### What problem does this PR solve? Support Traditional Chinese Issue link: #335 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { LanguageTranslationMap } from '@/constants/common';
|
||||
import { ITenantInfo } from '@/interfaces/database/knowledge';
|
||||
import {
|
||||
IFactory,
|
||||
@@ -66,7 +67,11 @@ const model: DvaModel<SettingModelState> = {
|
||||
// };
|
||||
// authorizationUtil.setUserInfo(userInfo);
|
||||
if (retcode === 0) {
|
||||
i18n.changeLanguage(res.language === 'Chinese' ? 'zh' : 'en');
|
||||
i18n.changeLanguage(
|
||||
LanguageTranslationMap[
|
||||
res.language as keyof typeof LanguageTranslationMap
|
||||
],
|
||||
);
|
||||
yield put({ type: 'setUserInfo', payload: res });
|
||||
// localStorage.setItem('userInfo',res.)
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
Upload,
|
||||
UploadFile,
|
||||
} from 'antd';
|
||||
import camelCase from 'lodash/camelCase';
|
||||
import { useEffect } from 'react';
|
||||
import SettingTitle from '../components/setting-title';
|
||||
import { TimezoneList } from '../constants';
|
||||
@@ -29,6 +30,7 @@ import {
|
||||
useValidateSubmittable,
|
||||
} from '../hooks';
|
||||
|
||||
import { LanguageList } from '@/constants/common';
|
||||
import { useTranslate } from '@/hooks/commonHooks';
|
||||
import { useChangeLanguage } from '@/hooks/logicHooks';
|
||||
import parentStyles from '../index.less';
|
||||
@@ -162,12 +164,11 @@ const UserSettingProfile = () => {
|
||||
placeholder={t('languagePlaceholder', { keyPrefix: 'common' })}
|
||||
onChange={changeLanguage}
|
||||
>
|
||||
<Option value="English">
|
||||
{t('english', { keyPrefix: 'common' })}
|
||||
</Option>
|
||||
<Option value="Chinese">
|
||||
{t('chinese', { keyPrefix: 'common' })}
|
||||
</Option>
|
||||
{LanguageList.map((x) => (
|
||||
<Option value={x} key={x}>
|
||||
{t(camelCase(x), { keyPrefix: 'common' })}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Divider />
|
||||
|
||||
Reference in New Issue
Block a user