import { Fragment } from 'react' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { Menu, Transition } from '@headlessui/react' import { useRouter } from 'next/router' import Link from 'next/link' // https://headlessui.dev/react/menu#integrating-with-next-js const CustomLink = ({ href, children, as, locale, ...props }): JSX.Element => { return ( {children} ) } const localeText = (locale: string): string => { switch (locale) { case 'en': return 'đŸ‡Ŧ🇧 English' case 'zh-CN': return '🇨đŸ‡ŗ įŽ€äŊ“中文' default: return 'đŸ‡Ŧ🇧 English' } } const SwitchLang = () => { const { locales, pathname, query, asPath } = useRouter() return (
{locales!.map(locale => (
{localeText(locale)}
))}
) } export default SwitchLang