Skip to content

feat: add German (de) localization#23

Open
kevin-hillman wants to merge 2 commits intosteipete:mainfrom
kevin-hillman:feat/german-localization
Open

feat: add German (de) localization#23
kevin-hillman wants to merge 2 commits intosteipete:mainfrom
kevin-hillman:feat/german-localization

Conversation

@kevin-hillman
Copy link
Copy Markdown

Summary

  • Adds proper localization infrastructure with en.lproj and de.lproj for both Trimmy and TrimmyCore targets
  • 70+ user-facing strings translated to German
  • English remains the default — German activates automatically when the system language is German

Changes

  • Package.swift: defaultLocalization: "en", .process("Resources") for both targets
  • PreferenceToggleRow: Text(LocalizedStringKey(self.title)) for auto-localization
  • Aggressiveness / GeneralAggressiveness: NSLocalizedString(_:bundle:.module) for enum-based strings
  • Localizable.strings: Complete en + de string tables for all UI text

Test plan

  • swift build --target Trimmy compiles without errors
  • swift build --target TrimmyCore compiles without errors
  • Verify German UI by setting System Language to German
  • Verify English UI remains unchanged with English system language

Add proper localization infrastructure with en/de Localizable.strings
for both the Trimmy app and TrimmyCore targets.

Changes:
- Package.swift: add defaultLocalization and resource declarations
- PreferenceToggleRow: use LocalizedStringKey for auto-localization
- Aggressiveness/GeneralAggressiveness: use NSLocalizedString with
  Bundle.module for enum-based strings
- 70+ strings translated to German

English remains the default language. German UI activates automatically
when the system language is set to German.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5ef757dd1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

case .low: "Low (safer)"
case .normal: "Normal"
case .high: "High (more eager)"
case .low: NSLocalizedString("Low (safer)", bundle: .module, comment: "Aggressiveness level")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use safe bundle lookup for TrimmyCore localizations

The new NSLocalizedString(..., bundle: .module, ...) calls can crash packaged apps built via Scripts/package_app.sh: that workflow copies SwiftPM bundles into Trimmy.app/Contents/Resources and already patches KeyboardShortcuts specifically because autogenerated Bundle.module fatals when the bundle is not at the app root. Aggressiveness.title/titleShort/blurb are now calling .module on common runtime paths (settings and clipboard handling), so the same bundle-resolution trap can be hit for TrimmyCore unless packaging or lookup logic is adjusted.

Useful? React with 👍 / 👎.

switch self {
case .none:
"None (no auto-trim)"
NSLocalizedString("None (no auto-trim)", comment: "GeneralAggressiveness level")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve Trimmy strings from the target resource bundle

These NSLocalizedString calls use the default bundle (Bundle.main), but the new Trimmy Localizable.strings files are added as SwiftPM processed resources, so they are not guaranteed to be found through Bundle.main in the packaged app layout. In that case, German never loads for the “None” labels/blurb and users just see fallback English keys, which defeats the localization added in this commit.

Useful? React with 👍 / 👎.

…iveness

Address review feedback:
- P1: Replace Bundle.module with Bundle.trimmyCoreSafeBundle in
  Aggressiveness.swift to avoid fatal trap when the resource bundle
  is not at the expected path in the packaged app layout.
- P2: Add bundle: .module to NSLocalizedString calls in
  GeneralAggressiveness.swift so German strings are found from
  the Trimmy target's resource bundle.
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