import { useTranslation } from 'react-i18next'

export function LanguageSwitch() {
  const { i18n } = useTranslation()

  const toggleLanguage = () => {
    const newLang = i18n.language === 'zh' ? 'en' : 'zh'
    i18n.changeLanguage(newLang)
  }

  return (
    <button onClick={toggleLanguage} className="btn btn-lang">
      {i18n.language === 'zh' ? 'EN' : '中文'}
    </button>
  )
}
