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:
balibabu
2024-04-12 11:41:00 +08:00
committed by GitHub
parent e20207101a
commit f173fe6e47
10 changed files with 470 additions and 24 deletions

View File

@ -2,9 +2,11 @@ import { ReactComponent as TranslationIcon } from '@/assets/svg/translation.svg'
import { useTranslate } from '@/hooks/commonHooks';
import { GithubOutlined } from '@ant-design/icons';
import { Dropdown, MenuProps, Space } from 'antd';
import camelCase from 'lodash/camelCase';
import React from 'react';
import User from '../user';
import { LanguageList } from '@/constants/common';
import { useChangeLanguage } from '@/hooks/logicHooks';
import styled from './index.less';
@ -28,17 +30,12 @@ const RightToolBar = () => {
changeLanguage(key);
};
const items: MenuProps['items'] = [
{
key: 'English',
label: <span>{t('english')}</span>,
},
{ type: 'divider' },
{
key: 'Chinese',
label: <span>{t('chinese')}</span>,
},
];
const items: MenuProps['items'] = LanguageList.map((x) => ({
key: x,
label: <span>{t(camelCase(x))}</span>,
})).reduce<MenuProps['items']>((pre, cur) => {
return [...pre!, { type: 'divider' }, cur];
}, []);
return (
<div className={styled.toolbarWrapper}>