Skip to content
Closed
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
2 changes: 1 addition & 1 deletion authors/archie.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ avatar: /static/avatars/archie.png
occupation: CEO
company: General Translation
email: archie@generaltranslation.com
twitter: https://x.com/archiemckenzie_/photo
twitter: https://x.com/archiemckenzie_
linkedin: https://www.linkedin.com/in/archie-mckenzie
---

Expand Down
1 change: 1 addition & 0 deletions authors/default.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Team
avatar: /static/avatars/logo.png
occupation: Team
company: General Translation
email: archie@generaltranslation.com
twitter: https://x.com/generaltxn
Expand Down
1 change: 1 addition & 0 deletions authors/jackie.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Jackie Chen
avatar: /static/avatars/jackie.png
occupation: Software Engineer
company: General Translation
email: jackie@generaltranslation.com
twitter: https://x.com/Some_Jackie
Expand Down
2 changes: 1 addition & 1 deletion blog/en-US/gt-next.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tags: ['guide', 'internationalization', 'nextjs', 'gt-next']

**Internationalization (i18n) sucks. We're building a Next.js library, gt-next, to make it easier.** Today we're launching it in open beta.

``` copy
```bash copy
npm i gt-next
```

Expand Down
4 changes: 2 additions & 2 deletions blog/en-US/multilingual-nextjs-seo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Search engines need separate, crawlable URLs to index each language version inde

This means **locale-in-the-URL** — not cookies, not query parameters, not `Accept-Language` detection alone.

```
```text
✅ generaltranslation.com/en/about
✅ generaltranslation.com/fr/about
✅ generaltranslation.com/es/about
Expand All @@ -46,7 +46,7 @@ This means **locale-in-the-URL** — not cookies, not query parameters, not `Acc

First, nest your pages under a `[locale]` dynamic segment:

```
```text
app/
└── [locale]/
├── layout.tsx
Expand Down
2 changes: 1 addition & 1 deletion blog/en-US/plurals.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ layout: PostLayout

We often encounter apps that display awkward messages like:

```
```text
You have 1 new message(s)
```

Expand Down
2 changes: 1 addition & 1 deletion devlog/en-US/gt-next_v6_3_0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function Page() {

To support interpolation, the `msg()` function returns an encoded message instead of a plain string. The format looks like this:

```
```text
<interpolated content>:<base64 encoded string>
```

