Type to search the documentation.

Introducing Generic Translation

What Generic Translation is, why the source text stays in your code, and what the first preview release includes.

Generic Translation is a toolkit for translating software. It has open-source libraries for React, Next.js and Node, a command line tool, a hosted translation API with a CDN, and a dashboard for reviewing what the machine wrote. Today we are putting the first preview of all of it online.

This post explains the idea, the parts, and what is still rough.

The idea: source text is the key

Most i18n setups ask you to invent a key for every string (checkout.summary.title), keep a source-language file of keys, and keep your components and that file in sync. The keys carry no meaning, drift from the code, and make the one person who does read the translation file (a translator or a model) guess what the sentence is for.

Generic Translation goes the other way. You write the sentence where it is used:

import { T, Var } from "@generic-translation/react";

export function Greeting({ name }: { name: string }) {
  return (
    <T>
      Hello <strong><Var name="name">{name}</Var></strong>, welcome back.
    </T>
  );
}

A build step turns that into an ICU message, Hello <0>{name}</0>, welcome back., and the message is identified by a hash of its content. Change the sentence and it is a new message that gets translated again. Leave it alone and its translations keep working. There is no key file to maintain.

The loop

  1. Write your UI in the source language, using <T>, useGenericTranslation() or a dictionary.
  2. Extract with the CLI. It scans your code, serializes JSX the same way the runtime does, and produces the list of messages.
  3. Translate with AI. Each message is sent with its context note, your project instructions (tone, formality) and your glossary, so product names stay as they are and terms are used consistently.
  4. Review in the editor. Every translation has a status (machine, edited, approved). Placeholders and tags are validated against the source, so an edit that drops {name} is rejected.
  5. Publish to the CDN. Your app loads a small JSON map from hash to translation and renders it. You can also write the maps to your own public/ folder and skip the CDN entirely.

The parts

What this release is, and is not

This is a preview. The libraries are MIT-licensed and free. The hosted service is free while it is in preview, with fair-use rate limits, and has no SLA. The packages are not published to npm yet, so for now you install them from GitHub; the quickstarts show how. You can also run the API yourself on your own Cloudflare account.

Machine translation is a starting point, not a guarantee. That is why the review states exist, and why you can require approval before anything reaches the CDN.

Try it, tell us what breaks

Open the playground to see the message format working, read the introduction, or open an issue on GitHub if something is unclear or broken. We read all of them.

All posts