# General Translation Overview: Uso degli agenti di coding
URL: https://generaltranslation.com/it/docs/overview/for-coding-agents.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Come usare agenti di coding IA e LLMs con General Translation, indirizzandoli al prompt iniziale, alla documentazione leggibile dalle macchine, al server MCP e alla nostra guida dell'agente pronta all'uso.

General Translation è progettato per funzionare con agenti di coding IA e LLMs. Le librerie sono open-source, la configurazione è prevedibile e la documentazione è pubblicata in formati leggibili dalle macchine. Un agente come Cursor, Claude Code o Copilot può aggiungere ed eseguire General Translation per te con un contesto accurato e aggiornato.

*Per una localizzazione completamente automatizzata che apra pull request in autonomia, usa invece il nostro agente dedicato [Locadex](/docs/platform/locadex/quickstart) anziché affidarti a un agente personalizzato.*

## Prompt iniziale [#start-prompt]

Il prompt seguente avvia una sessione con un agente che aggiunge General Translation al tuo progetto: l&#39;agente legge l&#39;entry point della documentazione, effettua l&#39;accesso con [`gt login`](/docs/cli/reference/commands/login), seleziona un progetto, implementa una prima traduzione e la verifica. [`gt login`](/docs/cli/reference/commands/login) è il modo in cui un agente interagisce con la piattaforma General Translation, per questo il prompt parte da questo comando anziché chiederti una chiave API. Il pulsante **Setup for Agents** su [generaltranslation.com](https://generaltranslation.com) copia esattamente questo testo, che è disponibile anche in forma non elaborata all&#39;indirizzo [`/agent-prompt.md`](/agent-prompt.md). Il comando [`init`](/docs/cli/reference/commands/init) indicato nel prompt è stato verificato con `gt` 2.24.0 su un progetto `create-next-app` appena creato: non richiede alcun input, installa `gt-next`, aggiunge [`GTProvider`](/docs/react/reference/components/gt-provider) al root layout e `withGTConfig` a `next.config.ts`, crea `loadTranslations.js` e `gt.config.json` e termina con un evento di successo.

````markdown title="agent-prompt.md"
# Get started with General Translation

I landed on https://generaltranslation.com and clicked "Setup for Agents". Help me add General Translation to my app, website, or content, and get a real translation working. Inspect the project you have access to, choose the appropriate integration with me, and implement it. Continue through setup, translation, and verification rather than stopping at a plan.

## About General Translation

General Translation (GT) combines open-source internationalization libraries, a translation CLI, and a hosted translation platform. Source content stays in your code or content files. The libraries render translations and format locale-sensitive values; the platform generates and manages translations. Locadex is an optional hosted agent that connects to GitHub and maintains localization through pull requests.

- Website: https://generaltranslation.com
- Dashboard: https://dash.generaltranslation.com
- Open-source libraries and CLI: https://github.com/generaltranslation/gt
- Documentation entry point: https://generaltranslation.com/llms.txt
- Complete documentation index: https://generaltranslation.com/llms-index.txt
- API specification: https://generaltranslation.com/openapi.yaml

Fetch the documentation entry point first, then the quickstart and references relevant to this project. Documentation pages are available as raw Markdown by appending `.mdx` to the page URL. Use the complete index when you need a page that is not in the curated index. Read current docs and installed command help instead of guessing APIs, flags, or framework setup. `gt auth` is not a command in current releases; use `gt login`. `gt generate` writes source templates without calling the API and is registered when the CLI detects `gt-next`, `gt-react`, `gt-react-native`, `gt-tanstack-start`, `gt-node`, `gt-vue`, `gt-flask`, or `gt-fastapi`. Use `gt translate` for hosted translation.

## Work with me

Read this entire prompt before acting. Respect the repository's instructions, package manager, architecture, design system, and existing changes.

First inspect the repository for the framework, router, app directory, existing i18n library, GT configuration, source language, and build scripts. In a monorepo, identify the specific app or content directory; do not run setup at the workspace root. Do not ask me things you can determine from the code.

If the intended project is unclear, ask one question: "What would you like to translate?" Offer concrete choices: this app or website, documentation or content files, a backend service, a connected content platform, or a small new demo. Include "Not sure, help me decide." Prefer your interactive question tool when available. If no repository is open, help me open one or choose a small demo before scaffolding anything.

Ask for missing decisions one at a time: source language, target languages, and the first page or workflow to translate. Preserve existing locale choices; do not assume the source language is English or invent target markets. If I want help choosing, propose one target language for the first working example. Reuse an existing i18n setup where appropriate instead of automatically migrating the entire application.

Explain the next meaningful step briefly, then do the work. Ask when a choice affects which organization/project you use, creates an unwanted duplicate, or changes the agreed scope. Once I have chosen the project, languages, and scope, proceed with the setup and translation needed for that outcome.

## Choose the right integration

Read the matching quickstart before making framework changes:

