# General Translation React SDKs (gt-react, gt-next, gt-react-native): getMessages
URL: https://generaltranslation.com/en-US/docs/react/nextjs/reference/functions/get-messages.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Resolve encoded messages in asynchronous Next.js App Router components with General Translation. API reference for getMessages.

The `getMessages` function returns an asynchronous resolver for strings registered with [`msg`](/docs/react/reference/functions/msg). Import it from `gt-next/server` when an async component cannot use [`useMessages`](/docs/react/reference/hooks/use-messages).

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

## Overview [#overview]

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

const greeting = msg('Hello, world!');
const m = await getMessages();
const translated = m(greeting);
```

## Returns [#returns]

**Type** `Promise<(encodedContent: string, options?: object) => string>`

The resolved function translates encoded content for the current request locale. Variables passed when calling [`msg`](/docs/react/reference/functions/msg) take precedence over variables passed to the resolver.

## Example [#example]

```tsx title="app/status/page.tsx"
import { msg } from 'gt-next';
import { getMessages } from 'gt-next/server';

const STATUS = {
  active: msg('Active'),
  paused: msg('Paused'),
};

export default async function StatusPage() {
  const m = await getMessages();
  return <p>{m(STATUS.active)}</p>;
}
```

## Sitemap

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