# gt-next: General Translation Next.js SDK: getRegion URL: https://generaltranslation.com/ja/docs/next/api/helpers/get-region.mdx --- title: getRegion description: getRegion のサーバーサイドメソッドに関する API リファレンス --- ## 概要 `getRegion` 関数は、サーバーサイドレンダリング時に組み込みの リージョン Cookie から現在のユーザーのリージョンコードを取得します。 `getRegion` はサーバーサイドのメソッドで、サーバーコンポーネントでのみ使用できます。 クライアントサイドで使用する場合は、[`useRegion`](/docs/next/api/helpers/use-region) を参照してください。 ## リファレンス ### 戻り値 `Promise` — ユーザーのリージョンコード (例: `"US"`、`"CA"`) に解決される Promise。リージョンが設定されていない場合は `undefined` を返します。 *** ## 例 ### 基本的な使い方 ```jsx title="RegionDisplay.jsx" copy import { getRegion } from 'gt-next/server'; export default async function RegionDisplay() { const region = await getRegion(); // [!code highlight] return

現在のリージョン: {region ?? '未設定'}

; } ``` *** ## 注記 * `getRegion` は非同期なので、`await` する必要があります。 * ユーザーがリージョンを選択していない場合は、`undefined` が返されます。 * リージョンは Cookie に保存され、[``](/docs/next/api/components/region-selector) コンポーネントまたは [`useRegionSelector`](/docs/next/api/helpers/use-region-selector) フックで設定できます。 ## 次のステップ * クライアント側で同等の機能については、[`useRegion`](/docs/next/api/helpers/use-region)を参照してください。 * ユーザーがリージョンを選択できるようにするには、[``](/docs/next/api/components/region-selector)を使用します。