# react-native: useLocale URL: https://generaltranslation.com/en-GB/docs/react-native/api/helpers/use-locale.mdx --- title: useLocale description: API reference for the useLocale hook --- {/* AUTO-GENERATED: Do not edit directly. Edit the template in content/docs-templates/ instead. */} ## Overview The `useLocale` hook retrieves the user's current locale from the [`` context](/docs/react-native/api/components/gtprovider). The locale is returned as a BCP 47 [locale code](/docs/core/locales), e.g. `'en-US'`. `useLocale` is a client-side hook and *can only be used on client-side components*. Ensure your app is wrapped in a [``](/docs/react-native/api/components/gtprovider). ## Reference ### Returns A string representing the user's current locale, for example, `'en-US'`. *** ## Fallback behaviour When an unsupported locale is requested, a fallback locale will be selected. For instance, if an unsupported locale is requested, and (1) the user has configured multiple preferred locales in their browser settings, and (2) one of these locales is supported by your application, then the locale will fall back to the best match. Additionally, if no fallback locales are available, but two locales share the same language (e.g., `en-US` and `en-GB`), then the locale will fall back to the supported locale that shares the same language. If neither condition can be met, the default locale will be used. See the [`gt.config.json`](/docs/react-native/api/config/gt-config-json) docs for information on configuring supported locales. *** ## Examples ### Basic usage Retrieve the current locale and display it in your component. ```jsx title="CurrentLocale.jsx" copy 'use client'; import { useLocale } from 'gt-react-native'; export default function CurrentLocale() { const locale = useLocale(); // [!code highlight] return

Current locale: {locale}

; } ``` *** ## Notes * The `useLocale` hook relies on the [``](/docs/react-native/api/components/gtprovider) to access the context. Ensure your app is wrapped with a provider at the root level. * `useLocale` is client-side only. * Learn more about locale codes [here](/docs/core/locales). ## Next steps * Learn how to manage and specify supported locales in your application with the [`gt.config.json`](/docs/react-native/api/config/gt-config-json) file.