Henning
Henning

Reputation: 11

Next.JS 13 problem with internationalization

there is a problem with the context.locale in Next.JS. I have a dynamic route (pages/song/[id])

If I go to a page there like /de/song/exampleSong directly by entering the address in the browser and hitting enter, the local is correct and the page is shown in the right language.

However, if in another page of the website I have a Link or I do router.push, then at first place this page under the dynamic route is always given the locale by Next as how in i18n (next.config.js) the defaultLocale is defined even though the address displayed in the browser is with the right locale (/de/song/....). Do I hit reload on the page then the locale is correct again within the react app. When I do a console.log in the Middleware, the locale is always correctly detected. However, in the actual app the locale is sometimes wrong.

I am using:

"next": "^13.3.0",
"next-intl": "^2.19.1",
"react": "^18.2.0",
"react-click-away-listener": "^2.2.3",
"react-dom": "^18.2.0",
"react-gtm-module": "^2.0.11"

I have no solution so far. I tried other versions of Next.js which did not help. This seems to be a bug since 13.0.0

Upvotes: 1

Views: 1206

Answers (1)

Nader Abd Alhamed
Nader Abd Alhamed

Reputation: 91

for anyone facing the same problem , just upgrade next-intl to 3.4.2 solves the problem

Upvotes: 2

Related Questions