# General Translation Platform: isSameDialect
URL: https://generaltranslation.com/en-US/docs/platform/core/reference/utility-functions/locales/is-same-dialect.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Check whether two locales represent the same dialect without a GT instance. API reference for isSameDialect.

[`isSameDialect`](/docs/platform/core/reference/gt-class-methods/locales/is-same-dialect) is a standalone utility function from General Translation's Core library that checks whether multiple BCP-47 locale codes represent the same dialect.

## Overview [#overview]

Import `isSameDialect` directly from `generaltranslation` and call it with two or more locale codes. It does not require an API key or a [GT](/docs/platform/core/reference/gt-class/constructor) instance. For the instance-based equivalent, use the [`isSameDialect`](/docs/platform/core/reference/gt-class-methods/locales/is-same-dialect) method on a [`GT`](/docs/platform/core/reference/gt-class/constructor) instance instead.

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

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

Signature:

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

## How it works [#how-it-works]

- **Dialect comparison.** Considers base languages as parents of their regional variants, so a base language matches any of its regional dialects. Regional variants must match exactly.
- **Variadic input.** Accepts a variable number of arguments, each of which may be a locale string or an array of locale strings.

## Parameters [#parameters]

| Parameter | Description | Type | Optional | Default |
| --- | --- | --- | --- | --- |
| [`locales`](#locales) | Two or more locale codes to compare. | `(string \| string[])[]` | No | — |

### `locales` [#locales]

**Type** `(string | string[])[]` · **Required**

The rest parameter of locale codes to compare. Each argument may be a locale string or an array of locale strings.

## Returns [#returns]

**Type** `boolean`

`true` if all locale codes represent the same dialect, `false` otherwise.

## Examples [#examples]

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

console.log(isSameDialect('en-US', 'en-US')); // true
console.log(isSameDialect('en', 'en-US')); // true (base language matches regional)
console.log(isSameDialect('en-US', 'en-GB')); // false (different regions)
console.log(isSameDialect('en-US', 'es-ES')); // false (different languages)
```

## Notes [#notes]

- Considers base languages as parents of regional variants.
- Regional variants must match exactly.
- Essential for locale fallback logic.
- Accepts flexible input formats.
- No external dependencies.

## Sitemap

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