Add Spanish localization + in-app language picker#189
Draft
gmarull wants to merge 4 commits into
Draft
Conversation
Add `en` and `es` to CFBundleLocalizations so iOS surfaces both locales via NSBundle.preferredLocalizations. Compose Resources relies on this to select non-base locale folders at runtime on iOS — without it, values-es/ assets are never picked. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Migrate ~37 inline Text("…") / SectionText("…") literals across
BugReport*, Onboarding*, RingOnboarding, WatchOnboarding screens
to Compose Resources stringResource(), and populate
composeApp/src/commonMain/composeResources/values/strings.xml
with the matching English entries.
Also moves the Android foreground-service notification text
("Keeping Pebble connection alive") into androidMain res so it
flows through getString(R.string.foreground_notification_text)
and can be localised.
In BugReportScreen.kt and ViewBugReportScreen.kt, util-module
Res is aliased to UtilRes because composeApp now owns the
unaliased Res import (more call sites).
Not covered: AppNavHost titles, setStatus() messages,
contentDescription strings, BugReportProcessor error text — all
still English literals.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add values-es/strings.xml in every module that ships a
values/strings.xml: pebble, util, experimental (Compose
Resources) plus composeApp commonMain and the composeApp
Android manifest resources. Covers ~130 strings total — nav
labels, day/month names, bug-report and onboarding screens,
foreground-service notification, etc.
Product names ("Pebble", "Index", "PebbleOS") are intentionally
not translated.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirror the ThemeProvider pattern with a new LocaleProvider: - AppLocale enum: System (default), English, Spanish - Persisted via Russhwolf Settings (key "app_locale") - New dropdown in Settings > General right under "App Theme" LocalizedApp wraps the root composition and overrides Compose Resources' LocalComposeEnvironment when the user picks a specific language. When AppLocale.System is selected the override is bypassed and resource resolution falls through to the platform default (LocalConfiguration on Android, NSBundle preferred localizations on iOS). The override uses @InternalResourceApi (LocalComposeEnvironment, ComposeEnvironment, LanguageQualifier). That's currently the only mechanism Compose Multiplatform exposes for runtime locale switching; revisit when a stable API ships. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
5967cbea) — declareenandesinCFBundleLocalizationsso iOS surfaces both viaNSBundle.preferredLocalizations; Compose Resources needs this to pickvalues-es/at runtime on iOS.61679361) — migrate ~37 inlineText(\"…\")/SectionText(\"…\")literals in BugReport*, Onboarding*, RingOnboarding, WatchOnboarding screens tostringResource(), and move the Android foreground-service notification text intoandroidMainres. English only at this point.cecae7ba) — addvalues-es/strings.xmlin every module that ships avalues/strings.xml(pebble, util, experimental, composeApp commonMain, composeApp androidMain). ~130 strings total. Product names (Pebble, Index, PebbleOS) intentionally left untranslated.d61777aa) — new "App Language" dropdown in Settings → General right under "App Theme". Options: System (default), English, Spanish. Backed by aLocaleProvidermirroringThemeProvider. Live switch viaLocalComposeEnvironmentoverride — no app restart.Caveats for review
@InternalResourceApi(LocalComposeEnvironment,ComposeEnvironment,LanguageQualifier). It's the only mechanism Compose Multiplatform 1.10.x exposes for in-app locale switching; revisit when a stable API ships.remember { … }, sostringResource()can't be used there without a wider refactor ofbasicSettingsDropdownItem.AppNavHosttitles,setStatus(\"…\")messages,BugReportProcessorerror strings, accessibilitycontentDescriptions,PebbleElevatedButton(text = \"…\")call-sites. These need different patterns (string passed off-Composable, or through state) and felt out of scope for an initial pass.Test plan
composeApp/src/commonMain/composeResources/values-es/strings.xmland module-levelvalues-es/are picked up by AGP/Compose Resources.CFBundleLocalizationschange iniosApp/iosApp/Info.plistdoesn't trip up the Xcode project'sknownRegions.getString(R.string.foreground_notification_text).🤖 Generated with Claude Code