My goal is to create dynamic translation routes for specific pages in next js using i18next. While the following code works well, it currently routes to all pages and generates errors during next build
.
const router = useRouter();
const path = router.route;
<Link href={`/fr${path}`}>
French
</Link>
<Link href={`/es${path}`}>
Spanish
</Link>
I'm aiming to implement these dynamic translation routes only for the home and about page. One potential workaround would be to separate the translation route links from the navbar and place them wherever needed. However, I prefer to integrate this translation functionality within the navbar component for reusability on every page. Is there a way to achieve this in a reusable component?