# General Translation React SDKs (gt-react, gt-next, gt-react-native): useLocales
URL: https://generaltranslation.com/en-US/docs/react/reference/hooks/use-locales.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: List the supported locales. API reference for useLocales.

The `useLocales` hook returns the locale codes your app supports as an array of strings, read from the [`<GTProvider>`](/docs/react/reference/components/gt-provider) context. Use it to render or iterate the available locales, such as when building a custom language switcher.

*Available in `gt-react`, `gt-next`, `gt-tanstack-start`, and `gt-react-native`.*

## Overview [#overview]

Call `useLocales` to read the supported locale codes.

*Examples import from `gt-react`; import from your framework's package instead.*

```tsx
import { useLocales } from 'gt-react';

export default function LocaleList() {
  const locales = useLocales(); // [!code highlight]
  return (
    <ul>
      {locales.map((locale) => (
        <li key={locale}>{locale}</li>
      ))}
    </ul>
  );
}
```

*Note: In `gt-react`, call `useLocales` under a [`<GTProvider>`](/docs/react/reference/components/gt-provider). In `gt-next`, it also works in server components.*

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

The list comes from the [`locales`](/docs/react/reference/config#locales) you configure. Each entry is a BCP 47 locale code.

## Returns [#returns]

**Type** `readonly string[]`

An array of supported locale codes, such as `['en-US', 'fr', 'ja']`.

## Notes [#notes]

- `useLocales` is synchronous and works in server and client components.
- To read the active locale, use [`useLocale`](/docs/react/reference/hooks/use-locale).

## Sitemap

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