# 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 --- title: getLocale description: Read the current TanStack Start server request locale with General Translation. API reference for getLocale. --- The `getLocale` function returns the locale associated with the current server request as a BCP 47 locale code. Import it from `gt-tanstack-start/server`. ## Overview [#overview] ```ts import { getLocale } from 'gt-tanstack-start/server'; const locale = getLocale(); // 'en-US' ``` ```ts getLocale(): string ``` ## How it works [#how-it-works] `getLocale` reads the request-local value created by [`gtMiddleware`](/docs/react/tanstack-start/reference/functions/gt-middleware). The middleware resolves the locale from the configured cookie and request headers, then falls back to the default locale. The function is synchronous and throws when called outside an active middleware request scope. ## Returns [#returns] **Type** `string` The current request locale. ## Example [#example] ```ts import { createServerFn } from '@tanstack/react-start'; import { getLocale } from 'gt-tanstack-start/server'; export const loadLocale = createServerFn({ method: 'GET' }).handler(() => { return getLocale(); }); ```