Repository navigation
Move user-visible strings into string resources (l10n part 1/2) - #145
Merged
foureight84 merged 1 commit intoNov 15, 2026
Merged
Conversation
English output is unchanged: values/strings.xml carries the original copy verbatim, and the existing unit tests pass without modification. - Composables use stringResource / pluralStringResource. Code without a Context goes through util/L10n, which in JVM tests reads the default values/strings.xml directly. - util/LocaleFormats picks date/time patterns from Android's best-pattern skeletons, falling back to the original pattern when java.time or SimpleDateFormat rejects the platform's one (zh-TW "Bh:mm" on Android 12/13). Patterns and formatters are cached per (skeleton, locale). - coach/context/CoachLanguage reads the coach_language resource, so the coach replies in the language the UI actually resolved. For English the directive is empty and prompts are byte-for-byte unchanged. Coach summary signatures carry the language, so a language switch regenerates cards. - Strings that would otherwise stick after a per-app language switch (tool progress labels, threshold units, the sleep no-data card) are resolved on read. - Coach chart colours also match a translation's own metric words.
This was referenced Nov 14, 2026
Owner
|
Thank you @g4st3r-d3v! Reviewed all changes against the earlier #143 feedback ( |
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.
Part 1 of 2, split out of #143 as you suggested. This one only moves strings into resources; English output is unchanged. The Russian translation comes in a follow-up PR stacked on this one. Like #143, it was made with Claude (Claude Code), rebased on current
main(including #98, #135 and #138, whose new strings are covered too).What it does
values/strings.xml, with the original English copy verbatim. Composables usestringResource/pluralStringResource. Code without aContextgoes throughutil/L10n, which in JVM tests reads the defaultvalues/strings.xml, so tests asserting English text keep passing.util/LocaleFormatspicks locale-aware date/time patterns via Android's best-pattern skeletons.coach/context/CoachLanguageappends one sentence to the chat, summary, check-in and meal-estimate system prompts, asking for replies in the app's language. For English it is empty, so prompts are byte-for-byte unchanged.Adding a language is then just a
values-xx/strings.xml, which should also fit Weblate.Your review on #143
LocaleFormatscrash. BothDateTimeFormatter.ofPatternandSimpleDateFormatnow have to accept the platform pattern. If either rejects it (zh-TWBh:mmon Android 12/13), the original pattern is used.coach_languagestring resource (Englishhere), so it follows whichever translation Android actually resolved. A German phone gets English UI and an English coach.notif_goal_hit/notif_goal_left/notif_evening_steps,fb_steps_avg,fb_today,hero_steps_only/hero_steps_sleep,sc_week_incompleteand the max-attempts string (cte_invalid_structured) are now<plurals>, with Englishone/otherforms.PendingActionExecutorusesActivityMeta.label(keeping theoutdoor_run/outdoor_walkaliases,other→ "Workout"), and its map is gone. The confirm-card summaries inToolImplementations/NutritionToolsandHealthConnectRemovalWorker's message are resources now too.gUnit.labelRes.GlucoseUnit.labelandPeriod.labelare removed.CoachChartViewstill matches the English words. It also matches comma-separatedchart_words_*resources, which are the same English words invalues/, so English colours are what they were. A translation adds its own words. Tests are inCoachChartColorTest.SleepInsights.dayNoDataCoachand theMetricThresholdTableunits resolve on read. Coach tool progress labels (publicLabelRes) do as well, since they were also missed before. Coach summary signatures get a|lang=<name>suffix for non-English languages only, so existing English signatures still match, and a language switch skips the 2 h rate limit (SummaryLanguageSignatureTest).VitalsThresholdEngineare restored and the unuseddirectionis removed.Also picked up: the step-source settings rows from #98, the Today summary fallback in
CoachSummaryContextBuilder, the Strava sign-in errors inMainActivity, and the empty-state/"vs" text inCoachChartView.Scope
No protocol, BLE, sync or persistence logic changed. Tested with
testDebugUnitTest(1680 tests, 0 failures) andassembleDebug.🤖 Generated with Claude Code