In-app Persian (Farsi) localization with runtime language switching#43
Merged
Conversation
- Add WhiteDnsLanguage object with En/Fa constants to WhiteDnsModels.kt - Add languageCode field to WhiteDnsSettings data class with default En - Add normalizeLanguageCode function for language code validation - Call normalizeLanguageCode in syncSelectedConnectionProfileFields - Add KeyLanguageCode constant to WhiteDnsSettingsStore - Load languageCode from preferences in WhiteDnsSettingsStore.load() - Save languageCode to preferences in WhiteDnsSettingsStore.save() This fixes the issue where language changes weren't persisting across app restarts.
- Add LanguageModeSegmentedControl composable (English/فارسی toggle) - Update AppSettingsDialog to show language picker below theme picker - Update HeaderCard to accept and thread languageCode/onLanguageCodeChange - Update all 4 HeaderCard call sites to wire language setting - Update WhiteDnsTheme to accept languageCode and inject RTL layout direction - Update MainActivity to pass languageCode to WhiteDnsTheme
… elements - Create WhiteDnsStrings.kt interface with EnglishStrings and PersianStrings - Add LocalWhiteDnsStrings and WhiteDnsL10n to WhiteDnsTheme.kt - Inject correct strings based on languageCode into CompositionLocalProvider - Replace key hardcoded visible strings with WhiteDnsL10n references: - Bottom tab labels (Profiles/Connect/Scan/Logs) - Connect button (CONNECT/CONNECTING/STOP) - App Settings dialog title and CLOSE button - Theme/Language field labels and option labels - Battery background banner text and action button - Profile tab headers (Connection/Resolver/Setting) - Parallel Test toggle label
…te strings - Localize Mode field label (Mode / حالت) - Localize connection mode buttons (Proxy Mode/Full VPN → حالت پروکسی/VPN کامل) - Localize Connection/Resolver section headers - Localize 'Server route missing' in all occurrences - Fix ConnectionModeSegmentedControl to use localized option labels
- Add setupDefaultConnection/Resolver/Advanced strings to substitute localized labels when the user has not renamed the default profiles - Wire id-based label override into setup card, home selectors, connection info card, advanced profile controls, and the three profile list rows (connection, resolver, settings) - Localize the resolver row summary (count + SELECTED suffix) and the settings row MODIFIED/SELECTED status suffixes via new profileStatusModified and resolverProfileSummary entries
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
Adds in-app language switching between English and Persian (فارسی) without changing the phone's system language. Mirrors the existing theme-switching system.
What's included
WhiteDnsStringsinterface withEnglishStringsandPersianStringsimplementationsLocalWhiteDnsStringsCompositionLocal andWhiteDnsL10ncomposable accessorslanguageCodefield added toWhiteDnsSettings, persisted viaWhiteDnsSettingsStoreWhiteDnsScreen.ktmigrated toWhiteDnsL10n.*Connection,Default Resolver,Default) are localized at render time via profile-id detection, while any user-renamed profiles keep their custom namesNot in scope