import React from 'react'; import { formatMessage, setLocale, getLocale } from 'umi-plugin-react/locale'; import { Menu, Icon } from 'antd'; import { ClickParam } from 'antd/es/menu'; import classNames from 'classnames'; import HeaderDropdown from '../HeaderDropdown'; import styles from './index.less'; interface SelectLangProps { className?: string; } const SelectLang: React.FC = props => { const { className } = props; const selectedLang = getLocale(); const changeLang = ({ key }: ClickParam) => setLocale(key); const locales = ['zh-CN', 'zh-TW', 'en-US', 'pt-BR']; const languageLabels = { 'zh-CN': '简体中文', 'zh-TW': '繁体中文', 'en-US': 'English', 'pt-BR': 'Português', }; const languageIcons = { 'zh-CN': '🇨🇳', 'zh-TW': '🇭🇰', 'en-US': '🇬🇧', 'pt-BR': '🇧🇷', }; const langMenu = ( {locales.map(locale => ( {languageIcons[locale]} {' '} {languageLabels[locale]} ))} ); return ( ); }; export default SelectLang;