DocsStart here

Introduction

What Generic Translation is, the pieces it is made of, and where to start.

On this page

Quickstarts

Generic Translation is an internationalization (i18n) platform built around one idea: the source text stays in your code, and everything else is derived from it.

You write a sentence inside a component. A build step turns it into a standard ICU message and identifies it by a hash of its content. A translation service produces that message in other languages. Your app loads a map from hash to translation and renders it.

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>
  );
}

The component above yields the message Hello <0>{name}</0>, welcome back. When the active locale is Spanish and a translation exists, the user sees the Spanish sentence with their name still wrapped in <strong>.

The pieces

What you can use without the rest

The parts are deliberately separable.

  • Libraries only. @generic-translation/react and @generic-translation/node render from translation maps wherever they come from. If you already have translations, or want to write them by hand, you never need an account.
  • Libraries + CLI + hosted API. The common setup. The CLI extracts messages and the hosted service translates them. Translations are written into your repo, published to the CDN, or both.
  • API only. Call the translate endpoint from any language to translate ICU strings or whole files.
  • Self-hosted. Run the API on your own Cloudflare account and point everything at it with baseUrl.

Where to start

  1. Pick a quickstart: Next.js App Router, Vite + React or Node + Express.
  2. Read Key concepts once. It is short, and the rest of the docs assume it.
  3. Keep the CLI reference and React reference open while you build.

Status

Generic Translation is in preview. The hosted service is free with fair-use rate limits and has no uptime guarantee; see pricing. Interfaces may still change, and changes are listed in the changelog. Questions and bug reports go to GitHub issues.

Something wrong or unclear on this page? Open an issue.

Type to search the documentation.