Skip to content

Add pt-BR localization support + language picker structure#76

Open
edufalcao wants to merge 5 commits intomomenbasel:mainfrom
edufalcao:feature/localization-pt-br
Open

Add pt-BR localization support + language picker structure#76
edufalcao wants to merge 5 commits intomomenbasel:mainfrom
edufalcao:feature/localization-pt-br

Conversation

@edufalcao
Copy link
Copy Markdown

@edufalcao edufalcao commented Apr 27, 2026

Summary

This PR supersedes and references the closed localization PR #42.

PR #42 introduced Brazilian Portuguese (pt-BR) localization support, the language picker infrastructure, and supporting localization/test changes. After #42 was closed, main moved forward with overlapping work in Docker Cache localization, Spanish localization, and CLI launch handling. This PR rebases that work onto the current main and addresses the reviewer feedback from #42 so the Portuguese localization can be reviewed against the latest codebase.

Reference: #42

Work Carried Over From #42

  • Adds Brazilian Portuguese localization via PureMac/pt-BR.lproj/Localizable.strings.
  • Registers pt-BR in the Xcode project so the localization is bundled with the app.
  • Updates SwiftUI views to use localization-aware strings for the main UI flows.
  • Adds localized strings for navigation, cleaning categories, smart scan states, app uninstaller flows, orphaned files, onboarding, settings, language selection, and app metadata.
  • Adds a Settings > General language picker with:
    • System Default
    • English
    • Portuguese (Brazil)
    • Chinese (Simplified)
    • Chinese (Traditional)
  • Adds app-specific language preference handling through AppLanguagePreferences.
  • Preserves the user's locale while applying or removing the AppleLanguages override used by macOS bundle localization.
  • Adds a relaunch prompt and relaunch action after changing the app language, because bundle localization is applied on app startup.
  • Adds tests around app language preference behavior.
  • Adds app-state test coverage for app-file scan location tracking while async scan results are pending.
  • Keeps the shared Xcode scheme and test target configuration so the unit tests can be run consistently from xcodebuild.

Changes Specific To This New PR

  • Rebases the branch onto the current upstream main.
  • Resolves the conflicts introduced after Add pt-BR localization support #42 by preserving the already-merged upstream work.
  • Drops the now-redundant -psn_<pid> launch argument filtering from Add pt-BR localization support #42.
  • Keeps upstream's narrower CLI dispatch fix from fix(cli): only enter CLI mode for known commands #68, which only enters CLI mode when the first argument is a known CLI command.
  • Keeps the XCTest launch guard so test-injected launch arguments do not trigger CLI mode.
  • Reconciles Localizable.strings with the Docker Cache keys that landed after Add pt-BR localization support #42.
  • Completes Spanish (es) localization key coverage for the expanded localization surface introduced by this PR.
  • Adds missing Spanish translations for app uninstaller, onboarding, language picker, settings, Node Cache, and Docker Cache strings so es, en, and pt-BR remain compatible.
  • Completes Japanese (ja) localization key coverage for the expanded localization surface.
  • Adds the missing Traditional Chinese (zh-Hant) Node Cache and Docker Cache keys.
  • Adds an XCTest guard that parses every *.lproj/Localizable.strings file and fails if any locale has missing or extra keys compared with English.
  • Adds the missing pt-BR translations for the Node Cache and Docker Cache strings:
    • Node Cache
    • npm, yarn, and pnpm download caches
    • npm cache
    • yarn classic cache
    • pnpm content-addressable store
    • Docker Cache
    • Docker images, containers, and build cache
    • Reclaimable (run \docker system prune -af`)`
  • Preserves the Spanish (es) localization precedent now present on main while bringing it to the same key coverage as pt-BR.
  • Regenerates the Xcode project from project.yml after the rebase so the project file includes current upstream localizations, the new Portuguese localization, and the unit test target without stale conflict artifacts.
  • Confirms GitHub has no unresolved inline review threads remaining for Add pt-BR localization support #42; the remaining actionable feedback was in the top-level owner comment and is addressed here.

Reviewer Notes

  • The Portuguese and Spanish localizations now have key parity with English.
  • The PR intentionally preserves upstream's CLI allow-list approach instead of reintroducing -psn_ filtering.
  • The language picker still defaults to System Default so existing and first-time users follow macOS language settings unless they explicitly choose an app language.
  • The app-specific language preference remains separate from AppleLanguages; AppleLanguages is only used as the macOS bundle-localization mechanism.
  • Existing Spanish, Japanese, Simplified Chinese, and Traditional Chinese project registrations remain intact after the rebase.
  • The localization key parity check is now part of the unit test suite, so future localization drift is caught by xcodebuild test.

Localization Consistency Guard

This PR now includes LocalizationFilesTests, an XCTest case that loads every PureMac/*.lproj/Localizable.strings file from the source tree and compares its keys against en.lproj/Localizable.strings.

This is important because the app uses the English strings as localization keys. If one locale is missing a key, users in that language can see fallback English text or untranslated key text in parts of the UI. If a locale has extra keys, it usually means a stale or mistyped localization entry exists and the files are starting to drift. Both cases make future localization updates harder to review because each language no longer represents the same UI surface.

The new test enforces that all supported languages stay structurally consistent:

  • es
  • ja
  • pt-BR
  • zh-Hans
  • zh-Hant

While adding this test, it caught real gaps in the existing localization files. This PR therefore also completes the missing Japanese keys and the missing Traditional Chinese Node/Docker cache keys so the test can enforce parity for every bundled language, not only the newly added Portuguese localization.

Verification

Ran the following checks after the rebase:

  • plutil -lint PureMac/en.lproj/Localizable.strings PureMac/es.lproj/Localizable.strings PureMac/pt-BR.lproj/Localizable.strings PureMac/ja.lproj/Localizable.strings PureMac/zh-Hans.lproj/Localizable.strings PureMac/zh-Hant.lproj/Localizable.strings
  • Locale key parity checks comparing every localization file against en
  • xcodebuild test -project PureMac.xcodeproj -scheme PureMac -destination 'platform=macOS' -only-testing:PureMacTests/LocalizationFilesTests CODE_SIGNING_ALLOWED=NO CODE_SIGN_IDENTITY=''
  • xcodebuild test -project PureMac.xcodeproj -scheme PureMac -destination 'platform=macOS' -only-testing:PureMacTests CODE_SIGNING_ALLOWED=NO CODE_SIGN_IDENTITY=''
  • xcodebuild -project PureMac.xcodeproj -scheme PureMac -configuration Debug -destination 'platform=macOS' build CODE_SIGNING_ALLOWED=NO CODE_SIGN_IDENTITY=''

Results:

  • All localization files passed plutil -lint.
  • All localizations have no missing or extra keys compared with en.
  • Unit tests passed: 4 tests, 0 failures.
  • Debug app build succeeded.

AI Assistance Disclosure

This contribution was implemented with assistance from OpenAI Codex under human direction. The human maintainer provided the task, reviewed the previous PR feedback, requested the rebase and PR follow-up, and directed publication of this updated branch for review.

@edufalcao edufalcao changed the title Add pt-BR localization support Add pt-BR localization support + language picker structure Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant