# General Translation React SDKs (gt-react, gt-next, gt-react-native): registerLocale
URL: https://generaltranslation.com/en-US/docs/react/nextjs/reference/functions/register-locale.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Register a locale for Next.js App Router server code with General Translation. API reference for registerLocale.

The `registerLocale` function sets the locale for the current App Router request context. Use it in Route Handlers and metadata image handlers where `next/root-params` is unavailable. See [Registering request locales](/docs/react/nextjs/registering-request-locales) for handler examples.

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

## Overview [#overview]

Call `registerLocale` before any other `gt-next` server function in the request handler.

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

registerLocale('fr');
```

## Parameters [#parameters]

| Parameter | Description | Type | Optional | Default |
| --- | --- | --- | --- | --- |
| `locale` | Locale to register for the current request. | `string` | No | — |

Unsupported locale values fall back according to your General Translation locale configuration.

## Returns [#returns]

**Type** `void`

## Example [#example]

```tsx title="app/[locale]/opengraph-image.tsx"
import { ImageResponse } from 'next/og';
import { getGT, registerLocale } from 'gt-next/server';

export default async function Image({ params }) {
  const { locale } = await params;
  registerLocale(locale);

  const gt = await getGT();
  return new ImageResponse(<div>{gt('Welcome')}</div>);
}
```

## Sitemap

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