# General Translation Platform: isSupersetLocale
URL: https://generaltranslation.com/ja/docs/platform/core/reference/gt-class-methods/locales/is-superset-locale.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: あるロケールが、より具体的な別のロケールを包含できるかどうかを確認します。isSupersetLocale の API リファレンス。

[GT](/docs/platform/core/reference/gt-class/constructor) インスタンスで、BCP-47 の階層において、あるロケールが別のロケールの上位集合かどうかを確認します。上位集合のロケールは、より一般的で、より具体的なロケールの fallback として利用できます。General Translation はこれを使って、ロケールの fallback チェーンを判断します。

## 概要 [#overview]

[`GT`](/docs/platform/core/reference/gt-class/constructor) インスタンスに対して、上位集合ロケール候補と下位集合ロケール候補を指定して `isSupersetLocale` を呼び出します。最初のロケールが 2 番目のロケールの上位集合ロケールである場合は、`true` を返します。

```typescript
const gt = new GT();

console.log(gt.isSupersetLocale('en', 'en-US')); // true
console.log(gt.isSupersetLocale('en-US', 'en')); // false
```

シグネチャ:

```typescript
isSupersetLocale(superLocale: string, subLocale: string): boolean
```

*注: `isSupersetLocale` はローカルで実行されるため、APIキーは不要です。`GT` インスタンスを使用しない比較については、スタンドアロン版の [`isSupersetLocale`](/docs/platform/core/reference/utility-functions/locales/is-superset-locale) を参照してください。*

## 仕組み [#how-it-works]

* **BCP-47 階層。** 比較には BCP-47 のロケール階層を使用します。
* **反射性。** ロケールは常にそれ自体の上位集合です。
* **基本言語。** 基本言語はその地域バリアントの上位集合ですが、地域バリアントはその基本言語の上位集合ではありません。
* **異なる言語。** 完全に異なる言語の場合は `false` を返します。

## パラメータ [#parameters]

| パラメータ                          | 説明                 | 型        | 任意  | デフォルト |
| ------------------------------ | ------------------ | -------- | --- | ----- |
| [`superLocale`](#super-locale) | 上位集合として確認するロケール。 | `string` | いいえ | —     |
| [`subLocale`](#sub-locale)     | 下位集合として確認するロケール。 | `string` | いいえ | —     |

### `superLocale` [#super-locale]

**型** `string` · **必須**

上位集合 (より一般的なロケール) として確認するロケールです。

### `subLocale` [#sub-locale]

**型** `string` · **必須**

下位集合 (より具体的なロケール) としてチェックするロケール。

## 戻り値 [#returns]

**型** `boolean`

`superLocale` が `subLocale` の上位集合であれば `true`、そうでなければ `false`。

## 例 [#examples]

```typescript
const gt = new GT();

// 基本言語は地域バリアントの上位集合
console.log(gt.isSupersetLocale('en', 'en-US')); // true
console.log(gt.isSupersetLocale('es', 'es-ES')); // true
console.log(gt.isSupersetLocale('zh', 'zh-CN')); // true

// 地域バリアントは基本言語の上位集合ではない
console.log(gt.isSupersetLocale('en-US', 'en')); // false
console.log(gt.isSupersetLocale('es-ES', 'es')); // false

// 同じロケール
console.log(gt.isSupersetLocale('en-US', 'en-US')); // true

// 異なる言語
console.log(gt.isSupersetLocale('en', 'es-ES')); // false
```

## メモ [#notes]

* 比較には BCP-47 のロケール階層を使用します。
* ロケールは常にそれ自体の上位集合です。
* 基本言語は、その地域バリアントの上位集合です。
* まったく異なる言語に対しては `false` を返します。

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
