With the main element containing my main page, which is successfully translated for both server and client components when I follow instructions on the website:
But I would also want to translate the <Header /> and <Footer /> components in the layout. I want to keep them there for consistency. But they are not wrapped in the <TranslationsProvider /> so they aren't translated. The header is a client component and the footer is a server component. So I would like to ask for a guide on this. I have searched but haven't found a good answer. Thank you in advance.
If your Header is a client component, it should be able to access translations via the useTranslations hook. For all nested server components, you will need to use initTranslations again.
Hello, I would like to request help regarding translating my current app. Currently, I have a fixed header and a footer in my
layout.tsx
file:With the
main
element containing my main page, which is successfully translated for both server and client components when I follow instructions on the website:But I would also want to translate the
<Header />
and<Footer />
components in the layout. I want to keep them there for consistency. But they are not wrapped in the<TranslationsProvider />
so they aren't translated. The header is a client component and the footer is a server component. So I would like to ask for a guide on this. I have searched but haven't found a good answer. Thank you in advance.