Hide locale prefix with Next.JS sub-path internationalized i18n routing

Viewed 113

Problem: I want to add two extra languages to a Next.JS website. The internationalized routing function with the automatic locale detection seems great. However, I don't want the forced prefixes as it creates a need for many separate, duplicated pages.

Goal: I just need the locale, which I can then use to dynamically load the text that I need (from objects that are accompanied by their translations, which I pull from CMS). Like so: <p>{item.title[locale]}</p>

Am I missing something? Some way to access the locale object within the Router, without activating the routing, would be a solution.

With forced prefixes, I would need to duplicate all my pages three times, bloating my project and adding a lot of work.

Hope someone can help!

Greets from the Netherlands.

0 Answers
Related