| Project | Integration | Quickstart |
| --- | --- | --- |
| Next.js App Router | `gt-next` | https://generaltranslation.com/docs/react/nextjs-quickstart.mdx |
| Next.js Pages Router | `gt-next` | https://generaltranslation.com/docs/react/nextjs-pages-router-quickstart.mdx |
| React SPA, including Vite | `gt-react` | https://generaltranslation.com/docs/react/react-spa-quickstart.mdx |
| Server-rendered React | `gt-react` | https://generaltranslation.com/docs/react/react-quickstart.mdx |
| TanStack Start | `gt-tanstack-start` | https://generaltranslation.com/docs/react/tanstack-start-quickstart.mdx |
| React Native or Expo | `gt-react-native` | https://generaltranslation.com/docs/react/react-native-quickstart.mdx |
| Vue | `gt-vue` | https://generaltranslation.com/docs/vue/quickstart.mdx |
| Node.js backend | `gt-node` | https://generaltranslation.com/docs/node/quickstart.mdx |
| Python backend | Follow the Python SDK guide | https://generaltranslation.com/docs/python/quickstart.mdx |
| JSON, MDX, Markdown, YAML, or existing translation files | `gt` CLI | https://generaltranslation.com/docs/cli/quickstart.mdx |
| Lower-level JavaScript translation | `generaltranslation` | https://generaltranslation.com/docs/platform/core/quickstart.mdx |

For Mintlify, Sanity, Storyblok, or Google Drive, fetch https://generaltranslation.com/docs/integrations/llms.txt and follow that integration's quickstart. Do not apply a React setup wizard to a content integration. If I want GT to continuously maintain localization through GitHub, read https://generaltranslation.com/docs/platform/locadex/quickstart.mdx and walk me through connecting the repository and creating the appropriate automation. Do not enable auto-merge or change paid plans without my direction.

## Run the CLI without questions

The CLI is interactive. When `init` or `configure` is missing an answer, it does not fail: it asks the question in the terminal and waits, with no timeout. In an agent session that wait never ends. So in this session:

- Always pass `--no-interactive`. With it, a missing answer is a hard error that lists the flags still needed and changes no file.
- Pass a flag for every question before you run the command. `--defaults` accepts the recommended local choices in one flag; you still need `--locales` and, outside local Vite and TanStack Start setups, `--dev-credentials` or `--no-dev-credentials`. Pass explicit `--default-locale`, `--locadex` or `--no-locadex`, `--react-setup` or `--no-react-setup`, and `--file-formats` values only when you want to override the defaults. Local Vite and TanStack Start setups default to `--no-live-translations`; pass `--live-translations` to opt in. Never combine the `--[no-]live-translations` and `--[no-]dev-credentials` flag families.
- Pass `--json` to `init` and `configure`. It implies `--no-interactive`, writes one result event to stdout and the rendered screen to stderr. `translate`, `upload`, `api`, `whoami`, `project create` and `api-key create` have no `--json` flag; `translate` prints a progress screen with terminal control sequences, so judge it by its exit code and by the files it writes: `public/_gt/<locale>.json`, `gt-lock.json` and `gt.config.json`.
- If a command prints a question and stops, you are inside an interactive prompt. End the process and rerun it with `--no-interactive` and the missing flag. Never type an answer into it, and never run a command whose questions you have not answered with flags.
- `gt login` is the one step that needs a person: it opens a browser and waits for the sign-in to finish. If no browser can open from this session, run it with `--no-browser`, give me the URL it prints, and wait for me to confirm. `translate`, `upload`, `api`, `whoami`, `project create` and `api-key create` ask nothing when their flags are complete; a missing required flag is an error.

## Sign in with `gt login`

Use account login for local CLI authentication. Do not begin by asking me to find and paste an API key.

The examples below use `npx gt@latest` to avoid an old local CLI. Use the project's package manager or a current installed `gt` binary when appropriate. Inspect the version and available commands first:

```bash
npm view gt version
npx gt@latest --help
npx gt@latest login --help
```

The CLI has no `--version` flag. `translate` prints "CLI Version: x.y.z" in its banner; `init --json` prints no banner. Read the published version with `npm view gt version` and the installed one from `node_modules/gt/package.json`.

This workflow requires a CLI release with `login`, `whoami`, and `api-key create`. If the installed CLI lacks them, check the latest published release. If they are still unavailable, explain the release blocker and continue with local integration work that does not require credentials. Do not silently substitute the older `gt auth` flow, invent flags, or install an unpublished branch into my project.

Check for an existing session with `npx gt@latest whoami`. If sign-in is needed, run:

```bash
npx gt@latest login
```

Let me complete signup/sign-in and authorization in the browser. Keep the command running while approval is pending. In a remote or headless terminal, use:

```bash
npx gt@latest login --no-browser
```

Show me the verification URL and code returned by that command; wait for successful authorization, then verify with `npx gt@latest whoami`. Do not ask for my password or extract OAuth tokens. Login authenticates the CLI; it does not by itself configure the app's project or create its runtime credentials.

