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

Support for Next 13 App Router & Pages Router #21

Closed
alvesvin opened this issue May 17, 2023 · 5 comments
Closed

Support for Next 13 App Router & Pages Router #21

alvesvin opened this issue May 17, 2023 · 5 comments

Comments

@alvesvin
Copy link

What version of this package are you using?
[email protected]

What problem do you want to solve?
Currently, next-translate-plugin webpack loader can only support either Pages Router or App Router based on experimental.appDir configuration in next.config.js. While most of production apps are still migrating from the old Pages Router, we need to support both of those types of routing.

What do you think is the correct solution to this problem?
The solution is to support multiple pages directories and add necessary helpers accordingly, heavily based on the directory pattern. If page is under a valid App Router directory, than it is a new Next 13 page. If page is under a valid Pages Router directory, than it is a legacy page. Other files are skipped.

Are you willing to submit a pull request to implement this change?
Yes!

@alvesvin
Copy link
Author

Any thoughts on it @aralroca?

@aralroca
Copy link
Owner

Yes, is in the plan. Currently, I don't have much time to do it, but I'll try to do it as soon as I have time. BTW; any PR about this will be very welcome

@aralroca
Copy link
Owner

Thanks for your contribution ❤️

@aralroca
Copy link
Owner

aralroca commented Jun 5, 2023

@alvesvin please try this canary https://github.com/aralroca/next-translate-plugin/releases/tag/2.3.0-canary.1 thanks for your contributions. I isolate this change.

@aralroca aralroca closed this as completed Jun 5, 2023
@andre-lergier
Copy link

andre-lergier commented Oct 16, 2023

We are currently implementing the new App Router.
Therefore we need to support the app and the pages directory at the same time.

After updating next-translate and next-translate-plugin to version 2.6.1 everything works as expected in the app router.
For routes located in the pages folder we now get a react hydration error:

Error: Text content does not match server-rendered HTML.

Warning: Text content did not match. Server: "namespace:page-overview" Client: "Übersicht"

In the frontend, everything is shown correctly.

Do you have an idea what the problem could be @alvesvin or @aralroca?

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

3 participants