Skip to content

refactor: move the remaining app text into strings.xml - #66

Merged
Tarquinen merged 14 commits into
strings-xml-migrationfrom
strings-outside-composables
Nov 14, 2026
Merged

Tarquinen merged 14 commits into
strings-xml-migrationfrom
strings-outside-composables

Conversation

@Tarquinen

Copy link
Copy Markdown
Member

Stacked on #65, which moved the text written inside composables. Error titles from reducers, labels on enums and models, exception messages and the What's New entries were still English literals, so they could not be translated.

Now that text comes from strings.xml too, through a new localized(R.string.x) in :core for code that has no composable or Context. Adding a language is: add values-<code>/ files, add the code to appLanguages in app/build.gradle.kts. docs/translating.md has the steps and scripts/translations.py <code> lists what a language is missing.

  • Types stay String, and under unit tests localized returns the English text, so no test changed.
  • Dates and numbers follow the language of the strings in use (core_language_tag) instead of always English.
  • Text that is also data stays English and gets a separate display copy: wire values, text sent to a model, text compared with the server's, log messages, call errors.
  • A missing translation is a lint warning, not an error: the string shows in English.
  • Still English only: no translation ships here. Developer screens, logs and model prompts are not translated on purpose.

Known limits, also in docs/translating.md:

  • Text already held in state keeps its language until that state is rebuilt, so a language change can leave a few lines in the old language until the app restarts.
  • Voice calls still transcribe and speak English.
  • Right-to-left layouts are unchecked.

Verification:

  • assembleDebug lintDebug testDebugUnitTest pass for every module on the Android VM (3,771 tests).
  • Built with a throwaway es translation that wraps every string in « », set as the app's language on an emulator, and walked the session, drawer, New Session, attachment menu, Settings and its Appearance, Sessions, Voice, What's New, Experimental and server pages. Everything was wrapped except data (project and session names) and the OpenCode brand name; dates read in Spanish. The connection and pairing screens, voice calls, notifications and widgets were not walked.

Reducers, models, enums and errors have no composition to call stringResource in.
localized() and localizedPlural() read a string resource through a StringsClient
dependency and return a plain String, so types and callers stay as they are. Under
unit tests the client returns the English text from the XML files, so tests keep
asserting the words a user reads.

Dates and numbers now follow the language of the app's text (core_language_tag)
instead of always English. The app's languages are one list in app/build.gradle.kts,
which also feeds Android's per-app language setting.

Verified on the Android VM: app assembles, core, server and transcript unit tests pass.
Experiment titles, theme names, notice modes, device names, file sizes and staging errors now read their text through localized(). File sizes use the app's formatting locale. Verified: assembleDebug, lintDebug and testDebugUnitTest pass for every module on the Android VM.
Error messages, pairing link reasons, connection routes, run notices and model labels now come from server/src/main/res. UNREACHABLE_MESSAGE, FOLDER_GONE_MESSAGE and DENIED_MESSAGE become getters. ConnectionRoute gains a translated title and PastedText a translated title; rawValue and NAME stay English because they are logged or sent. Text matched against the server or sent to a model stays English. Verified: assembleDebug, lintDebug and testDebugUnitTest pass for every module on the Android VM.
Link menu titles, file loader errors, download progress, file sizes and link preview labels. TranscriptImagePreview pages gain labelIsPlaceholder so the viewer no longer has to recognise a placeholder label by its English words. Verified: assembleDebug, lintDebug and testDebugUnitTest pass for every module on the Android VM.
Call status captions, provider and key labels, fixes, diagnosis sentences, accents, sound packs and call log durations. Call errors stay English in code because they are compared, logged and sent to the model; voiceFailureDisplayText translates the known ones for the screen. Prompts and tool descriptions are unchanged. Verified: assembleDebug, lintDebug and testDebugUnitTest pass for every module on the Android VM.
Shortcut titles, Ask OpenCode results, Live Update statuses, notification text and share sheet messages. Manifest tile and widget labels point at string resources. Verified: assembleDebug, lintDebug and testDebugUnitTest pass for every module on the Android VM.
Tool row summaries, run error rows, time stamps, pending actions and link preview summaries. GitHub preview states show their translated title instead of the wire value. Verified: assembleDebug, lintDebug and testDebugUnitTest pass for every module on the Android VM.
Reducer errors, request bar verbs, attachment menu items, camera lens labels and model picker labels. The send button takes a verb instead of comparing its label with "Send", and the request error line recognises the HTTP status message without matching English words. Location text sent to the model stays English. Verified: assembleDebug, lintDebug and testDebugUnitTest pass for every module on the Android VM.
Reducer alert titles and errors, session status, starter prompts, the server pill and the background work row, whose counts are now plurals. A failed move keeps its English reason as data and shows a translated one. Verified: assembleDebug, lintDebug and testDebugUnitTest pass for every module on the Android VM.
Selection menu labels, row accessibility text, server status and hints, errors and the age formatters. Removes five unused DrawerTitle constants. The trace check compares the call phase instead of the status caption. Verified: assembleDebug, lintDebug and testDebugUnitTest pass for every module on the Android VM.
The 175 entries read their title, summary, details, example and prompt from strings_whatsnew_entries.xml. The entry list is rebuilt when the app's language changes. Verified: assembleDebug, lintDebug and testDebugUnitTest pass for every module on the Android VM.
Version label, voice key and model summaries, connection card actions and status, pairing scanner hints, welcome copy and What's New actions. The connection card shows the route's translated title, and key verification errors are translated for display. Verified: assembleDebug, lintDebug and testDebugUnitTest pass for every module on the Android VM.
Pairing, share and connection errors and the error phase titles. The copied error report keeps English labels. app_name is marked not translatable. Verified: assembleDebug, lintDebug and testDebugUnitTest pass for every module on the Android VM.
docs/translating.md lists the steps, and scripts/translations.py reports missing, stale and placeholder-mismatched translations for a language. AGENTS.md describes localized(). A missing translation is a lint warning rather than an error, so it shows in English instead of failing the build.
@Tarquinen
Tarquinen merged commit c5dd998 into strings-xml-migration Nov 14, 2026
3 checks passed

This branch was previously deployed

1 inactive deployment
release — b019bf60 Deployed Nov 14, 2026 by Tarquinen via check #215
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant