Next.js Discord

Discord Forum

How to use i18n with dynamic router.

Unanswered
West African Crocodile posted this in #help-forum
Open in Discord
West African CrocodileOP
I am developing app router Next.js project, but I have acrossed critical problem.
The folder structure: "/[locale]/services/[item]"
In this case, services have too many pages.
So I am fetching data for item.
For i18n, I have defined routing and I am changing language using this code
 startTransition(() => {
      router.replace({ pathname }, { locale: nextLocale });
    });

But I don't know correct method what define routing with fetch data for this.
Please help me. Thanks.

0 Replies