DocsStart here
Introduction
What Generic Translation is, the pieces it is made of, and where to start.
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
@generic-translation/react
Components and hooks for React, with entry points for Next.js.
@generic-translation/node
Translate messages on a Node server and detect the request locale.
@generic-translation/core
The message format, hashing, locale utilities and API client. Zero dependencies.
generic-translation CLI
Extracts messages from source, sends new ones for translation, writes files.
REST API
Runtime and batch translation, strings, files, publishing and webhooks.
Dashboard
Projects, the review editor, glossary, API keys and usage.
What you can use without the rest
The parts are deliberately separable.
- Libraries only.
@generic-translation/reactand@generic-translation/noderender 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
- Pick a quickstart: Next.js App Router, Vite + React or Node + Express.
- Read Key concepts once. It is short, and the rest of the docs assume it.
- 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.