# General Translation Platform: isSupersetLocale URL: https://generaltranslation.com/ja/docs/platform/core/reference/utility-functions/locales/is-superset-locale.mdx --- title: isSupersetLocale description: GT インスタンスなしで、あるロケールが別のより具体的なロケールを表現できるかどうかを確認します。isSupersetLocale の API リファレンス。 --- [`isSupersetLocale`](/docs/platform/core/reference/gt-class-methods/locales/is-superset-locale) は、General Translation のコアライブラリに含まれるスタンドアロンのユーティリティ関数で、あるロケールが BCP-47 の階層において別のロケールの上位集合かどうか、つまり、より具体的なロケールを表現できるかどうかを確認します。 ## 概要 [#overview] `generaltranslation` から `isSupersetLocale` を直接インポートし、上位ロケールと下位ロケールを渡して呼び出します。これには API Key も [GT](/docs/platform/core/reference/gt-class/constructor) インスタンスも必要ありません。インスタンスベースの同等の機能を使う場合は、代わりに [`GT`](/docs/platform/core/reference/gt-class/constructor) インスタンスの [`isSupersetLocale`](/docs/platform/core/reference/gt-class-methods/locales/is-superset-locale) メソッドを使用してください。 ```typescript import { isSupersetLocale } from 'generaltranslation'; console.log(isSupersetLocale('en', 'en-US')); // true console.log(isSupersetLocale('en-US', 'en')); // false ``` シグネチャ: ```typescript isSupersetLocale(superLocale: string, subLocale: string): boolean ``` ## 仕組み [#how-it-works] * **階層チェック。** BCP-47 のロケール階層を使用します。`subLocale` は、`superLocale` の拡張であるか、`superLocale` と同一である場合、`superLocale` の部分集合です。 * **基本言語。** 基本言語はそのリージョン別バリアントの上位集合ですが、リージョン別バリアントは基本言語の上位集合ではありません。 * **反射律。** ロケールは常にそれ自体の上位集合です。 ## パラメータ [#parameters] | パラメータ | 説明 | 型 | 任意 | デフォルト | | ------------------------------ | ------------------- | -------- | --- | ----- | | [`superLocale`](#super-locale) | 上位集合の候補として確認するロケール。 | `string` | いいえ | — | | [`subLocale`](#sub-locale) | 下位集合の候補として確認するロケール。 | `string` | いいえ | — | ### `superLocale` [#super-locale] **型** `string` · **必須** 上位集合の候補として確認するロケール。 ### `subLocale` [#sub-locale] **型** `string` · **必須** 部分集合候補として確認するロケール。 ## 戻り値 [#returns] **Type** `boolean` `superLocale` が `subLocale` の上位集合である場合は `true`、それ以外は `false` です。 ## 例 [#examples] ```typescript import { isSupersetLocale } from 'generaltranslation'; // 基本言語はリージョン別バリアントの上位集合である console.log(isSupersetLocale('en', 'en-US')); // true console.log(isSupersetLocale('es', 'es-ES')); // true // リージョン別バリアントは基本言語の上位集合ではない console.log(isSupersetLocale('en-US', 'en')); // false // ロケールは常に自身の上位集合である console.log(isSupersetLocale('en-US', 'en-US')); // true ``` ## メモ [#notes] * BCP-47 のロケール階層を使用します。 * 基本言語はリージョン別バリアントの上位集合です。 * ロケールは常にそれ自体の上位集合です。 * フォールバックシステムの構築に不可欠です。