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

AppDirI18nProvider is not loaded after refresh, so lang is null #1158

Open
fuetgeo opened this issue Oct 12, 2023 · 2 comments
Open

AppDirI18nProvider is not loaded after refresh, so lang is null #1158

fuetgeo opened this issue Oct 12, 2023 · 2 comments

Comments

@fuetgeo
Copy link

fuetgeo commented Oct 12, 2023

What version of this package are you using?
same behavior with next-translate-plugin 2.5.3 and 2.6.0

What operating system, Node.js, and npm version?
Win 11
Node 18.17.1
npm 10.0.0

What happened?
When using a client component in layout.tsx, translation of that component only works on the first page load after (re)starting the application. When reloading the page, the component gets rendered with placeholders only.

When the problem occurs, lang is undefined - which is probably the consequence of AppDirI18nProvider missing in the component tree.

This is a duplicate of #1151

What did you expect to happen?
next-translate claims to work seemlessly for both server and client components. I don't see a reason why one wouldn't expect it to work in this scenario.

Are you willing to submit a pull request to fix this bug?
No, due to lacking experience.

@michaelmorrisg
Copy link

I never confirmed lang is undefined, but the symptoms are the same for me as well. After reload, the translations are just the keys and the console is full of hydration errors due to the server and client not matching.

I also am attempting to use a client component in a layout which seems perfectly fine to do, but doesn't work for translations in this case.

@acidfernando
Copy link
Contributor

I don't know why they closed #1151 but I can confirm this bug exists and there's no documentation that says you cannot use client components inside of the layout. I created a repro, maybe this will help boost this issue again: https://codesandbox.io/p/devbox/relaxed-kapitsa-59xwtj

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