# generaltranslation: General Translation Core SDK: getLocaleProperties URL: https://generaltranslation.com/ja/docs/core/class/methods/locales/get-locale-properties.mdx --- title: getLocaleProperties description: GT の getLocaleProperties メソッドの API リファレンス --- ## 概要 `getLocaleProperties` メソッドは、ロケールコードに関する包括的なプロパティを取得し、 表示名、地域コード、スクリプト情報、絵文字フラグなどの詳細な情報を提供します。 国際化されたリッチなユーザーインターフェースの構築に必要なすべてのデータを含む、完全な `LocaleProperties` オブジェクトを返します。 ```typescript const gt = new GT({ sourceLocale: 'en', targetLocale: 'es' }); const props = gt.getLocaleProperties('fr-CA'); console.log(props.name); // "French (Canada)" console.log(props.nativeName); // "français (Canada)" console.log(props.emoji); // "🇨🇦" ``` *** ## リファレンス ### パラメーター ### パラメータの説明 | パラメータ | 説明 | | -------- | ---------------------------------------------------------------------- | | `locale` | プロパティを取得する対象の BCP-47 ロケールコードです。指定しない場合は、インスタンスの `targetLocale` が使用されます | ### 戻り値 `LocaleProperties` - すべてのロケール情報を含む包括的なオブジェクト: * `code`: 標準化されたロケールコード * `name`: ソースロケールでの表示名 * `nativeName`: そのロケールでの表示名 * `languageCode`, `languageName`, `nativeLanguageName`: 言語情報 * `regionCode`, `regionName`, `nativeRegionName`: 地域情報 * `scriptCode`, `scriptName`, `nativeScriptName`: スクリプト情報 * `maximizedCode`, `minimizedCode`: 正規化された形式 * `nameWithRegionCode`, `nativeNameWithRegionCode`: 結合された表示形式 * `emoji`: 旗または代表的な絵文字 ### スローされる例外 * `Error` - ロケールが指定されておらず、かつインスタンスに `targetLocale` が設定されていない場合 *** ## 使用例 ### 基本的な使い方 ```typescript const gt = new GT({ sourceLocale: 'en', targetLocale: 'fr' }); // ターゲットロケールのプロパティを取得 const props = gt.getLocaleProperties(); console.log(props.name); // "French (France)" console.log(props.nativeName); // "français (France)" console.log(props.languageCode); // "fr" console.log(props.regionCode); // "FR" console.log(props.emoji); // "🇫🇷" // 他のロケールのプロパティを取得 const germanProps = gt.getLocaleProperties('de-AT'); console.log(germanProps.name); // "Austrian German" console.log(germanProps.nativeName); // "Österreichisches Deutsch" console.log(germanProps.regionName); // "Austria" console.log(germanProps.nativeRegionName); // "Österreich" ``` *** ## 注意点 * 表示名はすべて、インスタンスの`sourceLocale`設定に従います * カスタムマッピングのプロパティは、標準の Intl API より優先されます ## 次のステップ * [`LocaleProperties`](/docs/core/types/locale-properties) インターフェースを確認 * [`getLocaleName`](/docs/core/class/methods/locales/get-locale-name) でシンプルなロケール名を取得 * [`getLocaleEmoji`](/docs/core/class/methods/locales/get-locale-emoji) でロケールの絵文字を取得 * [`CustomMapping`](/docs/core/types/custom-mapping) 型について学ぶ