'use client'; import clsx from 'clsx'; import Link from 'next-intl/link'; import { usePathname } from 'next/navigation'; export type SupportedLocale = 'en' | 'ja'; function removeItem(arr: Array, value: T): Array { const index = arr.indexOf(value); if (index > -1) { arr.splice(index, 1); } return arr; } export const LanguageControl = ({ lang }: { lang?: SupportedLocale }) => { const pathName = usePathname(); const basePathName = () => { const unjoined = pathName.split('/'); const unjoinedWithoutLocale = removeItem(unjoined, 'en'); return unjoinedWithoutLocale.join('/') || '/'; }; return (
JP / EN
); };