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: 1 addition & 3 deletions blog/en-US/i18n-without-translation-files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ authors: [jackie]
tags: ['guide', 'internationalization', 'nextjs', 'i18n', 'gt-next', 'translation-files', 'developer-experience']
---

import Video from '@/components/Video';

Everyone who's internationalized a JavaScript app knows the workflow. You install an i18n library, create an `en.json` file, pull every user-facing string out of your components, assign each one a key, and reference the key where the string used to be. Then you duplicate that JSON file for every language you support. `es.json`, `fr.json`, `ja.json`.

At first, it's fine. Thirty strings, three languages, 90 entries.

Then your app grows. Six months later you have 400 strings and 12 languages. 4,800 entries across a dozen files. A developer adds a new feature, writes five new strings, forgets to update three of the translation files. Nobody notices until a user in Tokyo sees English fallbacks in a Japanese interface. Someone suggests buying a translation management system.

<Video src='https://assets.gtx.dev/i18n-no-translation.mp4' />
<video controls src="https://assets.gtx.dev/i18n-no-translation.mp4" />

## The file management tax

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
8 changes: 4 additions & 4 deletions 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 Expand Up @@ -87,7 +87,7 @@ pluralize(2, 'child', 'children') // "children"

But what if you need more complicated logic, like:

```
```text
"No one is watching"
"1 person is watching"
"2 people are watching"
Expand Down Expand Up @@ -168,7 +168,7 @@ languages like Arabic and Polish have more than just these two forms.

For example, an English-speaking user might expect:

```
```text
"No one is watching"
"1 person is watching"
"2 people are watching"
Expand All @@ -177,7 +177,7 @@ For example, an English-speaking user might expect:
Whereas an Arabic-speaking user might expect different expressions for singular,
dual (when the count is exactly two things), and small and large plural forms:

```
```text
"لا أحد يشاهد"
"1 شخص يشاهد"
"2 شخصان يشاهدان"
Expand Down
4 changes: 2 additions & 2 deletions devlog/en-US/gt-i18n_v0_1_0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Though `generaltranslation` is also a runtime-agnostic library, it is—by desig

## What's Included

