import React, { FC } from 'react' import { Dropdown, Menu, Space } from 'antd' import { LANG_MAP } from '../types' import { useTranslation } from 'react-i18next' import { changeLang } from '../locales' import { useGuardContext } from '../../../context/global/context' export const ToggleLang: FC = () => { const { state: { authClient }, } = useGuardContext() const onClick = ({ key }: any) => { changeLang(key) //authClient.setLang(key) } const { i18n } = useTranslation() return ( {LANG_MAP.map((item) => ( {item.label} ))} } > { LANG_MAP.find((item) => item.value === (i18n.language || 'zh-CN')) ?.label } ) }