Skip to content
Open
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
4 changes: 2 additions & 2 deletions blog/en-US/ai-chatbot.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default withGTConfig(nextConfig, {

I could've added more locales, but I just wanted to test the chatbot with a few different languages. Feel free to add as many locales as you want!

[Here's a list of all of the ones supported by gt-next](https://generaltranslation.com/docs/platform/supported-locales).
[Here's a list of all of the ones supported by gt-next](/docs/platform/dashboard/reference/supported-locales).

### How it works

Expand Down Expand Up @@ -220,4 +220,4 @@ internationalized AI chatbot that was available in Spanish, French, and Chinese.

If you're interested in the code, you can find it [here](https://github.com/General-Translation/ai-chatbot).

If you're interested in using General Translation, check out the [website](https://generaltranslation.com), [GitHub repo](https://github.com/General-Translation/gt-libraries), or [docs](https://generaltranslation.com/docs).
If you're interested in using General Translation, check out the [website](https://generaltranslation.com), [GitHub repo](https://github.com/General-Translation/gt-libraries), or [docs](/docs/overview/get-started).
12 changes: 6 additions & 6 deletions blog/en-US/best-localization-software.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ The library knows nothing about your translations. The TMS knows nothing about y

General Translation is not a library. It's not a TMS. It's the whole pipeline, used by developer-first teams at [Cursor](https://cursor.com), [Cognition](https://cognition.ai), [Windsurf](https://windsurf.com), [Mintlify](https://mintlify.com), and [ClickHouse](https://clickhouse.com).

- **Open-source developer libraries**: [`gt-next`](https://generaltranslation.com/docs/react/nextjs), [`gt-react`](https://generaltranslation.com/docs/react), and support for [React Native/Expo](https://generaltranslation.com/docs/react/react-native). Drop-in SDKs with full TypeScript support.
- **Open-source developer libraries**: [`gt-next`](/docs/react/nextjs), [`gt-react`](/docs/react/react-quickstart), and support for [React Native/Expo](/docs/react/react-native-quickstart). Drop-in SDKs with full TypeScript support.
- **An AI-first translation platform** that understands your codebase, your product, and your terminology. Not generic machine translation bolted on top.
- **Locadex, the AI agent**: an [automated internationalization engineer](https://generaltranslation.com/docs/locadex) that scans your codebase, internationalizes your code, creates translations, and opens pull requests on every push.
- **Locadex, the AI agent**: an [automated internationalization engineer](/docs/platform/locadex/quickstart) that scans your codebase, internationalizes your code, creates translations, and opens pull requests on every push.

Building both the library and the translation engine together makes localization ten times easier. No JSON export/import, no file management, no agencies to coordinate. Translations flow directly from your source code to production.

Expand Down Expand Up @@ -58,7 +58,7 @@ At 10 languages and 500 keys, that's 5,000 entries to maintain. At 50 languages

## How General Translation closes the loop

**1. Install and write code.** Run the [setup wizard](https://generaltranslation.com/docs/next/quickstart) and wrap content in `<T>` components. No key extraction. No JSON files.
**1. Install and write code.** Run the [setup wizard](/docs/react/nextjs-quickstart) and wrap content in `<T>` components. No key extraction. No JSON files.

```tsx
import { T } from 'gt-next';
Expand All @@ -75,15 +75,15 @@ export default function Home() {

**2. Develop.** Translations appear on-demand. Switch languages and see results immediately.

**3. Ship.** One command generates all translations at build time. They're pre-generated, cached, and delivered via CDN. Sub-50ms globally. [See the deploy guide →](https://generaltranslation.com/docs/next/quickstart#deploy)
**3. Ship.** One command generates all translations at build time. They're pre-generated, cached, and delivered via CDN. Sub-50ms globally. [See the deploy guide →](/docs/react/nextjs-quickstart#11-deploy-to-production)

**4. Automate.** [Locadex](https://generaltranslation.com/docs/locadex) monitors your repo. When you push code, it scans for changes, internationalizes new content, generates translations, and opens a PR. No human in the loop unless you want one. If you do, the translation editor gives you side-by-side diffs with the ability to edit before or after content goes live.
**4. Automate.** [Locadex](/docs/platform/locadex/quickstart) monitors your repo. When you push code, it scans for changes, internationalizes new content, generates translations, and opens a PR. No human in the loop unless you want one. If you do, the translation editor gives you side-by-side diffs with the ability to edit before or after content goes live.

## Why most translation AI gets it wrong

Most localization AI translates strings one at a time, in isolation. "Apple" could be the fruit or the company. "Cell" could be biological or a spreadsheet. Without context, the AI guesses.

General Translation's AI sees your full codebase context: component hierarchy, variable names, surrounding UI, your product glossary. The output is idiomatic without manual cleanup. For edge cases, you can [add explicit context](https://generaltranslation.com/docs/react/reference/components/t#props) directly in the component.
General Translation's AI sees your full codebase context: component hierarchy, variable names, surrounding UI, your product glossary. The output is idiomatic without manual cleanup. For edge cases, you can [add explicit context](/docs/react/reference/components/t#props) directly in the component.

## Pricing that scales with usage, not headcount

Expand Down
2 changes: 1 addition & 1 deletion blog/en-US/branch_vs_ternary.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ accordingly—something that is not easily possible while using ternary operator
If you take anything away from this article, you should always be looking for ways to leverage context and flexibility in your code.
Using the `<Branch />` component is probably one of the easiest ways to do this.

Check out the [`<Branch />` component](https://generaltranslation.com/docs/react/reference/components/branch) documentation for more details.
Check out the [`<Branch />` component](/docs/react/reference/components/branch) documentation for more details.
2 changes: 1 addition & 1 deletion blog/en-US/gt-next.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The goal with gt-next is to create an abundance mindset around translations. The

- Give a ⭐ to [gt-next on GitHub](https://github.com/General-Translation/gt-next)
- Get an API key 🔐 on our [platform](https://generaltranslation.com)
- Read the [docs](https://generaltranslation.com/docs) 📄
- Read the [docs](/docs/overview/get-started) 📄

### What you can do with gt-next

Expand Down
8 changes: 4 additions & 4 deletions blog/en-US/i18n-without-translation-files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ function CheckoutSummary({ itemCount, discount }) {
}
```

The `<T>` component in [`gt-react`](https://generaltranslation.com/docs/react) marks a block of JSX for translation. The English stays in your component. When a user visits in Spanish, the content inside `<T>` is replaced with its Spanish equivalent. Structure and formatting carry over.
The `<T>` component in [`gt-react`](/docs/react/react-quickstart) marks a block of JSX for translation. The English stays in your component. When a user visits in Spanish, the content inside `<T>` is replaced with its Spanish equivalent. Structure and formatting carry over.

There's no `t('checkout.summary.title')`, no `en.json`, no per-locale JSON files to keep in sync.

## Translations as build output

They're generated at deploy time. The [GT CLI](https://generaltranslation.com/docs/cli/reference/commands/translate) scans your codebase for everything inside `<T>` components and produces translations for every target language. The output goes into a gitignored directory, like compiled CSS or bundled JavaScript.
They're generated at deploy time. The [GT CLI](/docs/cli/reference/commands/translate) scans your codebase for everything inside `<T>` components and produces translations for every target language. The output goes into a gitignored directory, like compiled CSS or bundled JavaScript.

```json title="gt.config.json"
{
Expand Down Expand Up @@ -118,6 +118,6 @@ But most developers are already thinking in one language when they build UI. The
npx gt@latest init
```

The setup wizard configures your project, installs dependencies, and sets up translation hot reloading for development. Full walkthrough in the [quickstart guide](https://generaltranslation.com/docs/react).
The setup wizard configures your project, installs dependencies, and sets up translation hot reloading for development. Full walkthrough in the [quickstart guide](/docs/react/react-quickstart).

`gt-react` is open source. For Next.js App Router, there's [`gt-next`](https://generaltranslation.com/docs/react/nextjs). For React Native, there's [`gt-react-native`](https://generaltranslation.com/docs/react/react-native).
`gt-react` is open source. For Next.js App Router, there's [`gt-next`](/docs/react/nextjs-quickstart). For React Native, there's [`gt-react-native`](/docs/react/react-native-quickstart).
6 changes: 3 additions & 3 deletions blog/en-US/multilingual-nextjs-seo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ A multilingual site without proper SEO setup has problems:
- Incorrect language shown in search result snippets

**The good news:** getting multilingual SEO right in Next.js isn't complicated.
There are six things you need to get right, and this guide covers all of them using [gt-next](https://generaltranslation.com/docs/react/nextjs).
There are six things you need to get right, and this guide covers all of them using [gt-next](/docs/react/nextjs).

---

Expand Down Expand Up @@ -311,7 +311,7 @@ Here's a quick summary of everything covered:

## Next steps

- [gt-next quickstart](https://generaltranslation.com/docs/react/nextjs) to set up the full i18n stack
- [gt-next quickstart](/docs/react/nextjs-quickstart) to set up the full i18n stack
- [Middleware guide](/docs/react/nextjs/app-router-middleware) for routing configuration
- [SSG guide](/docs/react/nextjs) for statically generating multilingual pages
- [SSG guide](/docs/react/nextjs/app-router-static-site-generation) for statically generating multilingual pages
- [RTL support](/docs/react/guides/managing-locales) for right-to-left languages
18 changes: 9 additions & 9 deletions blog/en-US/nextjs-i18n-code-is-the-source-of-truth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ function Hero() {
}
```

Wrap your JSX in [`<T>`](https://generaltranslation.com/docs/react/reference/components/t). The English text stays right where you wrote it. When a user visits in Spanish or Japanese, the content inside `<T>` is translated — structure, formatting, and all.
Wrap your JSX in [`<T>`](/docs/react/reference/components/t). The English text stays right where you wrote it. When a user visits in Spanish or Japanese, the content inside `<T>` is translated — structure, formatting, and all.

No keys. No JSON files. No cross-referencing. The source of truth is your code.

## Setup

The syntax above comes from [gt-next](https://generaltranslation.com/docs/react/nextjs), an open-source i18n library for Next.js App Router. Getting started takes one command:
The syntax above comes from [gt-next](/docs/react/nextjs), an open-source i18n library for Next.js App Router. Getting started takes one command:

```bash copy
npx gt@latest init
```

The [setup wizard](https://generaltranslation.com/docs/cli/init) installs dependencies, wraps your Next.js config with [`withGTConfig`](https://generaltranslation.com/docs/next/api/config/with-gt-config), adds [`GTProvider`](https://generaltranslation.com/docs/react/reference/components/gt-provider) to your root layout, creates a [`gt.config.json`](https://generaltranslation.com/docs/cli/reference/config) with your locales, sets up dev API keys for translation hot reloading, and configures CDN translation storage — all interactively.
The [setup wizard](/docs/cli/reference/commands/init) installs dependencies, wraps your Next.js config with [`withGTConfig`](/docs/react/nextjs/config), adds [`GTProvider`](/docs/react/reference/components/gt-provider) to your root layout, creates a [`gt.config.json`](/docs/cli/reference/config) with your locales, sets up dev API keys for translation hot reloading, and configures CDN translation storage — all interactively.

Once that's done, wrap content in `<T>`, run your dev server, and use the [`<LocaleSelector>`](https://generaltranslation.com/docs/react/reference/components/locale-selector) component to switch between languages:
Once that's done, wrap content in `<T>`, run your dev server, and use the [`<LocaleSelector>`](/docs/react/reference/components/locale-selector) component to switch between languages:

```tsx
import { LocaleSelector } from 'gt-next';
Expand Down Expand Up @@ -79,11 +79,11 @@ In production, translations are pre-generated.
}
```

The [`translate`](https://generaltranslation.com/docs/cli/reference/commands/translate) command scans your codebase for all `<T>` usage, generates translations, and publishes them to a CDN. When your app builds, every locale is ready.
The [`translate`](/docs/cli/reference/commands/translate) command scans your codebase for all `<T>` usage, generates translations, and publishes them to a CDN. When your app builds, every locale is ready.

## Next steps

- [Variable components](https://generaltranslation.com/docs/react/guides/format-variables) — handle dynamic content inside `<T>` with [`<Var>`](https://generaltranslation.com/docs/react/reference/components/var), [`<Num>`](https://generaltranslation.com/docs/react/reference/components/num), and [`<Currency>`](https://generaltranslation.com/docs/react/reference/components/currency)
- [Branching components](https://generaltranslation.com/docs/react/guides/plurals-and-branches) — conditionally render content based on locale with [`<Plural>`](https://generaltranslation.com/docs/react/reference/components/plural) and [`<Branch>`](https://generaltranslation.com/docs/react/reference/components/branch)
- [`useGT`](https://generaltranslation.com/docs/react/reference/hooks/use-gt) and [`getGT`](https://generaltranslation.com/docs/react/reference/functions/get-gt) — translate plain strings for attributes, placeholders, and metadata
- [Standalone mode](https://generaltranslation.com/docs/react/guides/local-translations) — use gt-next without the General Translation platform
- [Variable components](/docs/react/guides/formatting-variables) — handle dynamic content inside `<T>` with [`<Var>`](/docs/react/reference/components/var), [`<Num>`](/docs/react/reference/components/num), and [`<Currency>`](/docs/react/reference/components/currency)
- [Branching components](/docs/react/guides/handling-plurals-and-branches) — conditionally render content based on locale with [`<Plural>`](/docs/react/reference/components/plural) and [`<Branch>`](/docs/react/reference/components/branch)
- [`useGT`](/docs/react/reference/hooks/use-gt) and [`getGT`](/docs/react/nextjs/reference/functions/get-gt) — translate plain strings for attributes, placeholders, and metadata
- [Standalone mode](/docs/react/guides/storing-translations) — use gt-next without the General Translation platform
6 changes: 3 additions & 3 deletions blog/en-US/plurals.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ Almost all libraries have dedicated documentation on rendering plurals.

### Full example: plurals in a multilingual React app

If you don't already have an internationalization library, consider [gt-react](https://generaltranslation.com/docs/react)!
If you don't already have an internationalization library, consider [gt-react](/docs/react/react-quickstart)!

gt-react's `<Plural>` component:

Expand Down Expand Up @@ -239,8 +239,8 @@ function Example({ count }) {

Ready to handle plurals properly in your React app? Check out our quickstart guides:

- [gt-react quickstart](https://generaltranslation.com/docs/react) for React apps
- [gt-next quickstart](https://generaltranslation.com/docs/react/nextjs) for Next.js apps
- [gt-react quickstart](/docs/react/react-quickstart) for React apps
- [gt-next quickstart](/docs/react/nextjs-quickstart) for Next.js apps
- [`<Plural>` API reference](/docs/react/reference/components/plural) for the full component API

Pluralization is one of the most common i18n challenges in React — getting it right from the start saves significant refactoring later.
2 changes: 1 addition & 1 deletion devlog/en-US/gt-react_v10_19_0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default defineConfig({
});
```

See the [gt-react setup docs](https://generaltranslation.com/docs/react/tutorials/quickstart) for other bundlers.
See the [React Quickstart](/docs/react/react-quickstart) for setup.

### 2. Enable dev hot reload in `gt.config.json`

Expand Down
2 changes: 1 addition & 1 deletion docs/en-US/cli/guides/generating-translations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ npx gt translate --dry-run

## Re-translate existing content [#retranslate]

By default, the CLI only translates content whose source has changed, and it preserves local edits. To change that behavior:
By default, the CLI only translates content whose source has changed, preserves local edits, and can reuse a matching translation from an earlier version of the same file — not only the most recent version. A segment is translated again when its source text changes. To change that behavior:

- `--force` re-translates all content and overwrites existing translations. Local changes are lost and you are charged for the new translations.
- `--force-download` re-downloads translations and overwrites local changes without re-translating.
Expand Down
69 changes: 67 additions & 2 deletions docs/en-US/cli/guides/using-auto-jsx.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Automatic JSX injection makes the compiler wrap translatable JSX text in [`<T>`]

Automatic JSX injection is disabled by default.

*Note: Automatic JSX injection currently works only with the i18n-context system and single-page React apps.*
*Note: Automatic JSX injection works in React single-page apps and in Next.js Webpack builds. Next.js Turbopack and SWC builds do not support it.*

## Enable automatic JSX injection [#enable]

Expand All @@ -33,12 +33,77 @@ Set `enableAutoJsxInjection` under `files.gt.parsingFlags` in `gt.config.json`.
}
```

## Configure the compiler [#compiler]

Install `@generaltranslation/compiler` as a development dependency:

<Tabs items={['npm', 'yarn', 'bun', 'pnpm']}>
<Tab value="npm">

```bash
npm install --save-dev @generaltranslation/compiler
```

</Tab>
<Tab value="yarn">

```bash
yarn add --dev @generaltranslation/compiler
```

</Tab>
<Tab value="bun">

```bash
bun add --dev @generaltranslation/compiler
```

</Tab>
<Tab value="pnpm">

```bash
pnpm add --save-dev @generaltranslation/compiler
```

</Tab>
</Tabs>

Then connect the compiler to your framework:

<Tabs items={['React SPA', 'Next.js']}>
<Tab value="React SPA">

Add the compiler plugin for your bundler. See [Developing SPA translations](/docs/react/guides/developing-spa-translations#setup) for Vite, webpack, Rollup, and esbuild setup.

</Tab>
<Tab value="Next.js">

Configure the Babel-based compiler in `next.config.ts`. Keep `enableAutoJsxInjection` in `gt.config.json` so CLI extraction and the build use the same setting.

```ts title="next.config.ts"
import { withGTConfig } from 'gt-next/config';

export default withGTConfig(
{},
{
experimentalCompilerOptions: {
type: 'babel',
},
}
);
```

This integration runs only with Webpack. If your Next.js version defaults to Turbopack, use `next dev --webpack` and `next build --webpack`.

</Tab>
</Tabs>

## How it works [#how]

Without injection, you wrap translatable text yourself.

```jsx
import { T } from 'gt-next';
import { T } from 'gt-react'; // Use 'gt-next' in Next.js.

function Welcome() {
return (
Expand Down
Loading
Loading