import React from 'react'; import { Button, Dropdown } from 'antd'; import { GlobalOutlined } from '@ant-design/icons'; import { useTranslation } from 'react-i18next'; import type { MenuProps } from 'antd'; export default function LanguageSwitcher() { const { i18n } = useTranslation(); const currentLng = i18n.language?.startsWith('en') ? 'en' : 'zh'; const items: MenuProps['items'] = [ { key: 'zh', label: ( 中文 ), }, { key: 'en', label: ( English ), }, ]; const handleChange: MenuProps['onClick'] = ({ key }) => { i18n.changeLanguage(key); localStorage.setItem('i18nextLng', key); }; return ( ); }