# General Translation React SDKs (gt-react, gt-next, gt-react-native): getGT
URL: https://generaltranslation.com/it/docs/react/tanstack-start/reference/functions/get-gt.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Traduci stringhe autonome nel runtime di TanStack Start con General Translation. Riferimento API per getGT.

La funzione `getGT` restituisce in modo asincrono una funzione sincrona per la traduzione delle stringhe per la richiesta server corrente o il browser. Importala da `gt-tanstack-start`.

## Panoramica [#overview]

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

const gt = await getGT();
const label = gt('Submit');
```

```ts
getGT(messages?: Message[]): Promise<GTFunctionType>
```

## Parametri [#parameters]

| Parametro  | Descrizione                                                                                                                                            | Tipo        | Facoltativo | Predefinito |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- | ----------- | ----------- |
| `messages` | Messaggi forniti dal compilatore da precaricare per l&#39;hot reload durante lo sviluppo. Nella maggior parte dei casi, questo parametro viene omesso. | `Message[]` | Sì          | —           |

## Come funziona [#how-it-works]

Sul server, `getGT` legge l&#39;impostazione regionale e l&#39;impostazione di internazionalizzazione create da [`gtMiddleware`](/docs/react/tanstack-start/reference/functions/gt-middleware). Nel browser, legge il condition store inizializzato da [`initializeGT`](/docs/react/reference/config#initialize). Prepara le traduzioni in modo asincrono, quindi restituisce una funzione che traduce le stringhe sorgente in modo sincrono.

Le chiamate sul server generano un&#39;eccezione al di fuori di un ambito di richiesta middleware attivo.

## Restituisce [#returns]

**Tipo** `Promise<(content: string, options?: GTTranslationOptions) => string>`

La funzione restituita accetta variabili di interpolazione e [`GTTranslationOptions`](/docs/react/reference/types/inline-translation-options), ad esempio `$context`, `$id` e `$maxChars`.

## Esempio [#example]

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

export const loadTitle = createServerFn({ method: 'GET' }).handler(async () => {
  const gt = await getGT();
  return gt('Impostazioni account');
});
```

## Sitemap

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