Closed trlanfeng closed 11 months ago
it prompts that it needs to be included in
I18nProviderClient
.
Yes.
src/app/[locale]/layout.tsx
'use client';
// * ...
export default function RootLayout({ children }: LayoutMinimalProps) { return (
); }
This doesn't seem to be a _bug_, but more a _question_, though.
You have to wrap your client components in I18nProviderClient
. The easiest option is to do so in a layout: https://next-international.vercel.app/docs/app-setup#move-your-existing-files
How to use
useI18n
in a client-side component? Just like in the exampleexamples/next-app/app/[locale]/switch.tsx
, but I want to add a "Switch Language" text that is obtained from a language file. However, when usinguseI18n
in a client-side component, it prompts that it needs to be included inI18nProviderClient
.