Commit 8f554c9
authored
In-app Persian (Farsi) localization with runtime language switching (#43)
* fix: add missing language code persistence to settings store and models
- 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.
* feat(i18n): add language switcher to App Settings dialog
- 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
* feat(i18n): implement CompositionLocal string localization for key UI 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
* feat(i18n): localize connection mode, section headers, and server route 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
* feat(i18n): localize default profile names and remaining English strings
- 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
* chore: drop local-only files from branch1 parent c0c0fa2 commit 8f554c9
7 files changed
Lines changed: 2953 additions & 464 deletions
File tree
- app/src/main
- java/shop/whitedns/client
- model
- ui
- res/values-fa
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
241 | 242 | | |
242 | 243 | | |
243 | 244 | | |
| |||
454 | 455 | | |
455 | 456 | | |
456 | 457 | | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
457 | 463 | | |
458 | 464 | | |
459 | 465 | | |
| |||
696 | 702 | | |
697 | 703 | | |
698 | 704 | | |
| 705 | + | |
699 | 706 | | |
700 | 707 | | |
701 | 708 | | |
| |||
725 | 732 | | |
726 | 733 | | |
727 | 734 | | |
| 735 | + | |
728 | 736 | | |
729 | 737 | | |
730 | 738 | | |
| |||
1487 | 1495 | | |
1488 | 1496 | | |
1489 | 1497 | | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
1490 | 1505 | | |
1491 | 1506 | | |
1492 | 1507 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
230 | 231 | | |
231 | 232 | | |
232 | 233 | | |
| 234 | + | |
233 | 235 | | |
234 | 236 | | |
235 | 237 | | |
| |||
692 | 694 | | |
693 | 695 | | |
694 | 696 | | |
| 697 | + | |
695 | 698 | | |
696 | 699 | | |
697 | 700 | | |
| |||
0 commit comments