Repository navigation
Add language settings, normalized language in app - #1004
lukezielke wants to merge 2 commits into
Conversation
|
Good feature, and the implementation is in better shape than your checklist suggests. Two things to fix before it lands, one of which is user-visible. Chinese is missing, and the PR translates the picker into ChineseThe app ships 1,711 Chinese strings in So a Chinese user opens a language picker rendered in Chinese and cannot find Chinese in the list. Adding
|
|
Thanks for the review. I addressed each item:
|
|
Heads-up: this went CONFLICTING when #1029 (German onboarding localization) landed — both touch the same six Android The resolution is provably a union, so it should be quick: I diffed the three sides and zero keys were edited on both. Base 1747, your branch adds 10, main added 58, no overlap. Same in One thing worth knowing when you rebase: main's catalogues are not key-sorted. Sorting them on the way through reorders every entry into an unreadable diff — append instead. The review items from before still stand (Chinese missing from both language enums, and the hardcoded |
b95bad2 to
9b847d3
Compare
|
Done @ryanbr |
In-app UI-language selector on Apple + Android (System / English / Deutsch / Español / Français / Português / 中文), applied consistently to localized copy and locale-sensitive date/number formatting. Units and time zone stay independently configured. - Apple: writes the standard `AppleLanguages` bundle override and takes effect after reopening NOOP; `AppLanguage.activeLocale` follows the running bundle (not the pending picker) and combines the app language with the device region, fed to SwiftUI format styles via `.environment(\.locale,)` at both app roots. Formatters across the day/sleep/workout screens switch from `Locale.current` to `AppLanguage.activeLocale`. - Android: `AppLanguagePrefs.wrap` sets the process locale in both `Application` and `Activity` `attachBaseContext`; the picker recreates the Activity so composable + non-composable resource lookups switch together. - Full de/es/fr/pt-PT/zh translations for the new settings strings on both platforms (iOS xcstrings carries all 8 locales); extracts several previously hardcoded Android appearance labels into resources. Rebased onto current main (theming/accent/HSV-picker merges): the Settings appearance card now shows Language above Preset/Theme on both platforms. Day-key hardening (parity + #1004 safety): pin `Locale.ROOT` on the Kotlin `AnalyticsEngine.isoDay` formatter and `AppleHealthImporter.civilFromDays` `String.format`, so the primary stored `DailyMetric.day` writer stays ASCII yyyy-MM-dd under any app-language selection. The Swift `AnalyticsEngine.isoDay` already pins `en_US_POSIX`; this closes that Swift↔Kotlin gap rather than introducing new behavior (all six shipped languages already emit Latin digits).
In-app UI-language selector on Apple + Android (System / English / Deutsch / Español / Français / Português / 中文), applied consistently to localized copy and locale-sensitive date/number formatting. Units and time zone stay independently configured. - Apple: writes the standard `AppleLanguages` bundle override and takes effect after reopening NOOP; `AppLanguage.activeLocale` follows the running bundle (not the pending picker) and combines the app language with the device region, fed to SwiftUI format styles via `.environment(\.locale,)` at both app roots. Formatters across the day/sleep/workout screens switch from `Locale.current` to `AppLanguage.activeLocale`. - Android: `AppLanguagePrefs.wrap` sets the process locale in both `Application` and `Activity` `attachBaseContext`; the picker recreates the Activity so composable + non-composable resource lookups switch together. - Full de/es/fr/pt-PT/zh translations for the new settings strings on both platforms (iOS xcstrings carries all 8 locales); extracts several previously hardcoded Android appearance labels into resources. Rebased onto current main (theming/accent/HSV-picker merges): the Settings appearance card now shows Language above Preset/Theme on both platforms. Day-key hardening (parity + #1004 safety): pin `Locale.ROOT` on the Kotlin `AnalyticsEngine.isoDay` formatter and `AppleHealthImporter.civilFromDays` `String.format`, so the primary stored `DailyMetric.day` writer stays ASCII yyyy-MM-dd under any app-language selection. The Swift `AnalyticsEngine.isoDay` already pins `en_US_POSIX`; this closes that Swift↔Kotlin gap rather than introducing new behavior (all six shipped languages already emit Latin digits). Co-authored-by: Luke Zielke <luke.bjarne@icloud.com>
|
Landed via #1181 — rebased onto current |
…br#1181) In-app UI-language selector on Apple + Android (System / English / Deutsch / Español / Français / Português / 中文), applied consistently to localized copy and locale-sensitive date/number formatting. Units and time zone stay independently configured. - Apple: writes the standard `AppleLanguages` bundle override and takes effect after reopening NOOP; `AppLanguage.activeLocale` follows the running bundle (not the pending picker) and combines the app language with the device region, fed to SwiftUI format styles via `.environment(\.locale,)` at both app roots. Formatters across the day/sleep/workout screens switch from `Locale.current` to `AppLanguage.activeLocale`. - Android: `AppLanguagePrefs.wrap` sets the process locale in both `Application` and `Activity` `attachBaseContext`; the picker recreates the Activity so composable + non-composable resource lookups switch together. - Full de/es/fr/pt-PT/zh translations for the new settings strings on both platforms (iOS xcstrings carries all 8 locales); extracts several previously hardcoded Android appearance labels into resources. Rebased onto current main (theming/accent/HSV-picker merges): the Settings appearance card now shows Language above Preset/Theme on both platforms. Day-key hardening (parity + ryanbr#1004 safety): pin `Locale.ROOT` on the Kotlin `AnalyticsEngine.isoDay` formatter and `AppleHealthImporter.civilFromDays` `String.format`, so the primary stored `DailyMetric.day` writer stays ASCII yyyy-MM-dd under any app-language selection. The Swift `AnalyticsEngine.isoDay` already pins `en_US_POSIX`; this closes that Swift↔Kotlin gap rather than introducing new behavior (all six shipped languages already emit Latin digits). Co-authored-by: Luke Zielke <luke.bjarne@icloud.com>
What this PR does
Fixes mixed-language UI by applying the selected language consistently to localized copy and locale-sensitive formatting.
Adds an app-language setting on Apple and Android with:
Apple preserves the device region while applying the selected UI language and requires reopening NOOP. Android applies the language immediately and updates its process locale, so locale-sensitive date order and number formatting may also change. Units and time zone remain independently configured.
Type of change
How it was tested
zhtag.Tools/i18n_audit.py --ci origin/mainpasses.Tools/doc_comment_lint.pypasses.git diff --checkpasses.Checklist
swift testinPackages/<name>) — not applicable; no package was touchedandroid/— blocked locally by the missing Android SDKStrandDesigntokens — the restart note usesNoopMetrics.space1docs/CONTRIBUTING.mdStrand.xcodeproj/) or any secrets/keystoresRelated issues
None