Repository navigation
feat(i18n): format dates, numbers and durations in the app language - #872
Conversation
Revision 28 (Silo-Server/silo-server#3723) adds ui.app_language (the app's interface language, per profile with a per-device override). The regeneration also brings the two marker display keys from revisions 25 and 26 and watch_party.guest_control_policy from revision 27, which nothing reads yet. The vendored contract fixtures move to the same revision so the conformance test keeps all three in agreement. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The server now stores an app language per profile, with a per-device override (ui.app_language, contract revision 28), but the Android apps ignored it and had no per-app language configuration. Both apps now apply the active profile's value when the build ships that language, matching regional tags to their language (es-MX to es, zh-CN to zh-Hans). Android 13 and later use the framework LocaleManager; older versions keep the tag and wrap each activity's context. Both main activities handle locale and layout direction changes in place, so a switch keeps the screen and its state. On Android 13+ the profile's value and the system per-app language are one setting. A language picked in Settings > Apps > Silo > Language is saved as this device's value for the active profile, and a profile with no value gets back the language from before the app changed it. A small ledger, kept on the device, tells the app's own changes from the user's. - App language picker in phone Settings > Interface and TV Settings > General: Match device plus each shipped language by its own name; a stored language the build lacks stays listed under its name. - localeConfig generated from resources, and en-XA/ar-XB pseudo-locales in debug builds. Spanish carries only the picker's strings until the translation catalog lands. MissingTranslation lint is off, since missing translations fall back to English by design. - Accept-Language with the applied language on Silo API requests. - A string helper that wraps names in Unicode isolates, used for the TV pairing "account on server" title. - Request dates build their formatter per use, so they follow a language change made in place. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review follow-ups to the app language change. - A language picked in system settings or the picker is committed together with its pending save, so a crash can't keep one without the other. A save is sent only under the active server, account and profile, and a read that overlaps a save is repeated. - A system value the server can't hold (an older server, a rejected or pseudo-locale value) is kept until another profile becomes active, instead of being replaced on the next check. - Release builds ship English alone until a language's translations ship: the Spanish picker strings are debug-only, and the shipped list comes from the build's generated localeConfig. - Names are wrapped in Unicode isolates only in right-to-left layouts, so left-to-right text keeps its bytes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The in-app picker now saves the profile's app language, which follows the person to every device, and clears this device's own value. Only a language changed in Android's system settings is saved for this device alone. This matches the web and Apple clients. A save the server refuses for good is dropped together with the local record, so the profile's language applies again and the user's system choice comes back for a profile without one. Network, server and throttling failures stay queued (the settings flusher's classifier, now shared), and a save for a profile that is no longer active waits for it. A pseudo-locale chosen in system settings is handled the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A settings read is published only if no save landed while it was in flight, checked under the same lock the save takes. - A picker choice applies only to the profile it was shown for. - Once the profile's value is saved, a retry only clears this device's value, so it can't overwrite a newer choice made on another device. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The phone and TV apps' strings now come from the shared Silo translation catalog. scripts/sync-translations (vendored from silo-translations) generates android-shared's values*/strings_catalog.xml and silo-locales.properties, and records the catalog version in .silo-translations. All 392 strings and 8 plurals in the three hand-written strings.xml files move to their catalog names, including the App language picker's, and every reference reads them from android-shared's R. The hand-written files are gone: an app resource with a catalog name would hide the catalog's text and translations. So is the debug-only Spanish seed; translations now come only from the catalog. English is unchanged: an aapt2 dump of both debug APKs, before and after, has the same rendered text under every renamed name in the default, en-XA and ar-XB configurations. Both apps package only the languages the catalog ships (androidResources.localeFilters from silo-locales.properties), so generateLocaleConfig and the picker list English alone until translations land, and library translations no longer show in an English app. App bundles keep every language in the base split, since the app applies a profile's language itself. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Home and library rows now show the catalog's text for title_key, with title_args filled in. A row an admin renamed has no key and keeps its title as typed, as does a key this build doesn't know or arguments that don't fit the message. Names in the arguments are isolated in a right-to-left interface. Both section editors, including their "Hide/Show ..." descriptions, and the section-browse titles use the same text. The release shrinker keeps the strings looked up by name. v2 problem details follow the same rule as the other clients: in English the server's detail; otherwise error.field.<code>, then error.<type>, when the interface language has a translation, else the detail. The lookup is installed at startup and applies to every v2 call, so screens that show ApiResult.Error.message need no change. ApiResult.Error.detail keeps the server's own text, and the two "Playback session not found" checks read it instead of the shown message. The temporary-password instructions stay as they are. Co-Authored-By: Claude Opus 5.5 <[email protected]>
scripts/check-translations regenerates the recorded catalog version
into a temporary tree and fails when a committed generated file
differs, is missing, or is no longer generated. CI runs it in the
routing job when a SILO_TRANSLATIONS_TOKEN secret can read the private
catalog, and skips it otherwise.
CatalogSourceTest fails when an app or hand-written resource reuses a
generated string name, and when a directory listed as converted gains a
Text("...") or text = "..." literal. The list starts with phone pairing
and the shared playback settings labels, whose text already comes from
the catalog.
docs/i18n.md describes the pattern extraction work follows.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Code review follow-ups: - The password-change and external sign-in errors decode their own problems; they now go through the same translation as other v2 calls and keep the server's text in ApiResult.Error.detail. - Before Android 13, the applied language is read from the stored tag, so a process started without an activity (a worker, a notification action) translates and sends Accept-Language in the profile's language. Any English, not only "en", shows the server's detail. - scripts/check-translations sends the token as a header for the clone only, so it never lands in .git/config or reaches npm (which runs with --ignore-scripts), and no longer hides generator errors. CI sets up Node only when the secret exists. - The source guard lists only phone pairing: the shared settings package still has English constants outside Text calls. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adversarial review follow-ups: - check-translations clones the catalog in full. A blob-filtered clone fetched again at checkout, without the token, so a pinned commit could fail to check out in CI. - The name-clash test exempted every file called strings_catalog.xml; it now exempts only android-shared's generated ones, so an app module can't hide an override under that name. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A foreground refresh and the settings pane's refresh could overlap. If another device changed the profile's language between their reads, the older answer could land last and switch the interface back. Refreshes now run one at a time, so the newest read publishes last. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Android 13 Before Android 13 the app language is applied by wrapping each activity's context in a Configuration that sets only the locale. A new Configuration starts with a font scale of 1, so the wrapper also reset the system text size to the default for anyone with a language override. The font scale is now left unset, and the device's text size applies. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A system locale such as zh-CN-u-nu-latn carries extension subtags after a singleton. The tag parser read "latn" as the script, so a Simplified Chinese device matched no shipped language and fell back to English. Parsing now stops at the first singleton. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Installed by scripts/sync-translations --version 2026.11.09-7c500c0 (release v2026.11.09-7c500c0, checksum pinned in .silo-translations): the English catalog for every client and the Spanish, German, French, Brazilian Portuguese, Japanese, Simplified Chinese and Arabic translations. Bidi control characters are written as escapes. Re-vendored scripts/sync-translations byte-identical from silo-translations tools/sync-translations.sh at 7c500c0. It installs only the files each platform's allowlist names, prunes only inside the client, and survives a failed copy. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…text The phone and TV players, audiobooks, the ebook reader, Remote Control and Cast, and the download manager now read their text from the shared catalog, including screen reader labels, toasts, snackbars, and media and download notifications. English is unchanged apart from plurals that printed "1 seconds", "1 pages" and similar. Text that is stored, sent to a TV, logged or matched stays English: stored download titles and errors, the Remote Control handoff cancel, the adb debug hook and log lines read the catalog's English through EnglishText or the server's own detail. Errors that view models keep as English are mapped to catalog strings where they are shown. Text produced by the shared KMP module is not converted yet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every user-visible string in phone and TV Settings, server and account management, and Diagnostics now comes from the shared translation catalog, including content descriptions and toasts. English is unchanged. - Pickers select by position or value instead of comparing label text, so translated labels can't pick the wrong option. - View models and stores hand screens typed values (SettingsText, SettingsSaveError, seek-interval outcomes, diagnostics states) that the UI resolves, so text follows the app language. - Hand-built plurals use catalog plurals; Profile Selection shares one label mapping between phone and TV. - The catalog source guard now covers these six packages. Qualified SiloLogAttribute.Text(...) log fields no longer count as UI text. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds the player, audiobook, reader, cast and download packages to the literal-text source guard, and documents that data text stays English and how counts that can pass 999 enter a plural. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Settings search matched only the catalog's keywords, so a translation would have replaced the English words people search with. The English keywords now always match, and the catalog's words for the app language add to them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A failed version switch on TV showed a client-written terminal message in English because the replacement path dropped the catalog id the session manager supplied. Completed episode and remaining transcription counts also enter their plurals as text now, like the totals beside them, so both numbers are written the same way past 999. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Home, libraries and filters, title pages, box sets, people, search, recommendations, calendar, collections and saved lists on phone and TV now read their text from the translation catalog. English is unchanged, apart from four counts that printed "1 items", "1 titles", "About 1 results" and "1 chapters". View models hold a UiText (the server's words or a string resource) instead of English, so their messages follow a language change; errorText() is the catalog form of errorMessage() and also translates network and timeout text. Counts use plurals, names inside sentences are isolated in right-to-left layouts, and interface text is upper- or lowercased with the interface language's rules. Text that is sent or stored stays English data: the watch party item's fallback title and episode code, and the series title saved with a download. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CatalogSourceTest now covers the 29 directories this change converted and also rejects contentDescription literals. docs/i18n.md describes UiText. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t from the catalog The phone and TV screens for sign-in, server setup, pairing, profiles and PIN, Watch Party, requests and the notification inbox, and the app shell (navigation, menus, cards, shared components) showed hardcoded English that no translation could reach. That text now comes from the shared translation catalog. English is unchanged, apart from one plural that printed wrong: the Requests summary now reads "1 needs you". View models hand their screens typed text (UiText, the inbox and pairing text types, string ids) that the screen resolves when it draws, so an in-place language change reaches it. Push notifications apply the app language before Android 13 too. Text that is stored, sent to the server or matched stays English: Watch Party suggestion subtitles, device names, notification channel IDs, subtitle and quality values. Text built in the shared KMP module is unchanged and still English. The catalog source guard now covers the 27 directories with no literal text left. Existing tests keep asserting the same English, now read from the resources. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he guard Narrator and season names inside translated sentences are isolated in right-to-left layouts outside composition too (Resources.getStringWithNames). The audiobook in-progress count passes its digits as count_text. TV detail leaves the source guard: its dates still build English month names (plan 4.5) and its playback formatters keep an English fallback for the player HUD, so the directory isn't fully converted yet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The detail page's stage, suggest and switch toasts are built outside composition, so they passed the title to getString without the right-to-left isolation the screens use. A Context twin of stringResourceWithNames now isolates them, in right-to-left only; English keeps its bytes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merges 7a7d8fafc, the branch head without its generated-output commit (3bb1e2b13); the catalog output is regenerated after all four merges. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merges caf0e7c61, the branch head without its generated-output commit (f20157fb2). Conflicts: - CatalogSourceTest: both guard lists kept. - TvSettingsScreen subtitle appearance pane: settings' catalog row and picker titles, with player's resource-backed option values. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merges 9923a87e4, the branch head without its generated-output commit (b4d8ce01d). Conflicts: CatalogSourceTest keeps every guard directory and combines the two scanner changes (settings skips qualified Text calls; browse adds contentDescription literals). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merges cfe6ca128, the branch head without its generated-output commit (36677d357). Conflicts: - common/i18n/UiText.kt: browse and account each added a UiText. Keep account's type (Res/Raw, text(), RTL name isolation, serverOr), add a Context overload of text(), and keep browse's helpers (errorText, detailedErrorText, localizedResources, upper/lowercaseForUi) on it. Browse's call sites move from Verbatim/Resource/asString to Raw/Res/text. - IsolatedStrings.kt: both helpers kept; Context.getStringWithNames delegates to the Resources form. - CatalogSourceTest: all 80 guard directories, sorted. - SignInSettingsTest: settings' SettingsText helper kept beside account's English assertions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The guard now scans settings, player and account directories for
contentDescription literals too. It flagged five templates that only
join translated text ("$label, $value"), so letters inside $name and
${...} templates no longer count.
- SignInSettingsTest imported RunWith, RobolectricTestRunner and Config
twice after the merge.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
"{tv}'s pairing code has changed…" stayed English because the catalog
validator rejected an apostrophe after a placeholder. The relaxed rule
allows it, so it now reads cast.remote.error.pairingChanged with the same
English, and phone android/cast joins the source guard.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mmit) Dates, numbers and durations in the app language. Where DX5c and DF changed the same lines, DX5c's structure stays and the numbers and dates go through LocaleFormat (D55): - the TV audiobook chapter label keeps DX5c's index fallback and formats with LocaleFormat.integer; - the TV episode rail resolves DX5c's UiText captions and keys them on DF's format locale; - the phone decade chip keeps the picker's label; - imports from both sides. Co-Authored-By: Claude Opus 5.5 <[email protected]>
After the merges, DX5c's UiText resolver, DX5a's Resources.digits and DF's
LocaleFormat each formatted numbers and dates with their own rule. One rule
now applies (D55, D58):
- UiText.Number: whole numbers through LocaleFormat.integer (interface
language, ungrouped), decimals through LocaleFormat.decimal (D26 locale).
- UiText.CalendarDate: LocaleFormat.dateFormatter("yMMMd"), unpadded year.
- UiText.LanguageName: LocaleFormat.interfaceLocale().
- Resources.digits is removed; its call sites pass LocaleFormat.integer.
- downloads.bulk.deleteButton and downloads.entry.season became String
placeholders in catalog integration (Apple, D54); their call sites pass
LocaleFormat.integer.
- The shared module's english() test helper covers DX5c's value cases.
US English is unchanged. On a device whose language has no catalog, shared
decimals and dates now match the app's own (device format), as D58 decided.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ated (code review)
- Watch Party presence ("2 of 3 ready") and the subtitle sync percent
passed raw toString() counts to String placeholders; they now use
LocaleFormat.integer and UiText.Number (D55).
- The shared module's english() test helper fills a plural's count at
SharedPlural.countIndex and formats numbers and language names as the
resolver does.
- SharedUiText KDoc describes the LocaleFormat rule and UiText.Number for
{count_text}.
- LocaleFormat keeps the device list process-wide; a test that sets it
resets it, and the en-GB test reads its own.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…glish (D64) On a phone or TV following the device, the per-app language is empty, so an activity got the device's configuration even when Silo has no catalog for that language. On an Arabic device the English text then printed `%d` counts in Arabic-Indic digits, LocaleFormat counts in Latin digits, and decimals and dates in Arabic, inside a right-to-left layout. AppLocales.wrap, already called from both activities' attachBaseContext, now replaces a first locale this build doesn't ship with a stand-in: the first device locale whose language ships, kept with its region (`ar, en-AU` shows en-AU), else English. Shipped languages (en-GB keeps its formats, D59) and debug pseudo-locales are left alone. LocaleFormat formats in the same stand-in, and its memo is keyed on the whole default locale list. An activity whose locale wrap fixed recreates when a language change arrives in place, except in picture-in-picture, where leaving brings another change. Text resolved with application or service resources keeps the device's configuration; UiText already falls back to English there (catalogResources). Tests: UnshippedDeviceLanguageTest fails on the previous head (Arabic-Indic "١٢ downloads"). The D58 tests for German and Arabic devices now expect English formats; LocaleFormat's tests can seed a shipped list to keep covering a shipped non-device language. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 9 minutes. View limit details
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
The Evidence section has no published link or attached captures (
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
d52ecfd to
fab9b7e
Compare
35ac897 to
c46f78d
Compare
fab9b7e to
f6f4543
Compare
c46f78d to
68119fc
Compare
68119fc to
d115bfb
Compare
f6f4543 to
34ccbb5
Compare
34ccbb5 to
1090678
Compare
d115bfb to
4e8104f
Compare
1090678 to
fb4daee
Compare
4e8104f to
6e707a1
Compare
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Problem
Related issue: N/A (translation program, Android locale formatting)
Validation tasks: re-check on a non-US English device only: #313 C1, C4; #314 C1, C4 (calendar times use the language's hour cycle); #317 C1; #318 C1 (person dates). US English devices are unchanged.
Stack: 5 of 7, stacked on #871.
Pairs with Silo-Server/silo-apple#1084.
Android printed dates in US field order with English month names (the TV built them by hand), forced
Locale.USon sizes and speeds, and passed numbers to text placeholders withtoString(). A translated interface would have kept "Jul 8, 2026", "1.5 GB" and ASCII digits. After the shared-module PR, three helpers also formatted numbers and dates by different rules, so one screen could mix them.Approach
LocaleFormatinandroid-sharedformats with the applied language:Hand-built durations ("12m 30s") use catalog keys. The shared module's
UiTextnumbers, dates and language names now go throughLocaleFormattoo, so the app and shared-module text agree.When the device language has no Silo catalog, the app builds its resources and formats as English, so digits, decimals and dates stay consistent until that language ships. Without it, an Arabic device would show Arabic-Indic digits in some counts and Latin digits in others on one screen.
The reader's CSS line height is pinned to
Locale.ROOT, in its own commit.Validation
ar-EGTV before and after the no-catalog rule.Evidence
Evidence: https://evidence.siloserver.org/r/silo-android/pr-872/
Surface and build: phone, tablet, foldable (folded and open) and Android TV. The Spanish, Arabic, German and Japanese captures come from a build of the top of this stack, so every screen is fully converted; the English before-and-after pairs come from this PR's own base and head.
Risks
Checklist
AI Disclosure
scripts/sync-translations; T3 delegation to Codex for plan and adversarial reviewclaude-opus-5-5(code, extraction subagents, code-review finders);claude-sonnet-5-5(some code-review finders);gpt-6.1-sol(plan and adversarial review)gpt-6.1-solon its own branch; findings were fixed or answered there. The rebase ontomainwas checked against the pre-rebase tree file by file. Background review round 1 (Codexgpt-6.1-sol): no findings.🤖 Generated with Claude Code
Note
Localize app UI: format dates, numbers, and durations in the app language
StringtoUiTextvalues resolved at display timeandroid-shared:AppLanguageStore,AppLocales(per-app locale wrap/apply/recreate),LocaleFormat(locale-aware dates, numbers, clocks, decimals),UiTextresolution,ServerTextserver-title/problem translation, andEnglishTextfor English fallbacksAppLanguageStore, with locale reconcile logic and profile/device-scopedui.app_languagesetting support (settings contract revision 28)Accept-Languagerequest header viaAndroidDeviceMetadataProvidercheck-translations/sync-translationsscripts and CI wiring to verify generated translation filesTvPlayerNextUpOverlayin TvPlayerScreen.kt contains a runtime-minute interpolation with dangling+operators that is not valid Kotlin; this file cannot compile until fixed. Also, server-bound suggestion titles/subtitles and player notices retain English for protocol useMacroscope summarized 4e8104f.