# General Translation React SDKs (gt-react, gt-next): useSetLocale URL: https://generaltranslation.com/en-US/docs/react/reference/hooks/use-set-locale.mdx --- title: useSetLocale description: Change the active locale with General Translation gt-react. API reference for useSetLocale. --- The `useSetLocale` hook returns a function that changes the active locale. It is client-side only. *Available in `gt-react`, `gt-next`, `gt-tanstack-start`, and `gt-react-native`. Examples import from `gt-react`; import from your framework's package instead.* ## Overview [#overview] Call `useSetLocale` to get the setter, then call it with a locale code. ```tsx import { useSetLocale } from 'gt-react'; export default function LocaleButton() { const setLocale = useSetLocale(); return ; } ``` *Note: `useSetLocale` is client-side only.* ## How it works [#how-it-works] Calling the returned function persists the chosen locale in a cookie and reloads the page so the new locale's translations are applied. ## Returns [#returns] **Type** `(locale: string) => void` A function that sets the active locale to the given code. ## Notes [#notes] - `useSetLocale` is client-side only. - To read the active locale, use [`useLocale`](/docs/react/reference/hooks/use-locale). For a ready-made switcher, use [``](/docs/react/reference/components/locale-selector).