Repository navigation
Translate the app into 56 languages - #81
Merged
Merged
Conversation
scripts/translations.py now knows every language the app ships (LANGUAGES: the desktop app's languages except the right-to-left ones, with their Android folder qualifiers, language tags, scripts and CLDR plural quantities) and checks each translation: every key present, placeholders identical, plural quantities complete, escaping, text still in English or in the wrong script, core_language_tag and appLanguages. scripts/translate.py fills in only the missing strings with an Anomaly Console model through `opencode run`, passing the desktop app's translations of the terms each batch uses and the desktop locale glossaries so the app's words match desktop. Every answer goes through the same checks; --review has a second model check and fix existing translations. docs/translating.md describes both. Verified by translating and checking all 56 languages.
Adds values-* translations for every language the OpenCode desktop app supports except the right-to-left ones (ar, he, fa, ur, dv, and pa, which desktop writes in Shahmukhi), and lists them in appLanguages so Android 13+ per-app language settings offer them. Desktop codes map to Android qualifiers as zh -> zh-rCN, zht -> zh-rTW, br -> pt-rBR, no -> nb, id -> in; Serbian is Cyrillic as on desktop. Translated with opencode/gpt-6.1-sol via scripts/translate.py using desktop's terminology. Verified: python3 scripts/translations.py all reports nothing missing or to fix.
--redo NAME translates a string again in every language, for when its English meaning changes; translating and reviewing both now say a shell is a command-line shell, after several languages chose the seashell word. Verified: translate.py all --redo <13 shell strings> rewrote them in all 56 languages; translations.py all reports nothing missing or to fix.
gemini-3.8-flash reviewed all 56 languages against the English and the desktop app's terms and fixed 681 strings (wrong meaning, wrong term, leftover English). The shell strings were translated again so none reads as a seashell or the Shell brand; Serbian keeps "Shell" in Latin script as desktop does. Verified: scripts/translations.py all reports 0 missing, 0 to fix for every language.
Finnish "Järjestelmä" was cut to an ellipsis in the Appearance mode control. Labels now step down to 80% size before ellipsizing, with slightly less padding, like the Catch Up chrome labels. Verified on the emulator in fi, de and my (see PR screenshots).
The review changed it to "Järjestelmän mukaan", which doesn't fit the Appearance mode control even at the smaller size; "Järjestelmä" does. Verified: translations.py fi reports nothing to fix.
scripts/check.sh (and so CI) now runs `python3 scripts/translations.py all` first. It fails when a language is missing a string, still has one removed from English, or has placeholders, plurals, escaping, core_language_tag or appLanguages that don't match, and prints the command that fixes each problem. Text that only looks untranslated is a warning. Changed English wording isn't checked, so --redo stays a manual choice. It needs only Python 3 and runs in about two seconds. translate.py gains --model and --review-model, so contributors without Anomaly Console access can use any provider/model `opencode run -m` accepts (the Console models stay the defaults). Without the opencode repo it prints a one-line note and skips the desktop terms instead of failing. docs/translating.md explains both and the CI check; AGENTS.md says to run the scripts after changing English UI text. Verified: translations.py all passes (56 languages, 0 warnings) and fails with the fix command on a deleted string; translate.py with --desktop /nonexistent and a non-default model restored a deleted string and dropped a stale one; scripts/check.sh passes on the VM.
translate.py no longer needs the opencode repo cloned next to this one: --desktop and its ../opencode default are gone. It fetches the desktop app's i18n files (packages/app and packages/ui) and its translators' glossary (.opencode/glossary) from raw.githubusercontent.com/anomalyco/opencode/dev with urllib, once per file per run. If a fetch fails (offline, or the files moved) it prints one note and translates without the terms, as before. docs/translating.md, the --help text and the LANGUAGES comment now say the terms come from the public opencode repo on GitHub. Verified: a German run with one missing string fetched 8 files once each, sent 106 desktop terms and the de glossary, and restored the string unchanged; with a bad branch URL and with HTTPS blocked by a dead proxy it printed the note and still translated; translations.py all passes; scripts/check.sh passes.
Merged
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Translates the app into the 56 left-to-right languages the OpenCode desktop app supports, and adds scripts to keep the translations complete.
Languages
am, az, bg, bn, bs, ca, cs, da, de, dz, el, es, et, fi, fo, fr, hi, hr, hu, hy, in (Indonesian), is, it, ja, ka, km, ko, lo, lt, lv, mk, mn, ms, my, nb (desktop
no), ne, nl, pl, pt-rBR (desktopbr), ro, ru, si, sk, sl, sq, sr (Cyrillic, as on desktop), sv, tg, th, tk, tr, uk, uz, vi, zh-rCN (desktopzh), zh-rTW (desktopzht).These are all in
appLanguages, so the Android 13+ per-app language list (generated locale config) shows each of them under its own name. The app has no language picker of its own.Left out for now: the right-to-left languages ar, he, fa, ur, dv, and pa, since desktop's Punjabi is Shahmukhi (Arabic script, in desktop's RTL list). They need an RTL layout pass first.
How
scripts/translate.pytranslates what eachvalues-<code>folder is missing throughopencode runwith Anomaly Console models:opencode/gpt-6.1-soltranslates andopencode/gemini-3.8-flashreviews (--review).--redo NAMEre-translates a string whose English changed. Re-running fills in only new strings.packages/appandpackages/uii18n files on GitHub, plus the locale glossary in.opencode/glossary. It also carries the strings already translated in this app, and each string's<!-- context -->note. The rules follow desktop'stranslator.md.scripts/translations.pychecks every language: each key is present, placeholders match, every CLDR plural quantity is there, there are no stray%or unescaped quotes, the text is in the language's own script, and there are no leftover English sentences.docs/translating.mdcovers both scripts.scripts/translations.py allthroughscripts/check.shand fails on missing, removed or broken translations, printing the command that fixes them.translate.pytakes--model/--review-model(anyprovider/model) for contributors without Console access, and reads the desktop terms from the public opencode repo on GitHub (skipping them with a note if that fails).Checks
scripts/translations.py all: 0 missing, 0 to fix in all 56 languages.scripts/check.shpasses on the VM (build, lint, unit tests).Before / after
Before this PR the app was English only, so every "before" is the English column. Each row shows the same screen on the same build: English, then five languages.
Connection: en · de · ja · th · hi · ka

Session with tool rows: en · fi · zh-CN · ru · my · ka

Question card: en · de · ko · km · hi · ka

Drawer: en · de · ja · th · my · ka

Settings: en · ru · zh-CN · km · my · hi

Appearance (Finnish "Järjestelmä" was "Järjestelmä…" before the segmented control fix): en · fi · de · ru · th · ka

What's New: en · de · ja · zh-CN · th · hi

Follow-ups