# General Translation React SDKs (gt-react, gt-next): getLocale URL: https://generaltranslation.com/ja/docs/react/nextjs/reference/functions/get-locale.mdx --- title: getLocale description: General Translation を使用して、現在の Next.js App Router リクエストのロケールを読み取ります。getLocale の API リファレンス。 --- `getLocale` 関数は、現在の App Router リクエストのロケールを BCP 47 ロケールコードとして返します。async コンポーネント、Route Handler、そのほかのサーバーコードでは、`gt-next/server` からインポートしてください。 `getLocale` はサーバー専用で、Pages Router では動作しません。 ## 概要 [#overview] ```tsx import { getLocale } from 'gt-next/server'; const locale = await getLocale(); // 'en-US' ``` ## 戻り値 [#returns] **型** `Promise` 現在のリクエストのロケールを返す Promise。General Translation は、設定されたリクエストロケール関数を使ってロケールを解決し、必要に応じてデフォルトロケールにフォールバックします。 ## 例 [#example] ```tsx title="app/[locale]/layout.tsx" import { getLocale } from 'gt-next/server'; export default async function LocaleLayout({ children }) { const locale = await getLocale(); return {children}; } ```