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
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
6 changes: 3 additions & 3 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 @@ -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
2 changes: 1 addition & 1 deletion devlog/en-US/gt-next_v6_10_0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Cached components use their parameters as cache keys, any cached component that

When `experimentalLocaleResolution` is enabled:
- I18n proxy must be enabled for locale resolution to work (see [I18n Proxy](/docs/next/guides/middleware))
- It overrides any custom `getLocale` functions (locale resolution happens from the reading the URL path)
- It overrides any custom `getLocale` functions (locale resolution happens from reading the URL path)
- It disables `getRegion` and `getDomain` functions
- It conflicts with the deprecated `experimentalEnableSSG` configuration - only one can be enabled at a time
- You can customize the locale parameter name with `experimentalLocaleResolutionParam` (defaults to `'locale'`)
Expand Down
4 changes: 2 additions & 2 deletions devlog/en-US/gt-next_v6_2_0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export default function Page() {
We deliberately kept `gt()` synchronous to match other i18n libraries.
The downside was a `two-step translation process`:

1. Register the text with the API.
2. Wait for a second render to display the translated result.
1. Register the text with the API.
2. Wait for a second render to display the translated result.

Now, thanks to the compiler, translatable content is scanned ahead of time and passed directly into `useGT()` or `getGT()` at compile time.
This means translations are immediately available at runtime — no page refreshes.
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: 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/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 into locales that are officially supported.

### Equivalent locale tags

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/t.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ This ensures fast load times for all locales, but it can only translate content

Once generated, translations are either (1) stored in the CDN or (2) stored in your app's build output, according to your configuration.
From there, the translated content is served to your users.
If a translation is not found, it will fallback to the original content.
If a translation is not found, it will fall back to the original content.

Make sure to follow the [deployment guide here](/docs/next/tutorials/quickdeploy).

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,12 +71,12 @@ 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 on-demand translation is significantly slower, since there is a delay while waiting for the translation to load.

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
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 @@ -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
6 changes: 3 additions & 3 deletions docs/en-US/next/api/dictionary/use-translations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ For async components, see [`getTranslations`](/docs/next/api/dictionary/get-tran

### Returns

A translation function `d` that, given an id, will return the translated version of the corresponding entry
A translation function `t` that, given an id, will return the translated version of the corresponding entry

```jsx
(id: string, options?: DictionaryTranslationOptions) => string
Expand All @@ -53,7 +53,7 @@ A translation function `d` that, given an id, will return the translated version
| Name | Type | Description |
|-----------------------|--|-----------------------------------------------------------------------------|
| `id` | `string` | The id of the entry to be translated |
| `options?` | [`DictionaryTranslationOptions`](/docs/next/api/types/dictionary-translation-options) | Translation options to customize the behavior of `d`. |
| `options?` | [`DictionaryTranslationOptions`](/docs/next/api/types/dictionary-translation-options) | Translation options to customize the behavior of `t`. |

---

Expand Down Expand Up @@ -86,7 +86,7 @@ export default async function TranslateGreeting() {
```

### Using variables [#variables]
In order to pass values, you must (1) assign an identifier and (2) reference the identifier when calling the `d` function.
In order to pass values, you must (1) assign an identifier and (2) reference the identifier when calling the `t` function.

In this example, we use `{}` to pass variables to the translations.
In the dictionary, we assign identifier `{userName}`.
Expand Down
4 changes: 2 additions & 2 deletions docs/en-US/next/api/helpers/get-locale.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ When an unsupported locale is requested, a fallback locale will be selected.
For instance, in the event of an unsupported locale,
if (1) the user has configured multiple preferred locales in their browser settings,
and (2) one of these locales is supported by your application,
then the locale will fallback to the best language.
then the locale will fall back to the best language.

Additionally, if no possible fallback locales are available,
but two locales share the same language (e.g., `en-US` and `en-GB`),
then the locale will fallback to the supported locale that shares the same language.
then the locale will fall back to the supported locale that shares the same language.

If neither condition can be met, then the default locale will be used.

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
4 changes: 2 additions & 2 deletions docs/en-US/next/api/strings/get-gt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ This ensures fast load times for all locales, but it can only translate content

Once generated, translations are either (1) stored in the CDN or (2) stored in your app's build output, according to your configuration.
From there, the translated content is served to your users.
If a translation is not found, it will fallback to the original content.
If a translation is not found, it will fall back to the original content.

Make sure to follow the [deployment guide here](/docs/next/tutorials/quickdeploy).

Expand Down Expand Up @@ -148,7 +148,7 @@ export default async function TranslateGreeting() {

## Notes
* The `getGT` function is a server-side function that translates strings.
* Translations strings with `getGT` happen before runtime, during the build process (unless in development).
* Translation strings with `getGT` happen before runtime, during the build process (unless in development).

## Next steps
* See [`useGT`](/docs/next/api/strings/use-gt) for client-side string translations at buildtime.
Expand Down
4 changes: 2 additions & 2 deletions docs/en-US/next/api/strings/get-messages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ This ensures fast load times for all locales, but it can only translate content

Once generated, translations are either (1) stored in the CDN or (2) stored in your app's build output, according to your configuration.
From there, the translated content is served to your users.
If a translation is not found, it will fallback to the original content.
If a translation is not found, it will fall back to the original content.

Make sure to follow the [deployment guide here](/docs/next/tutorials/quickdeploy).

Expand Down Expand Up @@ -152,7 +152,7 @@ export default async function TranslateGreeting() {

## Notes
* The `getMessages` function is a server-side function that translates encoded strings from `msg`.
* Translations strings with `getMessages` happen before runtime, during the build process (unless in development).
* Translation strings with `getMessages` happen before runtime, during the build process (unless in development).

## Next steps
* See [`useMessages`](/docs/next/api/strings/use-messages) for client-side string translations from encoded strings at buildtime.
Expand Down
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 on-demand translation is significantly slower, since there is a delay while waiting for the translation to load.

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
4 changes: 2 additions & 2 deletions docs/en-US/next/api/types/dictionary-translation-options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ See [`tx`](/docs/next/api/strings/tx) for translating strings with dynamic conte

### Passing variables

In order to pass a variable to the dictionary entry, we need to do two things: (1) add a variable to the entry and (2) reference said variable in the [`d`](/docs/next/api/strings/use-gt) invocation.
In order to pass a variable to the dictionary entry, we need to do two things: (1) add a variable to the entry and (2) reference said variable in the [`t`](/docs/next/api/dictionary/use-translations) invocation.

First, we add a variable to the dictionary entry with the following syntax: `{username}`.
`username` is the name of the variable.
Expand Down 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.
2 changes: 1 addition & 1 deletion docs/en-US/next/concepts/environments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ When rendering a component (that uses `useGT`, `<T>`, or `useTranslations`) in a
1. If it detects a valid, stored translation for the given content, it will render the translation.
2. If no translation is found, it will attempt to dynamically translate the content via the General Translation API.
3. After translating, the translation will be rendered, and stored in memory for future use.
4. If the translation times out, it will fallback and render the original content.
4. If the translation times out, it will fall back and render the original content.

<Callout type="info">
Our API also internally caches development translations for a short period of time, so if the same translation is requested again, it will be served from cache.
Expand Down
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
2 changes: 1 addition & 1 deletion docs/en-US/next/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ That's it — your app is now multilingual. 🎉
<T context="the technology company">Apple</T>
```

Both `<T>`, `useGT()`, and `getGT()` support the `context` option.
All of `<T>`, `useGT()`, and `getGT()` support the `context` option.
</Accordion>
</Accordions>

Expand Down
2 changes: 1 addition & 1 deletion docs/en-US/next/tutorials/examples/next-speedrun.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ npm i gt
## 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
2 changes: 1 addition & 1 deletion docs/en-US/overview/faqs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ For example, `en-US` is a locale code, which refers to the English language as s

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

Yes you can!
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).
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
Loading
Loading