Expand Down
2 changes: 1 addition & 1 deletion devlog/en-US/gt-react_v10_18_0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function StatusMessage({ isMasculine }) {

At build time, the CLI sees the `derive()` call and registers two separate source entries, each producing its own translation:

```
```text
"I am tired" ($context: "inflect as masculine") → "Estoy cansado"
"I am tired" ($context: "inflect as feminine") → "Estoy cansada"
```
Expand Down
10 changes: 5 additions & 5 deletions docs/en-US/cli/faqs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ title: FAQs
description: Frequently asked questions about the GT CLI tool
---

### Do I need an API key to use the CLI?
## Do I need an API key to use the CLI?

The [`translate`](/docs/cli/translate) command requires a production API key, which you can get for free at [generaltranslation.com](https://generaltranslation.com). The [`init`](/docs/cli/init) command can generate one for you during setup.

### When should I run `gt translate`?
## When should I run `gt translate`?

Run it in your CI/CD pipeline **before** building your app for production. It should not be used during development — in development, use development API keys for on-demand translation instead.

### Can I use the CLI with libraries other than gt-next and gt-react?
## Can I use the CLI with libraries other than gt-next and gt-react?

Yes. The CLI can generate translations for third-party i18n libraries like [next-intl](https://next-intl.dev/) and [i18next](https://react.i18next.com/). It can also translate standalone JSON, Markdown, MDX, JS, and TS files.

### What file formats does the CLI support?
## What file formats does the CLI support?

The CLI supports [JSON](/docs/cli/formats/json), [MDX](/docs/cli/formats/mdx), [HTML](/docs/cli/formats/html), [TypeScript/JavaScript](/docs/cli/formats/ts), [YAML](/docs/cli/formats/yaml), [PO/POT](/docs/cli/formats/po), [plain text](/docs/cli/formats/txt), and [GT's internal format](/docs/cli/formats/gt).

### Where do the translations go?
## Where do the translations go?

Depending on your configuration, translations are either uploaded to the GT CDN or saved locally in your project bundle. See [`save-local`](/docs/cli/save-local) for details on storing translations locally.
2 changes: 1 addition & 1 deletion docs/en-US/cli/stage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ There are a few key parameters:

### Configuration file

When running `gt stage`, the CLI will automatically add the `stageTranslations : true` property to your `gt.config.json` file.
When running `gt stage`, the CLI will automatically add the `stageTranslations: true` property to your `gt.config.json` file.

This property ensures that if `translate` is run without first running `stage` for a specific deployment version,
the CLI tool will error and exit.
Expand Down
2 changes: 1 addition & 1 deletion docs/en-US/core/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ In order to translate a file, you need to follow these four steps:
### 1. Upload the file

Uploading files returns a list of file references with the [`uploadSourceFiles`](/docs/core/class/methods/translation/upload-source-files) method.
This allows you to later check the enqueue the file for translation, check the status of the file, and download the translated file.
This allows you to later enqueue the file for translation, check the status of the file, and download the translated file.

```typescript title="src/index.ts"
import fs from 'fs';
Expand Down
4 changes: 2 additions & 2 deletions docs/en-US/next/api/components/tx.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ This means translation will be performed live.

`<Tx>` translates jsx at runtime.
This means that translations are performed live, so you can translate content that is only known at runtime.
The trade off is that there is a delay while waiting for an on-demand translation to load is significantly slower.
The trade off is that waiting for an on-demand translation to load is significantly slower.

While loading, `<Tx>` will return undefined unless languages are similar (en-US vs en-GB), though this behavior can be customized with render settings.
If an error occurs, `<Tx>` will return the original content.
Expand Down Expand Up @@ -121,7 +121,7 @@ export default function DynamicGreeting(user) {
```

### With plurals
The `<T>` component also supports pluralization using the `<Plural>` component.
The `<Tx>` component also supports pluralization using the `<Plural>` component.

```jsx title="ItemCount.jsx" copy
import { Tx, Plural } from 'gt-next/server';
Expand Down
2 changes: 1 addition & 1 deletion docs/en-US/next/api/config/with-gt-config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export default withGTConfig(nextConfig, {
## Notes
* `withGTConfig` integrates GT translation functionality into your Next.js app and must be used in the root configuration file.
* Parameters like `apiKey` and `projectId` can be set directly in the configuration or as environment variables.
* Advanced parameters like `renderSettings` and `_batchInterval` allow fine-grained control over translation behavior and performance.
* Advanced parameters like `renderSettings` and `batchInterval` allow fine-grained control over translation behavior and performance.

## Next steps
* Add [translation to your CD process](/docs/next/tutorials/quickdeploy).
4 changes: 2 additions & 2 deletions docs/en-US/next/api/strings/tx.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ A promise that resolves to a string containing the translated content, or the or

The `tx` function translates strings at runtime.
This means that translations are performed live, so you can translate content that is only known at runtime.
The trade off is that there is a delay while waiting for an on-demand translation to load is significantly slower.
The trade off is that waiting for an on-demand translation to load is significantly slower.

Our advice is to translate everything you can at build time using [`getGT`](/docs/next/api/strings/use-gt), [`useGT`](/docs/next/api/strings/use-gt), or [`<T>`](/docs/next/api/components/t),
Our advice is to translate everything you can at build time using [`getGT`](/docs/next/api/strings/get-gt), [`useGT`](/docs/next/api/strings/use-gt), or [`<T>`](/docs/next/api/components/t),
and only use on-demand translations, like `tx` and [`<Tx>`](/docs/next/api/components/tx), when necessary.

Make sure to follow the [deployment guide here](/docs/next/tutorials/quickdeploy).
Expand Down
2 changes: 1 addition & 1 deletion docs/en-US/next/guides/cache-components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const config = {
matcher: ['/((?!api|static|.*\\..*|_next).*)']
};

````
```
</Step>
<Step>
### Add the `locale` parameter to cached components with translatable content
Expand Down
4 changes: 2 additions & 2 deletions docs/en-US/next/guides/dictionaries.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ async function MyServerComponent() {

return (
<div>
<h1>{t('greetings.hello')}</h1>
<p>{t('greetings.welcome')}</p>
<h1>{d('greetings.hello')}</h1>
<p>{d('greetings.welcome')}</p>
</div>
);
}
Expand Down
2 changes: 0 additions & 2 deletions docs/en-US/overview/ai-tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ We provide several resources to help your AI tools work with General Translation

## llms.txt

### llms.txt

Provide your AI coding tools with our [llms.txt](/llms.txt) file for a brief summary of our docs in an LLM-friendly format.

### llms-full.txt
Expand Down
2 changes: 1 addition & 1 deletion docs/en-US/platform/supported-locales.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Supported Locales
description: A list of the locales currently supported by General Translation
---

## Search locales
## Search locales

Below is a list of all the [locales](/docs/core/locales) currently supported by the General Translation platform.

Expand Down
14 changes: 7 additions & 7 deletions docs/en-US/react/faqs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ title: FAQs
description: Frequently asked questions about gt-react
---

### What happens if there are missing translations in production?
## What happens if there are missing translations in production?

If a translation for some content is missing in production, gt-react automatically falls back to the original source text. Your app will still render correctly — users will just see the default language for that piece of content.

### Why do I have to install the CLI tool?
## Why do I have to install the CLI tool?

The CLI tool parses the content inside all `<T>` components and generates translations for that content in advance, so that all the translations are ready when your app is deployed to production.

In development, you don't need it because you can use development API keys to translate on demand.

### Where does the `<T>` component get its translations?
## Where does the `<T>` component get its translations?

`<T>` can load translations from anywhere depending on how you've configured the library:
- If you have a project ID, the library can hit a free CDN
Expand All @@ -26,15 +26,15 @@ During development, the `<T>` component hits an API which uses a small AI model

In production, `<T>` won't do this, so your API keys are never exposed to the client.

### Does AI translation work with dynamic content and variables?
## Does AI translation work with dynamic content and variables?

The `<T>` component doesn't support translating dynamic content and variables directly, because the translations could potentially change with every re-render. However, you can still include dynamic content inside a `<T>` by wrapping it with `<Var>`, `<DateTime>`, or `<Currency>` components. This is similar to how other libraries handle string interpolation.

### Can I deploy my app without depending on GT servers?
## Can I deploy my app without depending on GT servers?

Yes. You can do the translations yourself, then load them from your own bundle or your own CDN. See the [loadTranslations docs](/docs/react/api/config/load-translations) for details on loading translations from local files.

### Why do I get `ReferenceError: TextEncoder is not defined` in Jest?
## Why do I get `ReferenceError: TextEncoder is not defined` in Jest?

`jest-environment-jsdom` uses an older version of jsdom that doesn't include `TextEncoder`. GT libraries use it internally for hashing. This will resolve itself once Jest updates its jsdom dependency (newer jsdom versions already support `TextEncoder`), but in the meantime you can polyfill it with a setup file:

Expand All @@ -52,6 +52,6 @@ Then add it to your Jest config:
}
```

### How do I migrate from react-intl or i18next?
## How do I migrate from react-intl or i18next?

See the [migration guide](/docs/react/guides/migration) for step-by-step instructions on migrating from other i18n libraries.
Loading