# General Translation React SDKs (gt-react, gt-next, gt-react-native): getGT
URL: https://generaltranslation.com/it/docs/react/nextjs/reference/functions/get-gt.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Traduci stringhe autonome nei componenti asincroni dell’App Router di Next.js con General Translation. Riferimento API per getGT.

La funzione `getGT` restituisce una funzione asincrona per la traduzione delle stringhe per la richiesta corrente dell’App Router. Importala da `gt-next/server` quando un componente asincrono non può usare [`useGT`](/docs/react/reference/hooks/use-gt).

`getGT` è disponibile solo sul server e non funziona con il Pages Router.

## Panoramica [#overview]

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

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

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

* **Traduzione in fase di build.** Le traduzioni di produzione vengono preparate prima della distribuzione e caricate in base all&#39;impostazione regionale della richiesta corrente.
* **Traduzione di sviluppo.** Una chiave API di sviluppo abilita la traduzione su richiesta durante lo sviluppo.
* **Stringhe sorgente statiche.** Passa stringhe letterali affinché il compilatore possa estrarle.
* **Variabili.** I valori interpolati vengono inseriti dopo la traduzione e non vengono tradotti.

## Restituisce [#returns]

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

La funzione restituita traduce una stringa sorgente e accetta variabili di interpolazione, oltre a [`GTTranslationOptions`](/docs/react/reference/types/inline-translation-options), come `$context`, `$id` e `$maxChars`.

## Esempio [#example]

```tsx title="app/contact/page.tsx"
import { getGT } from 'gt-next/server';

export default async function ContactPage() {
  const gt = await getGT();
  return <input aria-label={gt('Email address')} />;
}
```

## Sitemap

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