\n \n {子供たち}\n <\/nextintlclientProvider>\n <\/body>\n <\/html>\n );\n}<\/pre>

ステップ5:コンポーネントで翻訳を使用します<\/h4>
「クライアントの使用」;\n\n'next-intl'から{usetranslations}をインポートします。\n\nデフォルト関數(shù)をエクスポートwelcome(){\n  const t = usetranslations( 'common');\n  return 

{t( 'welcome')} <\/h1>;\n}<\/pre>

サーバーコンポーネントでも使用できます。<\/p>

 'next-intl\/server'から{get Translations}をインポートします。\n\nデフォルトのasync関數(shù)について(){{\n  const t = await get translations( 'about');\n  return 

{t( 'title')} <\/h1>;\n}<\/pre>

?3。動的言語スイッチング(言語セレクター)<\/h3>

言語スイッチコンポーネントを作成します。<\/p>

 「クライアントの使用」;\n\n{next\/navigation 'から{userouter、usepathname}をimport;\n'next-intl'から{uselocale}をインポートします。\n\nexport function言語スイッチャー(){\n  const router = userouter();\n  const pathname = usepathname();\n  const locale = uselocale();\n\n  const spitchto =(newlocale:string)=> {\n    \/\/現(xiàn)在のパスを\/en\/pathnameから\/zh\/pathnameに変換します\n    router.push(pathname.replace( `\/$ {locale}`、 `\/$ {newlocale}`));\n  };\n\n  戻る (\n    
\n

    <var id="kzk8t"><thead id="kzk8t"></thead></var>