Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions docs/en-US/cli/reference/formats/mdx-md-files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ description: Translate MDX and Markdown files with the General Translation CLI.

The CLI translates MDX (`mdx`) and Markdown (`md`) files. All syntax and formatting in the source files is preserved in the translated files.

## Overview [#overview]

| Topic | Description |
| --- | --- |
| [Configuration](#config) | Select source files and translated output paths. |
| [Static data exports](#data-exports) | Reuse unchanged strings in eligible exports. |
| [Translated file names](#transform) | Remap output file names with `transform`. |
| [Links and assets](#localize) | Localize URLs, imports, and relative assets. |

## Configuration [#config]

Add an `mdx` or `md` entry under `files` with an `include` array of glob patterns. Use the `[locale]` placeholder so the CLI can find source files and save translations to the right path.
Expand All @@ -28,9 +37,9 @@ This translates every MDX file under `content/docs/en` and saves the results to

## Update static data exports [#data-exports]

When an updated MDX file contains static data exports, General Translation reuses matching strings from earlier translations and translates only new or changed strings. Reuse applies to exported variables whose values contain only literals, arrays, and plain objects. Exports with spreads, identifiers, function calls, template literals, or JSX use the standard translation path.
When an updated MDX file contains static data exports, General Translation reuses matching strings from earlier translations and translates only new or changed strings. Reuse applies when every exported variable in the chunk contains only static string, number, bigint, boolean, or `null` literals, arrays, and plain objects. TypeScript assertion wrappers are supported.

Force retranslation and Glossary retranslation skip this incremental reuse.
Exports with spreads, identifiers, function calls, template literals, JSX, or computed object keys use the standard translation path. Running `gt translate --force` or applying Glossary translations also skips incremental reuse.

## Rename translated files [#transform]

Expand Down
2 changes: 1 addition & 1 deletion docs/en-US/cli/reference/formats/plain-text-files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Translate plain text files with the General Translation CLI. API re

---

The entire `txt` file is treated as translatable content, so no markup or structure is preserved or skipped.
The CLI treats the entire `txt` file as translatable content instead of parsing markup. It preserves whitespace-based formatting but does not skip content based on structure.

## Configuration [#config]

Expand Down
11 changes: 9 additions & 2 deletions docs/en-US/cli/reference/formats/ts-js-files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ description: Translate TypeScript and JavaScript files with the General Translat

The CLI translates TypeScript (`ts`) and JavaScript (`js`) files. All syntax and formatting in the source files is preserved in the translated files.

## Overview [#overview]

| Topic | Description |
| --- | --- |
| [Configuration](#config) | Select source files and translated output paths. |
| [Static data exports](#data-exports) | Reuse unchanged strings in eligible exports. |

## Configuration [#config]

Add a `ts` or `js` entry under `files` with an `include` array of glob patterns. Use the `[locale]` placeholder so the CLI can find source files and save translations to the right path.
Expand All @@ -27,6 +34,6 @@ This translates every TypeScript file under `scripts/en` and saves the results t

## Update static data exports [#data-exports]

When an updated TypeScript or JavaScript file contains static data exports, General Translation reuses matching strings from earlier translations and translates only new or changed strings. Reuse applies to exported variables whose values contain only literals, arrays, and plain objects. Exports with spreads, identifiers, function calls, template literals, or JSX use the standard translation path.
When an updated TypeScript or JavaScript file contains static data exports, General Translation reuses matching strings from earlier translations and translates only new or changed strings. Reuse applies when every exported variable in the chunk contains only static string, number, bigint, boolean, or `null` literals, arrays, and plain objects. TypeScript assertion wrappers are supported.

Force retranslation and Glossary retranslation skip this incremental reuse.
Exports with spreads, identifiers, function calls, template literals, JSX, or computed object keys use the standard translation path. Running `gt translate --force` or applying Glossary translations also skips incremental reuse.
20 changes: 8 additions & 12 deletions docs/en-US/node/guides/configuring.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ related:

`gt-node` is configured entirely through the [`initializeGT`](/docs/node/reference/functions/initialize-gt) call you make once at startup. This guide covers what to pass and how translations are delivered.

*Note: Unlike `gt-next`, `gt-node` does not read `gt.config.json` or environment variables automatically. Pass every value explicitly.*
*Note: Unlike `gt-next`, `gt-node` does not read `gt.config.json` automatically. Import that file explicitly if you want to share its locale and file settings with the runtime.*

## Initialize at startup [#initialize]

Expand All @@ -24,27 +24,23 @@ import { initializeGT } from 'gt-node';
initializeGT({
defaultLocale: 'en',
locales: ['en', 'es', 'fr'],
projectId: process.env.GT_PROJECT_ID,
});
```

To keep values in sync with the CLI, import your `gt.config.json` and spread its fields into the call.

## Add credentials [#credentials]

Set your Project ID and API key as environment variables and pass them in. Use the development key while developing and the production key in production.
Set your Project ID and development API key as environment variables while developing:

```ts title="server.js"
initializeGT({
defaultLocale: 'en',
locales: ['en', 'es', 'fr'],
projectId: process.env.GT_PROJECT_ID,
devApiKey: process.env.NODE_ENV !== 'production' ? process.env.GT_API_KEY : undefined,
apiKey: process.env.NODE_ENV === 'production' ? process.env.GT_API_KEY : undefined,
});
```bash
export GT_PROJECT_ID="your-project-id"
export GT_DEV_API_KEY="your-development-api-key"
```

In development, a `projectId` and development API key enable on-demand translation and hot reload, so new strings translate as you work. In production, translations come from your pre-generated files or the CDN. See the [Configuration reference](/docs/node/reference/config) for every option.
Set `GT_API_KEY` instead when you need runtime translation in production. `initializeGT` reads these three variables when the corresponding `projectId`, `devApiKey`, or `apiKey` option is omitted. An explicit option takes precedence over its environment variable.

In development, a Project ID and development API key enable on-demand translation and hot reload, so new strings translate as you work. In production, translations come from your pre-generated files or the CDN. See the [Configuration reference](/docs/node/reference/config) for every option.

## Choose how translations are delivered [#delivery]

Expand Down
10 changes: 8 additions & 2 deletions docs/en-US/node/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,21 @@ Install `gt-node` as a dependency and the [`gt` CLI](/docs/cli/quickstart) as a

### 2. Initialize the library

Call [`initializeGT`](/docs/node/reference/functions/initialize-gt) once at startup, before handling requests. Pass your locales and credentials — `gt-node` does not read `gt.config.json` or environment variables automatically.
Make your Project ID and development API key available to the Node.js process:

```bash
export GT_PROJECT_ID="your-project-id"
export GT_DEV_API_KEY="your-development-api-key"
```

Call [`initializeGT`](/docs/node/reference/functions/initialize-gt) once at startup, before handling requests. Pass your locales directly. `gt-node` reads credentials from `GT_PROJECT_ID`, `GT_DEV_API_KEY`, and `GT_API_KEY` when you do not pass them directly, but it does not read `gt.config.json` automatically.

```ts title="server.js"
import { initializeGT } from 'gt-node';

initializeGT({
defaultLocale: 'en',
locales: ['en', 'es', 'fr'],
projectId: process.env.GT_PROJECT_ID,
});
```

Expand Down
33 changes: 21 additions & 12 deletions docs/en-US/node/reference/config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Configure the General Translation gt-node library with initializeGT

---

The `gt-node` library is configured through a single [`initializeGT`](/docs/node/reference/functions/initialize-gt) call at startup. `gt-node` does not read `gt.config.json` or environment variables automatically — every value is read from the object you pass to `initializeGT`. This page documents the keys that call accepts.
The `gt-node` library is configured through a single [`initializeGT`](/docs/node/reference/functions/initialize-gt) call at startup. It does not read `gt.config.json` automatically, but it resolves credentials from environment variables when you omit them from the configuration object. This page documents the keys that call accepts.

## Overview [#overview]

Expand All @@ -17,7 +17,6 @@ import { initializeGT } from 'gt-node';
initializeGT({
defaultLocale: 'en',
locales: ['en', 'es', 'fr'],
projectId: process.env.GT_PROJECT_ID,
});
```

Expand All @@ -32,15 +31,25 @@ initializeGT(gtConfig);

The configuration type is `InitializeGTParams`, the combination of the locale-resolution options and the translation-cache options.

## Environment variables [#env]

Explicit values passed to `initializeGT` take precedence over environment variables.

| Variable | Description |
| --- | --- |
| `GT_PROJECT_ID` | Project ID used when `projectId` is omitted. |
| `GT_DEV_API_KEY` | Development API key used when `devApiKey` is omitted. |
| `GT_API_KEY` | Production API key used when `apiKey` is omitted. |

## Options [#options]

| Option | Description | Type | Optional | Default |
| --- | --- | --- | --- | --- |
| [`defaultLocale`](#default-locale) | Source and fallback locale. | `string` | Yes | `'en'` |
| [`locales`](#locales) | Supported target locales. | `string[]` | Yes | `[defaultLocale]` |
| [`projectId`](#project-id) | Project ID; enables the General Translation CDN loader when set. | `string` | Yes | |
| [`devApiKey`](#dev-api-key) | Development API key for on-demand translation. | `string` | Yes | |
| [`apiKey`](#api-key) | Production API key. | `string` | Yes | |
| [`projectId`](#project-id) | Project ID; enables the General Translation CDN loader when set. | `string` | Yes | `GT_PROJECT_ID` |
| [`devApiKey`](#dev-api-key) | Development API key for on-demand translation. | `string` | Yes | `GT_DEV_API_KEY` |
| [`apiKey`](#api-key) | Production API key. | `string` | Yes | `GT_API_KEY` |
| [`cacheUrl`](#cache-url) | Translation cache host. `null` disables remote loading. | `string \| null` | Yes | GT CDN |
| [`runtimeUrl`](#runtime-url) | Runtime translation host. `null` disables it. | `string \| null` | Yes | GT runtime |
| [`loadTranslations`](#load-translations) | Custom loader returning translations for a locale. | `TranslationsLoader` | Yes | — |
Expand Down Expand Up @@ -76,21 +85,21 @@ initializeGT({ defaultLocale: 'en', locales: ['en', 'es', 'fr', 'ja'] });

## `projectId` [#project-id]

**Type** `string` · **Optional**
**Type** `string` · **Optional** · **Default** `GT_PROJECT_ID`

Your General Translation Project ID, required for General Translation cloud services. When set (without a custom `loadTranslations`), it enables the CDN loader that fetches translations at runtime.
Your General Translation Project ID, required for General Translation cloud services. When omitted, it falls back to `GT_PROJECT_ID`. When set without a custom `loadTranslations`, it enables the CDN loader that fetches translations at runtime.

## `devApiKey` [#dev-api-key]

**Type** `string` · **Optional**
**Type** `string` · **Optional** · **Default** `GT_DEV_API_KEY`

A development API key. Together with a `projectId`, it enables on-demand runtime translation and development hot reload, so [`getGT`](/docs/node/reference/functions/get-gt), [`getMessages`](/docs/node/reference/functions/get-messages), and [`tx`](/docs/node/reference/functions/tx) can translate new content while you develop. Hot reload only runs when `NODE_ENV` is not `'production'`.
A development API key. When omitted, it falls back to `GT_DEV_API_KEY`. Together with a `projectId`, it enables on-demand runtime translation and development hot reload, so [`getGT`](/docs/node/reference/functions/get-gt), [`getMessages`](/docs/node/reference/functions/get-messages), and [`tx`](/docs/node/reference/functions/tx) can translate new content while you develop. Hot reload only runs when `NODE_ENV` is not `'production'`.

## `apiKey` [#api-key]

**Type** `string` · **Optional**
**Type** `string` · **Optional** · **Default** `GT_API_KEY`

A production API key. Set it when you need runtime translation in production. For most deployments you generate translations ahead of time with the [`gt` CLI](/docs/cli/quickstart) instead.
A production API key. When omitted, it falls back to `GT_API_KEY`. Set it when you need runtime translation in production. For most deployments you generate translations ahead of time with the [`gt` CLI](/docs/cli/quickstart) instead.

## `cacheUrl` [#cache-url]

Expand Down Expand Up @@ -186,6 +195,6 @@ import { initializeGT } from 'gt-node';
initializeGT({
defaultLocale: 'en',
locales: ['en', 'es', 'fr', 'ja'],
projectId: process.env.GT_PROJECT_ID,
// Credentials are read from GT_PROJECT_ID, GT_API_KEY, and GT_DEV_API_KEY.
});
```
14 changes: 7 additions & 7 deletions docs/en-US/node/reference/functions/initialize-gt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ Configures General Translation for use in a Node.js runtime. Call `initializeGT`

## Overview [#overview]

Call `initializeGT` at the top of your server's entry file. It reads none of your environment or config files automatically — pass every value explicitly. See the [configuration reference](/docs/node/reference/config) for the full option list.
Call `initializeGT` at the top of your server's entry file. It does not read `gt.config.json` automatically, but omitted credential options fall back to `GT_PROJECT_ID`, `GT_API_KEY`, and `GT_DEV_API_KEY`. See the [configuration reference](/docs/node/reference/config) for the full option list.

```ts
import { initializeGT } from 'gt-node';

initializeGT({
defaultLocale: 'en',
locales: ['en', 'es', 'fr'],
projectId: 'your-project-id',
});
```

Expand All @@ -32,7 +31,8 @@ initializeGT(config: InitializeGTParams): void
## How it works [#how-it-works]

- **One-time setup.** Call `initializeGT` exactly once during server initialization. It sets up locale configuration, the translation cache, and per-request locale storage.
- **Delivery mode.** Provide `projectId` to load translations from the General Translation CDN, or [`loadTranslations`](/docs/react/reference/functions/load-translations) to bring your own source. For on-demand translation in development, also provide `devApiKey`.
- **Credential resolution.** Explicit `projectId`, `apiKey`, and `devApiKey` values take precedence. When omitted, they fall back to `GT_PROJECT_ID`, `GT_API_KEY`, and `GT_DEV_API_KEY`.
- **Delivery mode.** Set `projectId` or `GT_PROJECT_ID` to load translations from the General Translation CDN, or use [`loadTranslations`](/docs/react/reference/functions/load-translations) to bring your own source. For on-demand translation in development, also set `devApiKey` or `GT_DEV_API_KEY`.
- **Synchronous.** The call returns immediately and does not await network requests.

## Parameters [#parameters]
Expand All @@ -49,8 +49,8 @@ An object combining locale, credential, cache, and dictionary options. The objec

- `defaultLocale` — source and fallback locale (default `'en'`).
- `locales` — supported target locales.
- `projectId` — Project ID; enables the CDN loader when set.
- `devApiKey` — development API key for on-demand translation.
- `projectId` — Project ID; falls back to `GT_PROJECT_ID` and enables the CDN loader when set.
- `devApiKey` — development API key for on-demand translation; falls back to `GT_DEV_API_KEY`.
- `loadTranslations` — custom loader returning translations for a locale.
- `customMapping` — locale aliases and property overrides.

Expand All @@ -67,7 +67,7 @@ import { initializeGT } from 'gt-node';
initializeGT({
defaultLocale: 'en',
locales: ['en', 'es', 'fr', 'ja'],
projectId: process.env.GT_PROJECT_ID,
// Credentials are read from GT_PROJECT_ID, GT_API_KEY, and GT_DEV_API_KEY.
});
```

Expand All @@ -88,5 +88,5 @@ initializeGT({
## Notes [#notes]

- `initializeGT` must be called once before any translation function runs.
- If you use General Translation cloud services, provide `projectId`; for development, also provide `devApiKey`.
- If you use General Translation cloud services, provide `projectId` or set `GT_PROJECT_ID`; for development, also provide `devApiKey` or set `GT_DEV_API_KEY`.
- The `loadTranslations` option lets you bring your own translation source instead of the General Translation CDN.
10 changes: 5 additions & 5 deletions docs/en-US/platform/dashboard/guides/managing-billing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Start for free. Add a payment method to turn on usage-based billing:
- **Starter — $0/month.** For individuals and small teams. There is no monthly fee; you pay only for what you use. Includes unlimited users, projects, and languages, plus the [Translation Editor](/docs/platform/dashboard/guides/reviewing-translations), GitHub integration, and the [Locadex](/docs/platform/locadex/quickstart) AI agent.
- **Enterprise — custom.** For larger teams with complex localization needs. Everything in Starter, plus forward-deployed localization engineers, custom workflows for any file format or framework, shared context across every Project, and enterprise-grade security, SLAs, and support.

Each free Organization gets 5M free translation credits to start. You will be rate-limited until you add a payment method.
The free plan is limited to 5M translation credits in a rolling 30-day window. When an eligible Organization adds its first payment method, it receives a one-time $10 signup grant (10M credits).

## Usage-based billing [#usage]

Expand All @@ -31,7 +31,7 @@ You pay per workflow: cost is based on the number of input tokens, workflow type

Translation is charged per token of input at a base rate set by file format and workflow type. All rates are per 10,000 input tokens:

| Format | Build-time | Runtime | Development |
| Format | Build time | Runtime | Development |
| --- | --- | --- | --- |
| GT | $20 | $1 | $4 |
| MDX / Markdown | $10 | — | — |
Expand Down Expand Up @@ -63,7 +63,7 @@ Every translation deducts its estimated cost from your balance. Purchased credit

### Buying credits [#buying-credits]

Choose **Buy Credits** on the Billing page and enter an **Amount** to charge to your default payment method. The dialog shows the allowed range for your plan (the Starter minimum is $10).
Choose **Buy Credits** on the Billing page and enter an **Amount** to charge to your default payment method. The dialog shows the allowed range for your plan (the Starter minimum is $10).

### Auto-reload [#auto-reload]

Expand All @@ -73,7 +73,7 @@ Auto-reload keeps your balance topped up automatically when your balance falls b
- **Reload to** — the target balance to bring your credits back up to.
- **Usage Limit** (optional) — a hard cap on total usage spend per billing period.

When usage reaches the limit you've set, billing is blocked even with auto-reload on.
When usage reaches the limit you've set, billing is blocked even with auto-reload on.

### When your balance runs out [#running-out]

Expand All @@ -88,7 +88,7 @@ What happens at $0 depends on auto-reload:

Because Starter has no monthly fee, upgrading is simply adding a payment method. On the **Billing** page, choose **Manage Billing** and add a card and billing address.

Upgrading removes your rate limit and also unlocks features including: Locadex, team invites, auto-reload, the Translation Editor, version branching, and unlimited Projects.
Upgrading removes your rate limit and also unlocks features including: Locadex, team invites, auto-reload, the Translation Editor, version branching, and unlimited Projects.

### Upgrade to Enterprise [#to-enterprise]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ related:

---

Use this workflow after translation to compare target locales, correct individual entries, and inspect prior file versions. Use annotations when a change needs discussion or review from another teammate.

## Basic review workflow [#basic-review-workflow]

1. Open your Project in the Dashboard.
Expand Down
Loading
Loading