Skip to content

Add pt-BR localization support#42

Open
edufalcao wants to merge 1 commit intomomenbasel:mainfrom
edufalcao:feature/localization-pt-br
Open

Add pt-BR localization support#42
edufalcao wants to merge 1 commit intomomenbasel:mainfrom
edufalcao:feature/localization-pt-br

Conversation

@edufalcao
Copy link
Copy Markdown

Summary

This PR adds Brazilian Portuguese (pt-BR) localization support and broadens the app's localization infrastructure so the UI can be translated consistently across supported languages.

The main changes are:

  • Adds a new PureMac/pt-BR.lproj/Localizable.strings file with Brazilian Portuguese translations for the current localized UI surface.
  • Registers pt-BR in the Xcode project so the new localization is included in the app bundle.
  • Expands the English localization table to cover the UI strings touched by the app's main flows.
  • Completes the Simplified Chinese (zh-Hans) and Traditional Chinese (zh-Hant) localization files so all supported locale files have matching key sets.
  • Preserves format specifiers such as %@ and %lld across localized strings used by formatted labels.
  • Updates SwiftUI views to use localization-aware APIs, including LocalizedStringKey and String(localized:), where strings are displayed or formatted dynamically.
  • Adds a language picker under Settings > General with options for:
    • System Default
    • English
    • Portuguese (Brazil)
    • Chinese (Simplified)
    • Chinese (Traditional)
  • Persists the user's language selection with a dedicated app preference key, while applying AppleLanguages as the macOS localization override.
  • Keeps first launch behavior aligned with the system language by defaulting the language picker to System Default unless the user chooses an app-specific language.
  • Adds a relaunch prompt and relaunch action after changing the app language, since bundle localization is applied on app startup.
  • Adjusts app launch argument handling so LaunchServices -psn_... arguments do not accidentally trigger CLI mode when the app is opened normally.
  • Removes deprecated single-parameter .onChange usage by replacing those flows with explicit SwiftUI bindings.

Notes for reviewers

  • The localization files were checked for key parity against English. pt-BR, zh-Hans, and zh-Hant all contain the same keys as en.
  • The language picker intentionally includes a System Default option so existing users and first-time users continue to follow macOS language preferences unless they explicitly choose an app language.
  • The app-specific language preference is stored separately from AppleLanguages; AppleLanguages is treated as an implementation detail for macOS bundle localization.
  • Some legacy keys remain in the localization files even if they are not currently referenced by Swift code, so this PR preserves compatibility instead of deleting existing translation surface area.

Verification

Ran the following checks successfully before opening this PR:

  • git diff --check upstream/main...HEAD
  • plutil -lint PureMac/en.lproj/Localizable.strings PureMac/pt-BR.lproj/Localizable.strings PureMac/zh-Hans.lproj/Localizable.strings PureMac/zh-Hant.lproj/Localizable.strings
  • Locale key parity check comparing pt-BR, zh-Hans, and zh-Hant against en
  • rg -n '\.onChange\(' PureMac confirmed there are no remaining .onChange usages
  • xcodebuild -project PureMac.xcodeproj -scheme PureMac -configuration Debug -derivedDataPath .build/XcodeDerivedData CODE_SIGNING_ALLOWED=NO CODE_SIGN_IDENTITY= build

The Xcode build completed with BUILD SUCCEEDED.

AI assistance disclosure

This contribution was implemented by an AI coding agent, OpenAI Codex, under human oversight. The human maintainer directed the requirements, selected the pt-BR localization scope, reviewed behavior during development, requested corrections, and approved publishing this branch for review.

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