## Select a project and create the credentials we need

Reuse an existing configured project if it is the intended one. Check for conflicting project IDs in configuration and environment variables without printing secret values. Do not overwrite existing credentials or create another key unnecessarily.

For a supported fresh app, run the setup wizard from the app directory after login, with every question answered by a flag. For a Next.js App Router app set up locally, with translations stored in the repository and an existing project reused:

```bash
npx gt@latest init --no-interactive --json --defaults \
  --default-locale <source-locale> --locales <target-locales> \
  --no-locadex --react-setup --file-formats none \
  --no-dev-credentials --project-id <project-id>
```

This run asks nothing, installs gt-next, adds GTProvider to the root layout, adds withGTConfig to next.config.ts, creates loadTranslations.js and gt.config.json, and ends with `{"type":"result","command":"init","outcome":"success"}`. The wizard does not wrap any page text in `<T>`, even though its completedSteps list says "wrapped JSX content". Internationalize every page yourself in step 4 of the implementation section. The wizard runs biome on the files it changes and may replace the project's indentation with tabs; restore the project's formatting. Ignore the warning "Unexpected export type in ./next.config.ts" when withGTConfig() was added correctly. Review the wizard's changes against the framework quickstart: automatic framework setup is experimental.

`--defaults` covers local storage and the translations directory; pass `--storage` and `--translations-dir` only for other values. `--no-dev-credentials --project-id <id>` writes projectId to gt.config.json and creates no env file. Use it when no development key is wanted. If you already have a development key, add `NEXT_PUBLIC_GT_PROJECT_ID` and `NEXT_PUBLIC_GT_DEV_API_KEY` to `.env.development.local` yourself. `--dev-credentials --project-id <id>` saves a new development key and the project ID to `.env.local` instead; `--create-project --org-id <id> --project-name <name>` creates the project first. `--no-react-setup` is for an app that already has the GT library; on an app without one it fails with "No GT runtime is installed, so select at least one file format to translate", which is right, since there would be nothing to translate. Pass `--locadex` only if we agreed to use hosted automation. Before a production build, move the development key (`NEXT_PUBLIC_GT_DEV_API_KEY` or `GT_DEV_API_KEY`) from `.env.local` to `.env.development.local`: `next dev` loads that file and `next build` does not, and a production build refuses to run with a development key present. A production build that ships local translation files needs no key.

If the app already has framework setup, configure it directly from the docs. Use the authenticated CLI to discover resources:

```bash
npx gt@latest api /v2/projects
npx gt@latest api /v2/orgs
```

Follow pagination when present by passing `nextCursor` as `?cursor=<value>`. `/v2/orgs` lists the organizations the signed-in user belongs to (an API key sees only its own). Creating a project also needs the `org:projects:create` permission in that organization; when `project create` is refused, ask me which organization to use or create the project in the Dashboard at https://dash.generaltranslation.com. Use actual returned IDs. Ask me to select when the destination is ambiguous. If my new account has no suitable organization, guide me through creating one at https://dash.generaltranslation.com, then retry discovery.

When a new project is needed in the chosen organization:

```bash
npx gt@latest project create \
  --org-id <selected-organization-id> \
  --name <agreed-project-name> \
  --default-locale <source-locale>
```

Use the returned project ID. `project create` may require an organization key; read `npx gt@latest project create --help` first and fall back to creating the project in the Dashboard. For endpoint details or a missing higher-level command, inspect `npx gt@latest api --spec` and the current API docs before making a request.

Local CLI operations can use the login session. Create separate project keys only where a runtime or unattended CI workflow needs one. Inspect `npx gt@latest api-key create --help` first. The command requires a key name and explicit permissions. A development runtime key needs `project:translations:generate`; a standard file translation workflow needs `project:files:read`, `project:files:write`, and `project:translations:enqueue`. Verify any additional operations against the API specification; do not grant every permission by default.

`gt api-key create` prints the secret once to stdout. Capture that output directly into protected, ignored local configuration or the intended secret store without displaying it in tool output, chat, or logs. Use `--project-id` for the selected project, `--name` for its purpose, and `--permission` for the required permissions. Confirm success and the variable names without showing the key.

Keep these credential roles distinct:

- CLI/CI and server credentials use `GT_API_KEY` and `GT_PROJECT_ID`. Never put `GT_API_KEY` in browser code or a public-prefixed variable.
- Development runtime translation uses `GT_DEV_API_KEY` and a project ID. Browser frameworks may need their documented public prefix, such as `VITE_GT_DEV_API_KEY`; for Next.js the wizard writes `NEXT_PUBLIC_GT_PROJECT_ID` and `NEXT_PUBLIC_GT_DEV_API_KEY`, and the CLI reads that project ID too, so `GT_PROJECT_ID` is only needed in CI. Only expose the narrowly scoped development key where the framework guide requires it; do not ship development credentials in production browser bundles.
- OAuth credentials belong in the CLI's credential store. Do not copy them into the app or CI.

Ensure local environment files are ignored by Git. Use placeholders in committed examples. Preserve unrelated environment settings. Logging in locally does not authenticate CI or a deployed server.

## Implement a complete first translation

1. Install the integration that matches the detected stack. For an existing project, make targeted changes and preserve its current behavior.
2. Create or update `gt.config.json` with the agreed source and target locales, source paths, and file mappings. Use the current configuration reference: https://generaltranslation.com/docs/cli/reference/config.mdx. Preserve existing settings. Configure translation output and loading together; for example, a Vite SPA's imported translation files must live within its source tree. Do not copy one framework's output path or provider setup into another framework. Add the translation output directory (for example `public/_gt/`) to `.gitignore` when translations are not committed.
3. Follow the framework's initialization and routing guide. Next.js App Router and Pages Router differ; React SPAs use `initializeGTSPA` before rendering; server runtimes need request-aware locale handling. Read the installed version's APIs before implementing them.
4. Internationalize the agreed page or workflow, including visible text, validation, placeholders, accessible labels, and metadata where relevant. In React, use `<T>` for coherent static JSX. For standalone strings in gt-next, use `useGT()` in client components and in synchronous server components, and `getGT()` from `gt-next/server` in async server components and in `generateMetadata`. `useGT()` returns the function directly. For Next.js metadata, replace the static `metadata` export with `export async function generateMetadata()` that calls `getGT()` from `gt-next/server` and returns the translated title and description. Use `<Var>` or the framework's interpolation API for dynamic values; keep private values out of translation source. Use locale-aware number, date, currency, and plural handling. Follow the matching Vue, Node, or Python APIs for those stacks.
5. Add a language switcher to a suitable place in an app's existing UI. In gt-next, `<LocaleSelector>` from `gt-next` renders directly inside a server component page; it carries its own client boundary. Give it an `aria-label` through `useGT()`. Preserve navigation and verify the selected locale survives navigation or reload as documented. For a backend or content-only project, verify locale selection and translated output through its actual API or content workflow instead.
6. Add useful context for ambiguous copy. Use the `context` prop on `<T>` and the `$context` option in `gt()` and `getGT()` calls. `$context` on `<T>` is a deprecated alias that the CLI flags when it scans the source. Preserve product names and terminology. Do not send secrets or runtime user data as translation source. For content files, preserve frontmatter, links, variables, and formatting according to the format guide.
7. Inspect the translation scope with `npx gt@latest translate --dry-run`, then run `npx gt@latest translate` for the agreed languages and scope. If this would unexpectedly translate a large corpus or exceed the agreed scope, clarify that before submitting it. `gt translate` also writes `gt-lock.json` and a `_versionId` into `gt.config.json`; commit both. Use the connected-platform workflow instead when the integration requires one.

## Verify and finish

Esegui il controllo dei tipi (`npx tsc --noEmit`) e la build di produzione (`next build`). Esegui lint e test solo se il progetto li prevede già. Avvia l'app e verifica l'esperienza tradotta reale quando sono disponibili strumenti per il browser: passa dalle impostazioni regionali di origine a quelle di destinazione, naviga tra le pagine, ricarica e controlla interpolazione e layout. Una richiesta priva sia dell'header `Accept-Language` sia del cookie esegue il rendering dell'impostazione regionale predefinita e registra un avviso "gt-next: No locale could be determined" per ogni ricerca di traduzione; con curl senza header è il comportamento previsto. Invia `Accept-Language: <target-locale>` o `Cookie: generaltranslation.locale=<target-locale>` per controllare un'impostazione regionale di destinazione. Se pertinente per la lingua selezionata, controlla i testi lunghi e il layout da destra a sinistra. Per i progetti backend e di contenuti, esamina risposte o file tradotti reali. Non dichiarare di aver verificato nel browser se non hai potuto farlo.

Correggi gli errori di configurazione o di runtime prima di considerare completa l'integrazione. Se ti blocchi, consulta la documentazione di riferimento pertinente e analizza gli errori dei comandi invece di ricreare più volte progetti o chiavi.

Per le applicazioni che usano traduzioni pregenerate, prepara il workflow di produzione in modo che la traduzione venga eseguita prima della build esistente e che i file generati siano disponibili al runtime. Mantieni invariati i passaggi di build esistenti, documenta i nomi dei segreti della CI e verifica i requisiti dell'integrazione selezionata relativi a file locali o CDN. Se le traduzioni vengono incluse nei commit e non esiste una chiave per la CI, lascia invariato lo script di build. Esegui `npx gt@latest translate` in locale con la sessione di login ogni volta che il testo di origine cambia, quindi esegui il commit di `public/_gt/<locale>.json`, `gt-lock.json` e `gt.config.json`. Aggiungi `npx gt translate` allo script di build solo se nella CI è impostata una `GT_API_KEY` con autorizzazioni di scrittura dei file e di coda di traduzione. Usa `--publish` solo se il workflow CDN scelto lo richiede. Non effettuare deployment in produzione né eseguire il merge di pull request, a meno che non te l'abbia chiesto.

