Skip to content

Open source CapCut alternative.

TypeScript
2.7 KB
Raw Blame

Translations

Donkey Cut ships in English, Spanish, Brazilian Portuguese, French, German, Japanese, Korean and Simplified Chinese, on the site, the Mac app and the iOS app. People write English; a script writes every other language from it.

The one rule: every string a person reads comes from a catalog. The lint guard fails literal text in JSX.

How it works

request (no language in the URL)
  ↓
proxy: the language cookie, else the browser's Accept-Language
  ↓
rewrite to the hidden language segment of the route tree
  ↓
server renders <html lang> and hands each subtree only its catalogs
  ↓
picker or account change → write the cookie → reload

One URL serves every language, so pages stay static per language and caches key on the URL. Crawlers get English. Only the pickers and the account write the cookie; a detected language never lands in the cookie.

A signed-in account carries its language. When the editor loads, a stored language that differs from the page switches the page to it, and an account with none takes the page's. Emails and headless chat turns read the account's language.

Catalogs

English lives in one JSON file per area, and its keys type every t() call, so a missing key is a compile error. Messages use ICU: arguments for interpolation, plurals for counts, one message per sentence. Never build a sentence from translated fragments.

Registry labels (effects, transitions, looks) keep their English in the registry for the model, and the UI looks each id up in the labels catalog. A test keeps the two in step.

A failure a person reads is thrown as a coded error with its English message. The page words it from the errors catalog by code; logs and the model keep the English.

What stays English

Stays English Why
Prompts, tool descriptions, model-facing errors The model reads them
Privacy and Terms bodies The English text is binding
Blog articles Not translated yet; they will take a language prefix when they are
Brand names, shortcuts, file formats The glossary holds them fixed
Super-user settings and flags Only operators read them

The chat answers in the interface language unless the person writes in another.

The translation script

bun scripts/i18n-translate.ts translates every key that is new or whose English changed, using a lock file of English hashes per catalog. Each result must keep its English's arguments, plurals and tags; one that drifts is retried once and then fails the run. It also fills the Mac and iOS String Catalogs and the back office's email catalogs (--dir), and --check fails when anything is stale. A glossary pins one word per editing term in each language, and notes give ambiguous keys their context.