# General Translation React SDKs (gt-react, gt-next, gt-react-native): getLocale
URL: https://generaltranslation.com/en-US/docs/react/tanstack-start/reference/functions/get-locale.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Read the current TanStack Start runtime locale with General Translation. API reference for getLocale.

The `getLocale` function returns the locale associated with the current server request or browser as a BCP 47 locale code. Import it from `gt-tanstack-start`.

## Overview [#overview]

```ts
import { getLocale } from 'gt-tanstack-start';

const locale = getLocale(); // 'en-US'
```

```ts
getLocale(): string
```

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

On the server, `getLocale` reads the request-local value created by [`gtMiddleware`](/docs/react/tanstack-start/reference/functions/gt-middleware). With `localeRouting` enabled, the middleware resolves the locale from the path prefix, then the locale cookie, the `Accept-Language` header, and `defaultLocale`. Without locale routing, resolution starts with the cookie.

In the browser, it reads the condition store initialized by [`initializeGT`](/docs/react/reference/config#initialize). The function is synchronous. Server calls throw outside an active middleware request scope.

<Callout type="info">
  **Changed in v11:** use `getLocale()` instead of the deprecated `parseLocale()`, and import runtime helpers from `gt-tanstack-start` instead of `gt-tanstack-start/server`.
</Callout>

## Returns [#returns]

**Type** `string`

The current request locale.

## Example [#example]

```ts
import { createServerFn } from '@tanstack/react-start';
import { getLocale } from 'gt-tanstack-start';

export const loadLocale = createServerFn({ method: 'GET' }).handler(() => {
  return getLocale();
});
```

## Sitemap

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