Concludi con un breve riepilogo di consegna: cosa è cambiato, quale progetto e quali impostazioni regionali sono configurati, come eseguirlo, cosa hai effettivamente verificato ed eventuali azioni che restano a mio carico. Includi la documentazione pertinente e il link alla Dashboard, ma nessuna credenziale. L'obiettivo è avere una traduzione funzionante nel mio progetto, con indicazioni chiare su come mantenerla aggiornata.
````

## Guida dell'agente [#agent-guide]

Fornisci al tuo agente tutto ciò di cui ha bisogno con un solo copia e incolla. Copia la guida qui sotto in un file `AGENTS.md` (o `CLAUDE.md`, una regola di Cursor o il file di istruzioni del tuo strumento) nella radice del progetto e il tuo agente aggiungerà ed eseguirà General Translation correttamente. Usa il pulsante Copia nell&#39;angolo in alto a destra del blocco oppure recupera la stessa guida direttamente da [`/AGENTS.md`](/AGENTS.md).

````markdown title="AGENTS.md"
# General Translation — agent guide

Instructions for AI coding agents adding [General Translation](https://generaltranslation.com) to a project. General Translation is a full-stack localization product: open-source i18n libraries plus a CLI that translate an app and its content into any language. Follow these rules when internationalizing code or wiring up translations.

## What to use

Pick the package that matches the stack:

- **Next.js (App Router or Pages Router)** → `gt-next`
- **React (SPA, e.g. Vite)** → `gt-react`
- **TanStack Start** → `gt-tanstack-start`
- **Vue 3** → `gt-vue`
- **Node.js server** → `gt-node`
- **Any JavaScript runtime, or lower-level control** → `generaltranslation` (the Core library)
- **Translating content files (JSON, MDX, YAML, and more) or running translation in CI** → the `gt` CLI

All of these are free and open-source. The libraries work with or without a General Translation account; an API key unlocks on-demand translation in development and the hosted translation API.

## Setup

For a new setup, run from the app directory with `--no-interactive` and a flag for every question. Without `--no-interactive`, a missing answer opens a question in the terminal and the command waits for it; with it, a missing answer is an error that lists the flags still needed and changes no file:

```bash
npx gt init --no-interactive --json --defaults --default-locale en --locales fr es --no-locadex --react-setup --file-formats none --no-dev-credentials
```

For a local Vite or TanStack Start setup, replace `--no-dev-credentials` with `--no-live-translations`. Do not pass both credential flag families.

The wizard detects the framework, creates or updates `gt.config.json`, and can select/create a project and provision a development runtime key. Creating a project or key without a tooling key or saved login signs in first, which a person must approve. Framework rewrites are experimental and need review. Review [init flags and side effects](/docs/cli/reference/commands/init) before running it.

For manual setup, install the packages yourself:

```bash
npm install gt-next   # or gt-react / gt-node / generaltranslation
npm install -D gt
```

Then create `gt.config.json` in the project root — this is the single source of truth for locales:

```json
{
  "defaultLocale": "en",
  "locales": ["es", "fr", "ja"],
  "files": { "gt": { "output": "public/_gt/[locale].json" } }
}
```

- `defaultLocale` — the language the source is written in.
- `locales` — the languages to translate into.
- `files.gt.output` — where the CLI writes translation files (`[locale]` is replaced per language). Add this directory to `.gitignore`; the files are generated.

For a manually configured app, have the developer run `npx gt login`, then bind an existing project with `projectId` in the config or `GT_PROJECT_ID` in the environment. Login does not select a project or write env files; do not rerun init just to authenticate.

For CI, commit the config and inject a separately scoped tooling key through the CI secret store:

```bash
GT_API_KEY="your-api-key"   # Concede permessi per l'intero flusso di lavoro CLI, non solo per la generazione
GT_PROJECT_ID="your-project-id"
```

CLI login, runtime development keys, and CI tooling keys are separate. SDKs do not read CLI sessions; init's development runtime key does not replace `GT_API_KEY`. Never commit keys or include them in deployed browser/mobile bundles.

Read [CLI credentials](/docs/cli/guides/configuring#credentials) before configuring authentication. Require human approval for login and key creation; `--no-browser` and quiet mode do not make login unattended.

## Core usage

Wrap user-facing JSX in `<T>`. Write source copy directly — no translation keys needed:

```tsx
import { T } from 'gt-next'; // or 'gt-react'

// Everything inside <T> is translated as a unit
<T>
  <h1>Welcome to my app</h1>
</T>;
```

Use `useGT()` for standalone strings (placeholders, `aria-label`, `alt`, button labels). `useGT()` returns the translation function directly:

```tsx
import { useGT } from 'gt-next';

const gt = useGT(); // ✅ correct
// const { gt } = useGT(); // ❌ wrong — useGT returns the function, not an object

<input placeholder={gt('Search products')} />;
```

In async App Router components, use `getGT` instead. `gt-next/server` does not work with the Pages Router:

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

const gt = await getGT();
```

Wrap dynamic or private values (names, emails, IDs) in `<Var>` so they are not translated and never sent to the API. Use `<Currency>`, `<DateTime>`, and `<Num>` for values that should be reformatted but not translated:

```tsx
import { T, Var } from 'gt-next';

// Generates one translation, keeps the name unchanged
<T>
  Hello, <Var>{name}</Var>!
</T>;
```

For Node.js servers, initialize once and resolve translations per request:

```js
import { initializeGT, withGT, getGT } from 'gt-node';

initializeGT({ defaultLocale: 'en', locales: ['en', 'es', 'fr'] });
// racchiudi gli handler in withGT(locale, ...); poi `const gt = await getGT()` al loro interno
```

Mantieni tutta la configurazione delle lingue in `gt.config.json` — non disseminare elenchi di lingue nel codice.

## Comandi

| Comando                          | Quando eseguirlo                                                                                                                                                         |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `npx gt init` | Configurazione guidata; può essere eseguita senza interazione con `--no-interactive` e i relativi flag. Può modificare i file del framework, le dipendenze, la configurazione e le credenziali di runtime. |
| `npx gt configure` | Configurazione senza la riscrittura del codice React; accetta gli stessi flag, tranne quelli per la configurazione del framework. Può installare dipendenze ed emettere credenziali di runtime. Per modificare solo la configurazione, scrivila manualmente. |
| `npx gt login` | Fai approvare allo sviluppatore l'accesso all'account per l'uso della CLI. |
| `npx gt translate`               | Per tradurre il progetto tramite l'API di General Translation. Eseguilo in CI **prima** della build per la produzione; aggiungi `--save-local` solo quando le modifiche locali devono essere sincronizzate per prime. |
| `npx gt generate` | Per generare modelli nella lingua di origine per la traduzione manuale senza chiamare l'API. Disponibile per i pacchetti supportati elencati nel riferimento di [`gt generate`](/docs/cli/reference/commands/generate). |
| `npx gt translate --dry-run` | Per esaminare l'ambito della traduzione senza chiamare l'API né scrivere file di traduzione. |
| `npx gt api --list` | Per elencare le operazioni API incluse nella CLI installata. |
| `npx gt api --spec <endpoint>` | Per esaminare una singola operazione API inclusa tramite ID dell'operazione, percorso della specifica o percorso concreto della richiesta. Ometti l'endpoint per ottenere la specifica completa. |
| `npx gt api <endpoint>`          | Per effettuare una richiesta API grezza autenticata da uno script o dal terminale.                                                                                                 |
| `npx gt project create --org-id <orgId> --name <name> --default-locale <locale>` | Previa approvazione, crea un progetto tramite un utente autenticato o una chiave di organizzazione autorizzata per org:projects:create. |
| `npx gt project status <job-id>` | Per esaminare un job di traduzione o di generazione del contesto del progetto.                                                                                                         |

Aggiungi la traduzione alla build di produzione affinché le traduzioni restino aggiornate, per esempio: `"build": "npx gt translate && next build"`.

## Regole — cosa fare e cosa non fare

Da fare:

- Racchiudi in `<T>` ogni nuovo testo rivolto agli utenti (o usa `useGT()`/`getGT()` per le stringhe autonome) mentre lo scrivi.
- Se sei autorizzato a inviare contenuti al servizio di traduzione ospitato, esegui `npx gt translate` prima di fare commit o build per la produzione, così i nuovi testi vengono tradotti.
- Mantieni l'elenco delle lingue solo in `gt.config.json`.
- Racchiudi i valori dinamici e privati in `<Var>` e aggiungi `context` quando una stringa è ambigua.
- Dopo aver modificato deliberatamente un file di traduzione generato, esegui `npx gt save-local` prima di scaricare nuovamente le traduzioni, oppure passa `--save-local` alla successiva esecuzione della traduzione.

Da non fare:

- Inserire stringhe già tradotte direttamente nel sorgente, o aggiungere rami `if`/`switch` per lingua — traduci invece il testo sorgente.
- Modificare i file di traduzione generati senza sincronizzare le modifiche: un download successivo può sovrascrivere le modifiche non salvate.
- Fare il commit di chiavi API o esporle, registrare in log condivisi lo stdout della creazione delle chiavi o generare credenziali senza approvazione esplicita.
- Duplicare la configurazione delle lingue al di fuori di `gt.config.json`.

## Link

- [`llms.txt`](/llms.txt) — curated machine-readable docs entry point.
- [`llms-index.txt`](/llms-index.txt) — exhaustive index of every docs page.
- [`llms-full.txt`](/llms-full.txt) — full docs content for tools that can load a larger context.
- [React index](/docs/react/llms.txt), [CLI index](/docs/cli/llms.txt), and [OpenAPI index](/docs/platform/openapi/llms.txt) — focused entry points for common tasks.
- [`AGENTS.md`](/AGENTS.md) — this drop-in guide as raw Markdown.
- [`openapi.yaml`](/openapi.yaml) — canonical General Translation API specification.
- [`sitemap.md`](/sitemap.md) — Markdown index of every docs page and blog post.
- [`sitemap.xml`](/sitemap.xml) — standard sitemap for every published page.
- Quickstarts: [React](/docs/react/react-quickstart), [Vue](/docs/vue/quickstart), [Node](/docs/node/quickstart), [Core library](/docs/platform/core/quickstart), and the [CLI](/docs/cli/quickstart).
- [Key concepts](/docs/overview/key-concepts) — locales, context, and static vs. dynamic content.
- Comandi per l'account: [`gt login`](/docs/cli/reference/commands/login) e [`gt api-key create`](/docs/cli/reference/commands/api-key-create).
- CLI reference: [`gt api`](/docs/cli/reference/commands/api), [`gt project create`](/docs/cli/reference/commands/project-create), and [`gt project status`](/docs/cli/reference/commands/project-status).
````

## Indirizza gli agenti alla documentazione [#point-agents]

Fornisci al tuo agente accesso diretto alla documentazione, così le sue risposte restano accurate. General Translation pubblica diversi entry point leggibili dalle macchine nella radice del sito e sotto `/docs` sull&#39;host della documentazione:

* [`llms.txt`](/llms.txt) — un entry point curato in stile [llmstxt.org](https://llmstxt.org/) con le Quickstart principali e indici mirati.
* [`llms-index.txt`](/llms-index.txt) — l&#39;indice esaustivo dei link a ogni pagina pubblicata della documentazione.
* [`llms-full.txt`](/llms-full.txt) — l&#39;intero contenuto della documentazione in un unico file, esclusa la reference OpenAPI generata.
* [`AGENTS.md`](/AGENTS.md) — la guida pronta all&#39;uso qui sopra in Markdown non elaborato.
* [`agent-prompt.md`](/agent-prompt.md): il prompt iniziale qui sopra in Markdown non elaborato.
* [`sitemap.md`](/sitemap.md) — un indice in Markdown di ogni pagina della documentazione e di ogni post del blog.
* [`sitemap.xml`](/sitemap.xml) — la sitemap XML standard di ogni pagina pubblicata.

Usa un indice circoscritto quando l&#39;agente sa già di quale parte del prodotto ha bisogno:

* [Overview](/docs/overview/llms.txt)
* [Platform](/docs/platform/llms.txt), con indici mirati per [Dashboard](/docs/platform/dashboard/llms.txt), [Locadex](/docs/platform/locadex/llms.txt), [Core](/docs/platform/core/llms.txt) e [OpenAPI](/docs/platform/openapi/llms.txt)
* [CLI](/docs/cli/llms.txt)
* [React](/docs/react/llms.txt)
* [Vue](/docs/vue/llms.txt)
* [Node.js](/docs/node/llms.txt)
* [Python](/docs/python/llms.txt)
* [Integrations](/docs/integrations/llms.txt)

Per lavorare con le API, usa il [bundle delle operazioni OpenAPI](/docs/platform/openapi/llms-full.txt) o la specifica canonica [`openapi.yaml`](/openapi.yaml) invece di estrarre i contenuti dalle pagine interattive degli endpoint.

L&#39;host della documentazione serve anche i file di radice sotto `/docs`, inclusi `/docs/llms.txt`, `/docs/llms-index.txt` e `/docs/llms-full.txt`. Ogni pagina della documentazione è disponibile come **Markdown non elaborato**: aggiungi `.md` o `.mdx` all&#39;URL di qualsiasi pagina per ottenere il sorgente pulito senza dover analizzare l&#39;HTML renderizzato. Gli indici generati e i metadati di discovery usano `.mdx`, ad esempio `/docs/cli/quickstart.mdx`.

Per aggiungere la documentazione come contesto, incolla un URL della documentazione o il link `llms.txt` nel contesto del tuo agente, oppure aggiungi la documentazione come sorgente negli strumenti che supportano l&#39;indicizzazione della documentazione.

## server MCP [#mcp]

Usa il server [Model Context Protocol](https://modelcontextprotocol.io) (MCP) ospitato all&#39;indirizzo `https://api.gtx.dev/mcp` per informazioni sul progetto in tempo reale e per la Context Management. Utilizza streamable HTTP.

Gli strumenti di Context Management del server consentono di elencare, creare e aggiornare i Context Group, con i relativi termini di glossario e prompt personalizzati, le importazioni ed esportazioni e le assegnazioni ai progetti. Rispecchiano la [Context Management API](/docs/platform/openapi/reference/context-management/list-groups).

Il server ospitato fornisce anche [strumenti MCP di Google Drive](/docs/integrations/google-drive/reference/mcp-tools) per trovare i progetti collegati, tradurre Google Docs e Google Slides ed eseguire il polling dello stato di avanzamento delle copie tradotte.

Aggiungi la connection al config file MCP del tuo strumento (ad esempio, `.mcp.json`). I nomi dei trasporti e i campi di configurazione possono variare a seconda del client:

```json title=".mcp.json"
{
  "mcpServers": {
    "generaltranslation": {
      "type": "http",
      "url": "https://api.gtx.dev/mcp"
    }
  }
}
```

### Autenticarsi con l&#39;API remota

Connettiti tramite il flusso di accesso OAuth del tuo client MCP, oppure configura `Authorization: Bearer <api-key>` utilizzando le sue impostazioni dell&#39;header segreto. Le connessioni con chiave API accettano chiavi di progetto (`gtx-api-`) e chiavi di organizzazione (`gtx-org-`). Le chiavi `gtx-dev-` esistenti continuano ad autenticarsi come chiavi di progetto. Ogni strumento verifica le autorizzazioni della chiave per l&#39;azione richiesta. Configura le [autorizzazioni personalizzate delle chiavi](/docs/platform/dashboard/reference/api-keys) per gli strumenti di cui il tuo agente ha bisogno.

Usa `list_orgs` per trovare un ID organizzazione e `list_projects` per trovare un ID progetto. Nessuno dei due strumenti di individuazione richiede autorizzazioni sulle risorse. Passa gli ID restituiti come `orgId` e `projectId` agli altri strumenti. Le chiavi di progetto e di organizzazione individuano solo le risorse a cui sono associate; inoltre, una chiave di progetto può omettere `projectId` per utilizzare il proprio progetto.

Gli strumenti di Context Management richiedono `org:context:read` o `org:context:write`. Concedi a una chiave di organizzazione l&#39;autorizzazione **Context** corrispondente, oppure autorizza lo stesso accesso Context a livello di organizzazione durante l&#39;accesso OAuth a MCP. Le chiavi di progetto non possono usare questi strumenti. Passa un `orgId` a `list_context_groups` e `create_context_group`, e un `groupId` agli strumenti che operano su un gruppo esistente.

Il corpo delle richieste MCP non può superare i 100 MiB. I singoli strumenti possono imporre limiti inferiori per i propri input.

Una volta effettuata la connessione, chiedi al tuo agente di utilizzare il server MCP `generaltranslation`. Prova con: «Elenca i miei progetti e mostra le impostazioni di impostazione regionale di uno di essi».

## Suggerimenti specifici per gli editor [#editor-tips]

La maggior parte della configurazione è uguale per tutti gli agenti; questi sono i pochi punti in cui le indicazioni cambiano.

* **Cursor** — registra il server MCP, poi chiedigli di &quot;usare lo strumento `generaltranslation`&quot;. Aggiungi la documentazione come sorgente oppure fai riferimento a `/llms.txt` nel prompt.
* **Claude Code** — legge automaticamente un file `CLAUDE.md` nella radice, quindi copia la [guida dell&#39;agente](#agent-guide) nel file `CLAUDE.md` del tuo progetto. Registra il server MCP e chiedigli di &quot;usare il server MCP `generaltranslation`&quot;.
* **Copilot** — inserisci le indicazioni valide per tutto il repo nel file delle istruzioni (ad esempio `.github/copilot-instructions.md`) e fai riferimento lì a `/llms.txt` della documentazione.

## Best practice [#best-practices]

Gli agenti sono affidabili per il lavoro meccanico di i18n, ma per la qualità della traduzione e la configurazione serve comunque l&#39;intervento umano. Usa questa suddivisione:

* **Affida all&#39;agente:** racchiudere il testo visibile agli utenti in [`<T>`](/docs/react/reference/components/t), aggiungere [`useGT()`](/docs/react/reference/hooks/use-gt) per le stringhe standalone e impostare `gt.config.json`. Ottieni l&#39;approvazione prima di eseguire [`npx gt init`](/docs/cli/reference/commands/init) con `--dev-credentials` o `--create-project`, che creano chiavi o progetti.
* **Verifica manualmente:** il [contesto di traduzione](/docs/overview/key-concepts#context) (Glossario e prompt personalizzati) scritto dall&#39;agente, la configurazione delle impostazioni regionali (`defaultLocale` e `locales`) e che i valori dinamici o privati siano racchiusi in [`<Var>`](/docs/react/reference/components/var).
* **Non lasciare mai all&#39;agente:** la generazione o l&#39;esposizione di credenziali senza approvazione, la modifica dei file di traduzione generati senza sincronizzare le modifiche o l&#39;inserimento nel codice di stringhe già tradotte invece di tradurre il testo sorgente con la CLI.

## Sitemap

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