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

The `getTranslations` function returns a dictionary lookup function for the current server request or browser. Import it from `gt-tanstack-start`.

## Overview [#overview]

```ts
import { getTranslations } from 'gt-tanstack-start';

const t = await getTranslations('account');
const heading = t('heading');
```

```ts
getTranslations(rootId?: string): Promise<DictionaryTranslationFunction>
```

## Parameters [#parameters]

| Parameter | Description | Type | Optional | Default |
| --- | --- | --- | --- | --- |
| `rootId` | Prefix applied to each dictionary id. | `string` | Yes | — |

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

On the server, `getTranslations` 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). The optional `rootId` scopes every lookup under one dictionary path.

Server calls throw outside an active middleware request scope. Looking up an unknown dictionary id also throws.

## Returns [#returns]

**Type** `Promise<(id: string, options?: DictionaryTranslationOptions) => string>`

The resolved function accepts [`DictionaryTranslationOptions`](/docs/react/reference/types/dictionary-translation-options) and exposes `.obj(id)` for nested dictionary objects.

## Example [#example]

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

export const loadHeading = createServerFn({ method: 'GET' }).handler(
  async () => {
    const t = await getTranslations('account');
    return t('heading');
  }
);
```

## Sitemap

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