Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change language - compatibility with Next 13 #1210

Open
bdetry opened this issue Apr 12, 2024 · 1 comment
Open

Change language - compatibility with Next 13 #1210

bdetry opened this issue Apr 12, 2024 · 1 comment

Comments

@bdetry
Copy link

bdetry commented 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 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]

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)

@bdetry bdetry changed the title Change language compatibility with Next 13 Change language - compatibility with Next 13 Apr 12, 2024
@Anarbb
Copy link

Anarbb commented Oct 31, 2024

Any workaround on this??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants