# General Translation React SDKs (gt-react, gt-next, gt-react-native): getMessages
URL: https://generaltranslation.com/en-US/docs/react/tanstack-start/reference/functions/get-messages.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Resolve registered messages in the TanStack Start runtime with General Translation. API reference for getMessages.

The `getMessages` function returns a resolver for strings registered with [`msg`](/docs/react/reference/functions/msg). Import it from `gt-tanstack-start`.

## Overview [#overview]

```ts
import { getMessages, msg } from 'gt-tanstack-start';

const status = msg('Ready');
const m = await getMessages();
const translated = m(status);
```

```ts
getMessages(): Promise<MessageTranslationFunction>
```

## How it works [#how-it-works]

On the server, `getMessages` reads the locale and internationalization setting created by [`gtMiddleware`](/docs/react/tanstack-start/reference/functions/gt-middleware). In the browser, it reads the condition store initialized by [`initializeGT`](/docs/react/reference/config#initialize). It resolves encoded messages against translations for the current runtime.

Server calls throw outside an active middleware request scope.

## Returns [#returns]

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

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

## Example [#example]

```ts
import { createServerFn } from '@tanstack/react-start';
import { getMessages, msg } from 'gt-tanstack-start';

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

export const loadStatus = createServerFn({ method: 'GET' }).handler(
  async () => {
    const m = await getMessages();
    return m(STATUS.active);
  }
);
```

## Sitemap

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