Replies: 1 comment
-
Have you set up |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm experiencing an issue with the next-intl translation plugin for Next.js, specifically when using client-side components within a server-side rendered (SSR) page.
I have a complex SSR page that renders some elements on the server side. However, I also want to include client-side components, such as a contact component form, which is only rendered on the client side with
use client
. When using theuseTranslations
function fromnext-intl
to easily translate these client-side components, it doesn't work as expected.The issue arises when trying to use
useTranslation
in the client-side component. The function complains if the string is not having an exact translation text, which suggests that my configuration is correct (following the current docs and setup). However, instead of getting the translated text, I receive the initial translation key strings.I've tried another approach by rendering the client-side component separately and passing the translation strings from server-side rendering as parameters (like
<ContactForm tranlsations={tranlsationsForComponent} />
) and this works, but it increases the complexity of building components and doesn't seem like the desired way to reuse them, especially with complex translations for form validation.My question is: Is it possible to use client-side components with
useTranslation
in SSR pages? If so, could someone provide an example of how this should be structured?To give some context, here's a basic outline of my server-side rendering page and how I consume the client-side component:
Nextjs: 15.4.2
Intl-next: 4.3.4
server-side component (the main page)
Any help or guidance on how to properly configure this would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions