feat: add German (de) localization#23
Conversation
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.
There was a problem hiding this comment.
💡 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") |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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.
Summary
en.lprojandde.lprojfor bothTrimmyandTrimmyCoretargetsChanges
defaultLocalization: "en",.process("Resources")for both targetsText(LocalizedStringKey(self.title))for auto-localizationNSLocalizedString(_:bundle:.module)for enum-based stringsTest plan
swift build --target Trimmycompiles without errorsswift build --target TrimmyCorecompiles without errors