# General Translation React SDKs (gt-react, gt-next, gt-react-native): getLocaleDirection
URL: https://generaltranslation.com/en-US/docs/react/nextjs/reference/functions/get-locale-direction.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Read the text direction for a Next.js App Router locale with General Translation. API reference for getLocaleDirection.

The `getLocaleDirection` function returns `'ltr'` or `'rtl'` for the current request locale or a locale you provide. Import it from `gt-next/server` in App Router server code.

`getLocaleDirection` is server-only and does not work with the Pages Router.

## Overview [#overview]

```tsx
import { getLocaleDirection } from 'gt-next/server';

const currentDirection = await getLocaleDirection();
const arabicDirection = getLocaleDirection('ar'); // 'rtl'
```

## Parameters [#parameters]

| Parameter | Description | Type | Optional | Default |
| --- | --- | --- | --- | --- |
| `locale` | Locale whose text direction is returned. | `string` | Yes | Current request locale |

## Returns [#returns]

**Type** `'ltr' | 'rtl'` when `locale` is provided · `Promise<'ltr' | 'rtl'>` when omitted

Passing a locale returns synchronously. Omitting it resolves the current request locale asynchronously.

## Example [#example]

```tsx title="app/[locale]/layout.tsx"
import { getLocale, getLocaleDirection } from 'gt-next/server';

export default async function LocaleLayout({ children }) {
  const [locale, direction] = await Promise.all([
    getLocale(),
    getLocaleDirection(),
  ]);
  return <html lang={locale} dir={direction}>{children}</html>;
}
```

## Sitemap

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