# react-native: getLocaleDirection URL: https://generaltranslation.com/en-US/docs/react-native/api/helpers/get-locale-direction.mdx --- title: getLocaleDirection description: API reference for the getLocaleDirection server-side method --- {/* AUTO-GENERATED: Do not edit directly. Edit the template in content/docs-templates/ instead. */} ## Overview The `getLocaleDirection` function retrieves the text direction (`'ltr'` or `'rtl'`) for the current or a specified locale during server-side rendering. `getLocaleDirection` is a server-side method and can only be used in server components. For client-side usage, see [`useLocaleDirection`](/docs/react-native/api/helpers/use-locale-direction). ## Reference ### Parameters | Parameter | Type | Description | | --- | --- | --- | | `locale` | `string` (optional) | A BCP 47 locale code (e.g., `'ar'`, `'en-US'`). If omitted, the current user's locale is used. | ### Returns - If `locale` is provided: `'ltr' | 'rtl'` — the text direction for the specified locale. - If `locale` is omitted: `Promise<'ltr' | 'rtl'>` — a promise that resolves to the text direction for the current locale. --- ## Examples ### Get direction for the current locale ```jsx title="DirectionWrapper.jsx" copy import { getLocaleDirection } from 'gt-react-native/server'; export default async function DirectionWrapper({ children }) { const dir = await getLocaleDirection(); // [!code highlight] return
{children}
; } ``` ### Get direction for a specific locale ```jsx title="SpecificDirection.jsx" copy import { getLocaleDirection } from 'gt-react-native/server'; export default function SpecificDirection() { const dir = getLocaleDirection('ar'); // 'rtl' — no await needed [!code highlight] return

Arabic text direction: {dir}

; } ``` --- ## Notes - When called without arguments, `getLocaleDirection` is asynchronous and must be awaited. - When called with a locale string, it returns synchronously. - Useful for setting the `dir` attribute on your `` or layout elements for RTL support. ## Next steps - Learn about RTL support in the [right-to-left guide](/docs/react-native/guides/rtl). - See [`useLocaleDirection`](/docs/react-native/api/helpers/use-locale-direction) for the client-side equivalent.