You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With Next 13 and app dir compatibly is poor, specially when changing the language in current navigation.
import setLanguage from 'next-translate/setLanguage' gives an error (even with a use client directive):
Error: No router instance found.
You should only use "next/router" on the client side of your app.
Based on what I see on README note the workaround for now it to use a middleware that appends ?lang=es to each navigation. And add "dynamic root directory" [lang]
What do you think is the correct solution to this problem?
Fix import setLanguage from 'next-translate/setLanguage' to allow changing language programmatically.
The workaround provided in the readme note suggest changing the files structure of the project and depending on how the app is hosted and built this could require changes on all Links (add /lang path)
The text was updated successfully, but these errors were encountered:
bdetry
changed the title
Change language compatibility with Next 13
Change language - compatibility with Next 13
Apr 12, 2024
What version of this package are you using?
2.6.2 (latest at this day)
What problem do you want to solve?
With Next 13 and
app dir
compatibly is poor, specially when changing the language in current navigation.import setLanguage from 'next-translate/setLanguage'
gives an error (even with ause client
directive):Error: No router instance found.
You should only use "next/router" on the client side of your app.
Based on what I see on README note the workaround for now it to use a middleware that appends
?lang=es
to each navigation. And add "dynamic root directory"[lang]
Readme note : https://www.npmjs.com/package/next-translate#14-use-next-13-app-directory
What do you think is the correct solution to this problem?
Fix
import setLanguage from 'next-translate/setLanguage'
to allow changing language programmatically.The workaround provided in the readme note suggest changing the files structure of the project and depending on how the app is hosted and built this could require changes on all Links (add /lang path)
The text was updated successfully, but these errors were encountered: