Demo translations
The demo shows translation as a site that has been translated for a while: Translation status with every Danish page up to date, translation memory with the AI's drafts and the wording people changed, the review's notes at the copy desk, proposals from Distill waiting for approval, and the front page and products in German. None of the AI's text is made up: it is one real run of the kit's own translator, recorded once and replayed by the seed, so the demo never calls the AI while seeding and every draft, review note, proposal and German page is what the translator really wrote. The Danish that is live is the demo's own.
What the seed replays #
The recordings are in scripts/demo/assets/translations/, one file per language (da.json, de.json), and one for a Distill run over the Danish corrections (da.distill.json). Each one names the quality level and model that made it. A language's file holds:
- the translated documents and globals, field by field, with the English each field was translated from;
- the AI's drafts, text by text, as translation memory recorded them;
- the review: what the second reading changed in the drafts, and why.
The seed (scripts/demo/translations/apply.ts, the last step of pnpm seed:demo) then does, per language:
- Danish: the demo's own Danish stays live. The AI's drafts go into translation memory first; the seed then learns from the published Danish as the site does after any publish, so memory approves the wording a person changed and keeps an
editcorrection for each change. Documents without Danish of their own (the editors' guides) get the AI's Danish. - German: the front page, the five products, the header, footer and site settings get the AI's German, published. Everything else is left in English for visitors to translate with ✨.
- Both: every translated document gets its translation record, so Translation status shows it up to date and shows "Needs an update" when its English changes. The review's changes wait at the copy desk ("From the last Translation review"), and its corrections in the Quality panel.
- Distill: what one Distill run made of the Danish corrections (the newest 200, as the Quality panel's button reads them) waits for a person: notes and example pairs in Translation proposals, and unreviewed glossary terms. The corrections it read are marked as distilled; the rest wait for a visitor to press Distill.
A recorded text whose English has changed in the seed since the recording is left out, and tests/int/demoSeed.int.spec.ts fails until the recording is made again.
Recording again #
Record again after changing the demo's English text, or to show a newer model. It costs money: every document is translated with your key at the style guide's quality (Premium for the demo), with a draft and a review per batch; the whole demo is about 110 model calls.
Start the site with your key on a scratch database whose name ends in
-translation-run(the script refuses any other, as it seeds it afresh):ANTHROPIC_API_KEY=… DATABASE_URL=mongodb://127.0.0.1:27017/tolk-translation-run NEXT_PUBLIC_SERVER_URL=http://localhost:3040 pnpm dev -p 3040In a second terminal, with the same
DATABASE_URL:DATABASE_URL=mongodb://127.0.0.1:27017/tolk-translation-run pnpm demo:translations --site http://localhost:3040It seeds the demo in English only, signs in as an admin made for the run, and translates through the site's own endpoints, as Translation status does: every item into Danish, three at a time, and
--german(defaultpages:home,globals:header,globals:footer,globals:site-settings) into German.--danish noneskips Danish. It then writes the two files.To add to a recording rather than make it again, seed the whole demo with its history first (
--seed demo) and export only the language you added to (--export de). The products' German and the Distill run were added this way:DATABASE_URL=mongodb://127.0.0.1:27017/tolk-translation-run pnpm demo:translations --site http://localhost:3040 --seed demo --danish none --german products:column,products:drift,products:line,products:sub,products:dial --distill da --export de--distill dapresses Distill once for Danish after translating and writesda.distill.json.--export-onlywrites the files again from the scratch database without translating.Run
pnpm seed:demo --reset(withDEMO_RESET=true) on your demo database and look at Translation status, Translation memory and a page's copy desk. Drop the scratch database.
If you remove the demo, delete scripts/demo/translations/ and scripts/demo/assets/translations/ with it and take the demo:translations script out of package.json.