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
4 changes: 2 additions & 2 deletions 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 Expand Up @@ -40,7 +40,7 @@ The goal with gt-next is to create an abundance mindset around translations. The
- Get an API key 🔐 on our [platform](https://generaltranslation.com)
- Read the [docs](https://generaltranslation.com/docs) 📄

### What you can do with gt-next
## What you can do with gt-next

#### Format variables and plurals

Expand Down
2 changes: 0 additions & 2 deletions blog/en-US/i18n-without-translation-files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ 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.
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
2 changes: 0 additions & 2 deletions devlog/en-US/gt-react_v10_15_0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ 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.
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
2 changes: 0 additions & 2 deletions devlog/en-US/gt-react_v10_19_0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ 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' />

## Overview
Expand Down
2 changes: 0 additions & 2 deletions devlog/en-US/react-core-linter_v0_1_0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ 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' />

## Installation
Expand Down
2 changes: 1 addition & 1 deletion docs/en-US/cli/generate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ npx gt generate

## Overview

The `gt generate` command generates a source file for your project for your default locale and supported locales.
The `gt generate` command generates a source file for your project's default locale and supported locales.

The generated files are compatible with the [`gt-next`](/docs/next), [`gt-react`](/docs/react), and [`gt-react-native`](/docs/react-native) libraries, and are the same format used by the `translate` command.

Expand Down
2 changes: 0 additions & 2 deletions docs/en-US/core/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ 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' />

```typescript title="index.ts"
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 @@ -96,7 +96,7 @@ In order to translate a file, you need to follow these four steps:
4. Download the translated file.

<Callout type='info'>
#### Why not just one call? Typically, people will want to translate many
Why not just one call? Typically, people will want to translate many
files at once. By breaking these into four clear steps, it gives users much
more flexibility in how they can use the API.
</Callout>
Expand Down
4 changes: 2 additions & 2 deletions 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 All @@ -101,7 +101,7 @@ By wrapping private information in a `<Var>` component, you can ensure that the
<Callout>
**Exceptions**

The exceptions to the statement above are (1) in the case of a nested `<T>` component used inside of a `<Var>` component (ie, the children of the nested `<T>` component will be translated)
The exceptions to the statement above are (1) in the case of a nested `<T>` component used inside of a `<Var>` component (i.e., the children of the nested `<T>` component will be translated)
or (2) when data is passed intentionally to our API via some other means within a child of the `<Var>` component (i.e., a fetch call).
However, this is not the intended use of the `<Var>` component nor the General Translation API and doing so can harm load times and performance.

Expand Down
2 changes: 1 addition & 1 deletion docs/en-US/locadex/auto-merge.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Click the rule blocking auto-merge, then:
1. Click "Add Bypass"
2. Select "Locadex Agent" from the dropdown

![Add Bypass button with "Locadex Agent selected"](https://assets.gtx.dev/locadex-screenshots/auto-merge/add-bypass.png)
![Add Bypass button with "Locadex Agent" selected](https://assets.gtx.dev/locadex-screenshots/auto-merge/add-bypass.png)

### Step 4: Save changes

Expand Down
2 changes: 0 additions & 2 deletions docs/en-US/locadex/next.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ Translating your Next.js app into French 🇫🇷, Spanish 🇪🇸, Japanese
**Locadex is an AI agent built to handle 100% of the internationalization (i18n) work for you.**
It takes 5 minutes to install.

{/* ![Installation screen for Locadex](/images/screenshots/locadex-install.png) */}

Locadex:

- Configures your project to use the gt-next i18n library
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 @@ -76,7 +76,7 @@ The trade off is that there is a delay while waiting for an on-demand translatio
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.

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

Make sure to follow the [deployment guide here](/docs/next/tutorials/quickdeploy).
Expand Down
4 changes: 1 addition & 3 deletions docs/en-US/next/api/middleware/create-next-middleware.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ You can remove the default locale prefix by setting the `prefixDefaultLocale` op

```js title="proxy.ts" copy
export default createNextMiddleware({
prefixDefaultLocale: true,
prefixDefaultLocale: false,
});
```

Expand All @@ -111,5 +111,3 @@ If you set this to `false` (which is the default), then only the default locale

## Notes
* The `createNextMiddleware` function is a utility function that creates a proxy/middleware function for use with Next.js. Place it in `proxy.ts` in your project root.

## Next steps
2 changes: 1 addition & 1 deletion docs/en-US/next/api/strings/tx.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ 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.

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.
1 change: 0 additions & 1 deletion docs/en-US/next/guides/local-tx.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,3 @@ export default async function loadTranslations(locale: string) {

- [Middleware Guide](/docs/next/guides/middleware) - Language detection and routing
- [Languages Guide](/docs/next/guides/languages) - Configure supported languages
- API References:
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 @@ -271,5 +271,4 @@ export default function RootLayout({
```
</Tab>
</Tabs>
## Conclusion

4 changes: 2 additions & 2 deletions docs/en-US/next/tutorials/translating-strings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function MyComponent() {
const gt = useGT();
return (
<div>
<h1>{gt('Hello there, {username}', { variables: { username: 'Brian123' }})}</h1> // [!code highlight]
<h1>{gt('Hello there, {username}', { username: 'Brian123' })}</h1> // [!code highlight]
</div>
);
}
Expand Down Expand Up @@ -100,7 +100,7 @@ export default async function MyComponent({ username }) {
## Notes
* For translating strings, use [`useGT`](/docs/next/api/strings/use-gt), [`getGT`](/docs/next/api/strings/get-gt), and [`tx`](/docs/next/api/strings/tx).
* `useGT` and `getGT` translate before deployment, whereas `tx` translates at runtime. Use `tx` sparingly.
* Variables can be added to strings using the `{ variables: { key: value } }` pattern.
* Variables can be added to strings using the `{ key: value }` pattern, passed as top-level keys in the options object.

## Next steps
* Return to the [Quickstart Guide](/docs/next) to finish setting up your project for translation.
Expand Down
6 changes: 3 additions & 3 deletions docs/en-US/overview/faqs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ title: FAQs
description: Frequently Asked Questions
---

### What is a locale?
## What is a locale?

A locale is **a language or dialect**.
For example, `en-US` is a locale code, which refers to the English language as spoken in the United States of America.

* [Read more about locales](/docs/core/locales)
* [List of supported locales](/docs/platform/supported-locales)

### Can I use the libraries without using the General Translation platform?
## Can I use the libraries without using the General Translation platform?

Yes you can!
General Translation internationalization libraries are free, open-source, and can be configured to fetch translations from any source.

Read the docs on how to load your own translations [here](/docs/next/api/config/load-translations).

### Section-specific FAQs
## Section-specific FAQs

- [Platform](/docs/platform/faqs)
- [Locadex AI Agent](/docs/locadex/faqs)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-US/overview/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ General Translation is trusted by incredible developer-first companies like
<a target="_blank" href="https://cursor.com">Cursor</a>,
<a target="_blank" href="https://cognition.ai">Cognition</a>,
and
<a target="_blank" href="https://clickhouse.com">Clickhouse</a>,
<a target="_blank" href="https://clickhouse.com">ClickHouse</a>,
in addition to world-class product companies like
<a target="_blank" href="https://ramp.com">Ramp</a>,
<a target="_blank" href="https://tryprofound.com">Profound</a>,
Expand Down
14 changes: 7 additions & 7 deletions docs/en-US/python/guides/strings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Use [`t()`](/docs/python/api/t) to translate a string in the current request's l

## Pre-registered strings with `msg()`

Use [`msg()`](/docs/python/api/t) to register strings at module scope, then call them in handlers:
Use `msg()` to register strings at module scope, then call them in handlers:

```python title="messages.py"
from gt_flask import msg # or gt_fastapi
Expand Down Expand Up @@ -103,17 +103,17 @@ message = t('You have {count} {item}.', count=count, item=item_word)

See the [derive tutorial](/docs/python/tutorials/derive) for more patterns.

## Using `$context` for disambiguation
## Using `_context` for disambiguation

Ambiguous strings can produce inaccurate translations. Add `$context` to guide the translator:
Ambiguous strings can produce inaccurate translations. Add `_context` to guide the translator:

```python
t('Apple', context='the technology company')
t('Spring', context='the season, not a coil')
t('Bank', context='a financial institution')
t('Apple', _context='the technology company')
t('Spring', _context='the season, not a coil')
t('Bank', _context='a financial institution')

# Also works with msg()
APPLE = msg('Apple', context='the fruit')
APPLE = msg('Apple', _context='the fruit')
```

## Next steps
Expand Down
2 changes: 0 additions & 2 deletions docs/en-US/react-core-linter/guides/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ description: Quickstart guide for the React Core Linter
This is an ESLint plugin designed to be used with any of our i18n libraries, `gt-react`, `gt-next`, or `gt-react-native`.
It checks for common implementation errors and offers fixes.

import Video from '@/components/Video';

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

## Installation
Expand Down
2 changes: 0 additions & 2 deletions docs/en-US/react-core-linter/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ description: ESLint plugin for GT React libraries

It checks for issues like dynamic content inside `<T>` components and dynamic strings in translation functions, and offers autofixes.

import Video from '@/components/Video';

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

## Rules
Expand Down
2 changes: 1 addition & 1 deletion docs/en-US/react-core-linter/rules/static-string.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Ensures that translation functions like [`gt`](/docs/react/api/strings/use-gt) a

### staticStringRequired

Registration functions can only accept static strings.
Translation functions can only accept static strings.

#### ❌ Incorrect

Expand Down
Loading
Loading