# General Translation React SDKs (gt-react, gt-next): useLocaleProperties
URL: https://generaltranslation.com/ja/docs/react/reference/hooks/use-locale-properties.mdx
---
title: useLocaleProperties
description: General Translation の gt-react でロケールの表示メタデータを読み取ります。useLocaleProperties の API リファレンス。
---
`useLocaleProperties` フック は、ロケールの表示メタデータ (名前、ネイティブ名、言語、リージョン、スクリプト) を返します。
*`gt-react`、`gt-next`、`gt-react-native` で利用できます。例では `gt-react` から import していますが、実際にはお使いのフレームワークのパッケージから import してください。*
*注: `gt-tanstack-start` では export されていません。*
## 概要 [#overview]
`useLocaleProperties` にロケールコードを渡すと、そのプロパティを取得できます。
```tsx
import { useLocale, useLocaleProperties } from 'gt-react';
export default function LocaleInfo() {
const locale = useLocale();
const props = useLocaleProperties(locale); // [!code highlight]
return (
Name: {props.name}
Native name: {props.nativeName}
Region: {props.regionName}
);
}
```
*注: `gt-react` では、[``](/docs/react/reference/components/gt-provider) の配下で `useLocaleProperties` を呼び出してください。`gt-next` では、サーバーコンポーネント内でも使用できます。*
## 仕組み [#how-it-works]
このフックは、指定されたロケールコードを対応する [`LocaleProperties`](/docs/platform/core/reference/types/locale-properties) オブジェクトに変換します。これは、カスタムのロケールセレクターを作成したり、ロケールのメタデータをユーザーに表示したりする際に役立ちます。
## パラメーター [#parameters]
| パラメーター | 説明 | 型 | 任意 | デフォルト |
| ------------------- | -------- | -------- | --- | ----- |
| [`locale`](#locale) | 対象のロケール。 | `string` | いいえ | — |
### `locale` [#locale]
**型** `string` · **必須**
`en-US` や `ja` などの BCP 47 ロケールコードです。
## 戻り値 [#returns]
**型** [`LocaleProperties`](/docs/platform/core/reference/types/locale-properties)
ロケールを表すオブジェクトです。主なフィールドは次のとおりです。
| フィールド | 説明 | 型 |
| -------------------------- | --------------------------------- | -------- |
| `code` | `en-US` などのロケールコード。 | `string` |
| `name` | `American English` などのロケールの英語名。 | `string` |
| `nativeName` | そのロケールの言語での名称。 | `string` |
| `languageCode` | `en` などの言語サブタグ。 | `string` |
| `languageName` | 言語の英語名。 | `string` |
| `nativeLanguageName` | その言語での言語名。 | `string` |
| `nameWithRegionCode` | `English (US)` などの、リージョンを含むロケール名。 | `string` |
| `nativeNameWithRegionCode` | リージョンを含む、そのロケールの言語での名称。 | `string` |
| `regionCode` | `US` などのリージョンサブタグ。 | `string` |
| `regionName` | リージョンの英語名。 | `string` |
| `nativeRegionName` | そのロケールの言語でのリージョン名。 | `string` |
| `scriptCode` | `Latn` などのスクリプトサブタグ。 | `string` |
| `scriptName` | スクリプトの英語名。 | `string` |
| `nativeScriptName` | そのロケールの言語でのスクリプト名。 | `string` |
| `maximizedCode` | `en-Latn-US` などの完全に展開されたロケールコード。 | `string` |
| `emoji` | ロケールのリージョンに対応する絵文字。 | `string` |
フィールドの完全な一覧については、[`LocaleProperties`](/docs/platform/core/reference/types/locale-properties) を参照してください。
## メモ [#notes]
* `useLocaleProperties` は同期的に動作し、サーバーコンポーネントとクライアントコンポーネントの両方で使えます。
* アクティブなロケールを取得するには、[`useLocale`](/docs/react/reference/hooks/use-locale) を使用します。