# General Translation Platform: isSameLanguage URL: https://generaltranslation.com/en-US/docs/platform/core/reference/utility-functions/locales/is-same-language.mdx --- title: isSameLanguage description: Check whether two locales share the same base language without a GT instance. API reference for isSameLanguage. --- [`isSameLanguage`](/docs/platform/core/reference/gt-class-methods/locales/is-same-language) is a standalone utility function from General Translation's Core library that checks whether multiple BCP-47 locale codes represent the same base language, ignoring regional differences. ## Overview [#overview] Import `isSameLanguage` 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 [`isSameLanguage`](/docs/platform/core/reference/gt-class-methods/locales/is-same-language) method on a [`GT`](/docs/platform/core/reference/gt-class/constructor) instance instead. ```typescript import { isSameLanguage } from 'generaltranslation'; console.log(isSameLanguage('en-US', 'en-GB')); // true console.log(isSameLanguage('en-US', 'es-ES')); // false ``` Signature: ```typescript isSameLanguage(...locales: (string | string[])[]): boolean ``` ## How it works [#how-it-works] - **Base language comparison.** Compares only the base language codes (before the first hyphen), ignoring regional, script, and variant differences. - **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 base language, `false` otherwise. ## Examples [#examples] ```typescript import { isSameLanguage } from 'generaltranslation'; // Same language, different regions console.log(isSameLanguage('en-US', 'en-GB')); // true console.log(isSameLanguage('es-ES', 'es-MX')); // true console.log(isSameLanguage('zh-CN', 'zh-TW')); // true // Different languages console.log(isSameLanguage('en-US', 'es-ES')); // false console.log(isSameLanguage('fr-FR', 'de-DE')); // false ``` ## Notes [#notes] - Compares only base language codes (before the first hyphen). - Ignores regional, script, and variant differences. - Essential for language-based content organization. - Works with a variable number of parameters.