"use client"; import { useLocale } from "next-intl"; import { locales, localeNames } from "../../i18nconfig"; import { useRouter } from "next/router"; import Link from 'next/link'; import { Fragment } from "react"; export default function LocaleSwitcher(){ const locale = useLocale(); const router = useRouter(); const switchLocale = (newLocale: string) => { router.push({ pathname: router.pathname, query: router.query }, router.asPath, {locale:...
Originally asked by Alexis Esteban Herrera Benitez on Stack Exchange (stackoverflow) (CC BY-SA 4.0).