# General Translation Platform: isSameDialect
URL: https://generaltranslation.com/ja/docs/platform/core/reference/utility-functions/locales/is-same-dialect.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: GT インスタンスを使わずに、2 つのロケールが同じ方言を表しているかどうかを確認します。isSameDialect の API リファレンス。

[`isSameDialect`](/docs/platform/core/reference/gt-class-methods/locales/is-same-dialect) は、General Translation の Core library に含まれるスタンドアロンのユーティリティ関数で、複数の BCP-47 ロケールコードが同じ方言を表すかどうかを判定します。

## 概要 [#overview]

`generaltranslation` から `isSameDialect` を直接インポートし、2 つ以上のロケールコードを指定して呼び出します。API Key や [GT](/docs/platform/core/reference/gt-class/constructor) インスタンスは必要ありません。インスタンスベースの同等機能を使う場合は、[`GT`](/docs/platform/core/reference/gt-class/constructor) インスタンスの [`isSameDialect`](/docs/platform/core/reference/gt-class-methods/locales/is-same-dialect) メソッドを使用してください。

```typescript
import { isSameDialect } from 'generaltranslation';

console.log(isSameDialect('en', 'en-US')); // true
console.log(isSameDialect('en-US', 'en-GB')); // false
```

シグネチャ:

```typescript
isSameDialect(...locales: (string | string[])[]): boolean
```

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

* **方言の比較。** 基本言語はそのリージョン別バリアントの親として扱われるため、基本言語は対応するどのリージョン方言にも一致します。リージョン別バリアントは完全一致である必要があります。
* **可変長入力。** 可変個の引数を受け付けます。各引数には、ロケール文字列 または ロケール文字列 の array を指定できます。

## パラメータ [#parameters]

| パラメータ                 | 説明                      | 型                        | 任意  | デフォルト |
| --------------------- | ----------------------- | ------------------------ | --- | ----- |
| [`locales`](#locales) | 比較対象のロケールコードを2つ以上指定します。 | `(string \| string[])[]` | いいえ | —     |

### `locales` [#locales]

**型** `(string | string[])[]` · **必須**

比較対象のロケールコードを受け取る可変長引数です。各引数には、ロケール文字列またはロケール文字列の配列を指定できます。

## 戻り値 [#returns]

**型** `boolean`

すべてのロケールコードが同じ方言を表す場合は `true`、それ以外の場合は `false` です。

## 例 [#examples]

```typescript
import { isSameDialect } from 'generaltranslation';

console.log(isSameDialect('en-US', 'en-US')); // true
console.log(isSameDialect('en', 'en-US')); // true（基本言語がリージョン方言と一致）
console.log(isSameDialect('en-US', 'en-GB')); // false（リージョンが異なる）
console.log(isSameDialect('en-US', 'es-ES')); // false（言語が異なる）
```

## メモ [#notes]

* 基本言語をリージョン別バリアントの親として扱います。
* リージョン別バリアントは完全に一致している必要があります。
* ロケールのfallbackロジックに不可欠です。
* 柔軟な入力形式に対応しています。
* 外部依存関係はありません。

## Sitemap

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