Add pt-BR + localize redesigned views + locale parity guard (supersedes #76)#101
Open
edufalcao wants to merge 1 commit into
Open
Add pt-BR + localize redesigned views + locale parity guard (supersedes #76)#101edufalcao wants to merge 1 commit into
edufalcao wants to merge 1 commit into
Conversation
…y guard Rebases PR momenbasel#76 onto upstream/main (post momenbasel#70 Arabic, momenbasel#75 FDA TCC, momenbasel#80 dashboard redesign, momenbasel#83 AI history). Adds pt-BR alongside the existing locales and brings every bundled locale (en/es/ja/ar/pt-BR/zh-Hans/ zh-Hant) to key parity, then enforces that parity in CI via a new XCTest case. UI changes - Localize the full user-facing surface across the redesigned views (DashboardView replacing SmartScanView; MainWindow's Overview/ Applications/Cleanup sidebar; CategoryDetailView's hero card; AppListView/AppFilesView/OrphanListView; the new OnboardingView flow; AppearancePill; SettingsView tabs). - Wrap dynamic strings with String(format: String(localized: ...)) so locale-specific number/format substitutions stay correct. - Add a Settings > General Language picker covering System Default plus every bundled language, with a relaunch prompt because AppleLanguages is consumed at app startup. Infrastructure - Extract AppLanguage + AppLanguagePreferences into Models/. AppLanguagePreferences.apply only touches AppleLanguages and preserves AppleLocale. - Wire AppState with injection points (performStartupTasks, locationsProvider, appFileScanner) so the scan-for-app-files path is exercised by a unit test without touching the real filesystem, and expose appFileScanLocationCount / currentAppFileSearchLocationCount so the in-progress scan UI shows the location count instead of the placeholder discovered-files count. Tests - LocalizationFilesTests: parses every PureMac/*.lproj/ Localizable.strings and fails if any locale drifts from en. - AppLanguagePreferencesTests: verify apply(.english) and apply(.system) modify only AppleLanguages. - AppStateTests: verifies scanForAppFiles publishes the location count while results are pending, then resolves to the sorted discovered files. Build - project.yml registers PureMacTests and a shared scheme so `xcodebuild test` works from a clean checkout. xcodeproj regenerated via xcodegen. Verification - plutil -lint OK for all 7 .strings files (227 keys each). - xcodebuild test -only-testing:PureMacTests: 4 tests, 0 failures. - xcodebuild build -configuration Debug: SUCCEEDED. 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
Supersedes #76. Rebased onto current
mainto pick up #70 (Arabic), #75 (FDA TCC), #80 (dashboard redesign + appearance toggle), and #83 (AI history). Retargets the localization work to the new view structure and brings every bundled locale to key parity, enforced by a new XCTest case.Replaces #76 — the previous branch shared no history with current
mainand SmartScanView (which the old PR localized) has been deleted, so a fresh PR was clearer than continuing the closed thread. See #76's review comments for the full original context.What's in this PR
New languages and infrastructure
pt-BR) added alongside the existingen/es/ja/ar/zh-Hans/zh-Hantlocales. Registered inknownRegionsviaxcodegen.System Default, English, Spanish, Japanese, Arabic, Portuguese (Brazil), Chinese (Simplified), Chinese (Traditional). Persists the choice tosettings.general.appLanguageand togglesAppleLanguages(the macOS bundle-localization mechanism).AppLanguage+AppLanguagePreferencesextracted toPureMac/Models/AppLanguage.swift.apply(_:defaults:)only mutatesAppleLanguagesand never touchesAppleLocale, so the user's locale-derived formatting (dates, numbers, currency) stays intact regardless of UI language choice.AppleLanguagesis consumed on app startup. The relaunch uses/usr/bin/open -nso the relaunched instance picks up the new bundle.View-level localization (retargeted to current
main)DashboardView(replaces the oldSmartScanView): hero / scanning / completed / cleaning / cleaned states;StatCard,Suggestion,LegendDot,StorageGauge,ScanningGauge,CategoryToggleRow. Dynamic strings useString(format: String(localized: ...))so locale-specific number formatting stays correct.MainWindow: section labels (Overview/Applications/Cleanup), nav rows (Dashboard,Installed Apps,Orphaned Files), FDA toast, error alert, footer status, empty-state fallback.CategoryDetailView: navigation title, toolbar buttons, sort labels, confirmation dialog, file-list header, and the new hero card.AppListView/AppFilesView/OrphanListView: searchable prompts, navigation titles with counts, refresh / uninstall / remove flows, empty / loading states, context-menu actions, alert dialogs.OnboardingView: intro / instructions / granted / diagnostics sub-views, includingfeatureCardandstepRowhelpers (nowLocalizedStringKey-typed) andProtectedPathlabels.SettingsView: tab labels, section titles, search-sensitivity options + descriptions, language picker, scheduling settings.AppearancePill:.help(...)tooltip routed throughLocalizedStringKeyso the appearance segments are translated.AppStatetest injection pointsAppState's init now acceptsperformStartupTasks,locationsProvider, andappFileScannerso the scan-for-app-files path can be exercised by a unit test without touching the filesystem.appFileScanLocationCount/currentAppFileSearchLocationCountwere added so the in-progress scan UI shows the location count instead of the placeholder discovered-files count.Tests
LocalizationFilesTests— parses everyPureMac/*.lproj/Localizable.stringsand fails if any locale drifts fromen. This is the guard the maintainer asked for; with the dashboard surface now localized, it also catches any future drift in the new strings.AppLanguagePreferencesTests— verifiesapply(.english, defaults:)setsAppleLanguages = ["en"]andapply(.system, defaults:)removes the override, both while preservingAppleLocale.AppStateTests— verifiesscanForAppFilesreports the location count while results are pending and then resolves to the sorted discovered files via the injected scanner.Build infrastructure
project.ymlnow registers thePureMacTeststarget and a sharedPureMacscheme that builds both targets and runs the tests, soxcodebuild test -scheme PureMacworks from a clean checkout.PureMac.xcodeproj/xcshareddata/xcschemes/PureMac.xcschemechecked in.Locale key counts
The
zh-Hantdrift from #76's review was resolved by rebuilding the file from the canonicalenkey set during this rebase.Verification
Test plan
xcodegen generate(matches the committed.xcodeproj)xcodebuild -scheme PureMac -configuration Debug buildsucceedsxcodebuild test -scheme PureMac -only-testing:PureMacTestsreports 4 tests, 0 failuresSettings → General → Language, switch toPortuguese (Brazil), relaunch via the button, and spot-check that:Visão geral/Aplicativos/LimpezaArmazenamento/livres de %@Sistema (padrão)after relaunch falls back to the system languagearfor RTL safety: section headers and toolbar buttons should mirror correctly under the new dashboardAI Assistance Disclosure
This PR was prepared with Claude Code (Anthropic) under human direction. The maintainer's review comment on #76 was the spec; the human reviewed and approved the rebase scope, the choice to retarget rather than reapply, and the final translations before publication.
🤖 Generated with Claude Code