# 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 --- title: getGT description: Traduci stringhe autonome nelle funzioni server di TanStack Start con General Translation. Riferimento API per getGT. --- La funzione `getGT` restituisce una funzione sincrona per la traduzione delle stringhe per la richiesta server corrente. Importala da `gt-tanstack-start/server`. ## Panoramica [#overview] ```ts import { getGT } from 'gt-tanstack-start/server'; const gt = await getGT(); const label = gt('Submit'); ``` ```ts getGT(messages?: Message[]): Promise ``` ## Parametri [#parameters] | Parametro | Descrizione | Tipo | Facoltativo | Predefinito | | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- | ----------- | ----------- | | `messages` | Messaggi forniti dal compilatore da precaricare per l'hot reload durante lo sviluppo. Nella maggior parte dei casi, questo parametro viene omesso. | `Message[]` | Sì | — | ## Come funziona [#how-it-works] `getGT` legge l'impostazione regionale e l'impostazione di internazionalizzazione create da [`gtMiddleware`](/docs/react/tanstack-start/reference/functions/gt-middleware). Prepara le traduzioni in modo asincrono, quindi restituisce una funzione che traduce le stringhe sorgente in modo sincrono. La funzione genera un'eccezione se viene chiamata 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/server'; export const loadTitle = createServerFn({ method: 'GET' }).handler(async () => { const gt = await getGT(); return gt('Account settings'); }); ```