- **[`msg()`](#)** - String registration and variable interpolation
- **[`mFallback()`](#)** and **[`gtFallback()`](#)** - Migration helpers for incremental adoption
- **`msg()`** - String registration and variable interpolation
- **`mFallback()`** and **`gtFallback()`** - Migration helpers for incremental adoption

---

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
4 changes: 1 addition & 3 deletions devlog/en-US/gt-react_v10_15_0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ authors: [ernest]
tags: ['gt-react', 'derive', 'tagged-template', 'i18n']
---

import Video from '@/components/Video';

## The `declareStatic()` → `derive()` rename

This release is the first to ship with the new `derive()` name. Previously, this function was called `declareStatic()` and the JSX component was `<Static>`. In [PR #1062](https://github.com/generaltranslation/gt/pull/1062), both were renamed to `derive()` and `<Derive>` for clarity.

<Video src='https://assets.gtx.dev/derive-animation.mp4' />
<video controls src="https://assets.gtx.dev/derive-animation.mp4" />

## Overview

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
4 changes: 1 addition & 3 deletions devlog/en-US/gt-react_v10_19_0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ authors: [ernest]
tags: ['gt-react', 'browser', 'hot-reload', 'dev-experience', 'i18n']
---

import Video from '@/components/Video';

<Video src='https://assets.gtx.dev/devlogs/gt-react-browser-tx-hot-reload.mp4' />
<video controls src="https://assets.gtx.dev/devlogs/gt-react-browser-tx-hot-reload.mp4" />

## Overview

Expand Down
4 changes: 1 addition & 3 deletions devlog/en-US/react-core-linter_v0_1_0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ tags: ['react-core-linter', '0.1.0', 'eslint', 'linting', 'static-validation']

This plugin catches common implementation errors that we have seen in the wild.

import Video from '@/components/Video';

<Video src='https://assets.gtx.dev/docs/react-core-linter/web-0.1.0.mp4' />
<video controls src="https://assets.gtx.dev/docs/react-core-linter/web-0.1.0.mp4" />

## Installation

Expand Down
1 change: 1 addition & 0 deletions docs/en-US/api/branches/getBranchInfo.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Get branch information
description: Get information about a branch.
full: true
_openapi:
method: POST
Expand Down
1 change: 1 addition & 0 deletions docs/en-US/api/context/getContextStatus.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Get context generation job status
description: Get the status of a context generation job.
full: true
_openapi:
method: GET
Expand Down
1 change: 1 addition & 0 deletions docs/en-US/api/context/shouldGenerateContext.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Check if context generation is needed
description: Check whether context generation is needed for the project.
full: true
_openapi:
method: GET
Expand Down
1 change: 1 addition & 0 deletions docs/en-US/api/files/getTranslationStatus.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Get translation status for a file
description: Get translation status for a specific file.
full: true
_openapi:
method: GET
Expand Down
1 change: 1 addition & 0 deletions docs/en-US/api/jobs/getJobsInfo.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Get translation job status
description: Get the status of one or more translation jobs.
full: true
_openapi:
method: POST
Expand Down
1 change: 1 addition & 0 deletions docs/en-US/api/project/getProjectInfo.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Get project information
description: Get information about a project.
full: true
_openapi:
method: GET
Expand Down
4 changes: 1 addition & 3 deletions docs/en-US/core/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ description: Overview of the generaltranslation library
The `generaltranslation` library serves as GT's core i18n library housing utility functions and classes for translation and formatting.
It is often used with framework packages like `gt-next` and `gt-react`, but can be used as a standalone library.

import Video from '@/components/Video';

<Video src='https://assets.gtx.dev/core-demo.mp4' />
<video controls src="https://assets.gtx.dev/core-demo.mp4" />

```typescript title="index.ts"
import { GT } from 'generaltranslation';
Expand Down
2 changes: 1 addition & 1 deletion docs/en-US/core/locales.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Together, `zh-Hant-HK` means "Chinese, written in traditional characters, as spo
See the [list of supported locales](/docs/platform/supported-locales) for a searchable list of all locales currently supported by General Translation.

Technically, the library supports any validly constructed tag, including private use codes with no widely recognized meaning.
However, the platform will only translate
However, the platform will only translate to locales in the [list of supported locales](/docs/platform/supported-locales).

### Equivalent locale tags

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
2 changes: 1 addition & 1 deletion docs/en-US/key-concepts/dynamic-content.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default function Greeting(name) {
As far as translation goes this has two benefits:
1. You do not have to create a translation for every possible name.
* Using `<Var>`, we only generate one translation that essentially would look like this:
* \`¡Hola, $\{name\}!\`
* `¡Hola, ${name}!`
* If we do not use `<Var>`, we would have to perform an on-demand translation for every unique name:
* "¡Hola, Alice!", "¡Hola, Bob!", "¡Hola, Charlie!", "¡Hola, David!", ...
2. You also don't have to worry about the names themselves changing into a translated form of their name: (i.e. "¡Hola, Alicia!", "¡Hola, Roberto!", ...).
Expand Down
2 changes: 1 addition & 1 deletion 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 there is a delay while waiting for an on-demand translation to load, which 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
8 changes: 4 additions & 4 deletions docs/en-US/next/api/config/with-gt-config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default withGTConfig(nextConfig, {
**Legacy**

`initGT` is the legacy way to configure the `gt-next` library. It returns a function callback which is then called on the `NextConfig` object.
The props for both functions are the same, with the exception that `withGTProps` requires `NextConfig` to also be passed in.
The props for both functions are the same, with the exception that `withGTConfig` requires `NextConfig` to also be passed in.
</Callout>

Use `withGTConfig` to:
Expand Down Expand Up @@ -90,7 +90,7 @@ See the [gt.config.json](/docs/next/api/config/gt-config-json) reference for mor
| Prop | Description |
|----------------|-----------------------------------------------------------------------------|
| `defaultLocale`| Default locale for the application. English will be the fallback language when none is specified. |
| `locales` | An exclusive list of supported locales for the application. If a non-supported request is received will reroute to the browser's next-preferred language in the list. Will fallback to `defaultLocale` if no matches can be found. |
| `locales` | An exclusive list of supported locales for the application. If a non-supported request is received, it will reroute to the browser's next-preferred language in the list. Will fallback to `defaultLocale` if no matches can be found. |
| `description` | A natural language description of the site, used to aid translation. |

### Advanced props
Expand Down Expand Up @@ -217,7 +217,7 @@ If the translation is cached, response time is too low to justify loading behavi
Timeouts only apply to runtime translations, or translations that need to be performed on demand as they have not been cached.

Timeouts are set to 8 seconds by default.
This design decision is to facilitate vercel users who have a default 10-second timeout for serverless functions on the free plan.
This design decision is to facilitate Vercel users who have a default 10-second timeout for serverless functions on the free plan.

---

Expand Down 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 there is a delay while waiting for an on-demand translation to load, which 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
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const Component = () => {
## Notes
* Variables are passed as top-level keys in the options object, not nested under a `variables` key.

### Next steps
## Next steps
* See [dictionaries](/docs/next/guides/dictionaries) for more information on dictionaries and common practices.
* See [`useTranslations`](/docs/next/api/dictionary/use-translations) or [`getTranslations`](/docs/next/api/dictionary/get-translations) for more information on dictionaries interface.
* See [`ICU message format`](https://unicode-org.github.io/icu/userguide/format_parse/messages/) for more information on formatting options.
4 changes: 2 additions & 2 deletions 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 All @@ -88,7 +88,7 @@ export default async function Page() {
const locale = await getLocale()
return <CachedContent locale={locale} />
}
````
```

</Step>
</Steps>
Expand Down
2 changes: 1 addition & 1 deletion docs/en-US/next/guides/migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ You'll never have to wait for translations again.

1. Fully migrate your entire project to `gt-next`, and remove the old i18n library.
2. Fully migrate your project, but keep using dictionaries from the old i18n library.
2. Keep using the old i18n library for now, and only migrate part of your project to `gt-next`.
3. Keep using the old i18n library for now, and only migrate part of your project to `gt-next`.

For more details on each option, see the [migration strategies](#strategies) section.
</Step>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ npm i gt-next
```

### Set up your environment
Create a `.env` file in the root of your project and add your api key and project id.
Create a `.env` file in the root of your project and add your API key and Project ID.

```dotenv copy
GT_API_KEY="YOUR_GT_API_KEY"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ This will start the app on `http://localhost:3000`.
## Let's add some content!

Now that we have our app set up, let's overwrite the content of our app to display a simple currency converter.
Just copy and paste the following code into the `src/app/page.tsx` file and `src/app/layout.tsx` files.
Just copy and paste the following code into the `src/app/page.tsx` and `src/app/layout.tsx` files.


Don't worry too much about how it works for now.
All this code does is simulate a fetch to a currency exchange API and displays the exchange rate between two currencies.
All this code does is simulate a fetch to a currency exchange API and display the exchange rate between two currencies.

<Tabs items={['layout.tsx', 'page.tsx']}>
<Tab value="page.tsx">
Expand Down
8 changes: 4 additions & 4 deletions docs/en-US/next/tutorials/examples/next-speedrun.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ In total, this should take less than 10 minutes.

## Prerequisites

We assume that you either have experience using React in some capacity and are familiar with TypeScript.
We assume that you have experience using React in some capacity and are familiar with TypeScript.

---

Expand All @@ -39,10 +39,10 @@ npm i gt-next
npm i gt
```

## Step 3: Add your environment variables.
## Step 3: Add your environment variables

Navigate to the [Dashboard](https://generaltranslation.com/en-US/signin).
Go to the Dev Api Keys page on the nav bar and create a new API key and Project ID.
Go to the Dev API Keys page on the nav bar and create a new API key and Project ID.
Then add them to your `.env` file.

```bash copy
Expand Down Expand Up @@ -116,7 +116,7 @@ If you have set up everything correctly, you should see your app in the language
**Browser Cookies**

Check your browser's cookies for your app.
General translation uses cookies to store the user's language preference.
General Translation uses cookies to store the user's language preference.
The cookie is called `generaltranslation.locale`, and all you need to do is delete it.
It will be under `localhost:3000`.
Then, just double-check you are using the desired preferred language and then
Expand Down
Loading
Loading