feat: Add German (de) i18n support#237
Conversation
Adds complete German i18n support (~450 translated keys) and registers 'de' as a supported language in the settings UI.
There was a problem hiding this comment.
Review mode: initial
Findings
-
[Minor] Language detection in SettingsGeneral uses
startsWithfor German
src/renderer/components/settings/SettingsGeneral.tsx:11-13usesi18n.language.startsWith('de')to detect German. This would also match variants likede-AT,de-DE, etc. While this is functional for these variants, consider using an exact match or the language code normalization (e.g.,i18n.language.split('-')[0] === 'de') to avoid potential ambiguity.
Suggested fix:const lang = i18n.language.split('-')[0]; const currentLang = lang === 'zh' ? 'zh' : lang === 'de' ? 'de' : 'en';
-
[Minor] Missing fallback for some common keys?
The German translation file (de.json) appears comprehensive, but a spot-check reveals the absence of keys likecommon.search,common.remove,common.download, andcommon.importthat might exist in the English locale. If these keys are used elsewhere with a fallback string (e.g.,t('common.remove', 'Remove')), no issue occurs. However, if they are used without a fallback, the displayed text will be empty. Recommend verifying that all keys used in the UI either have a fallback value or a translation.
Suggested fix: Ensure allt()calls provide a fallback string, or audit the English locale for keys not present inde.json. -
[Nit] Removal of Chinese comments in config.ts
Two Chinese comments were removed fromsrc/renderer/i18n/config.ts. While not functionally impactful, this reduces code readability for Chinese-speaking developers. Consider re-adding them in English for consistency.
Summary
The PR adds complete German i18n support (~917 lines of translations) and registers German as a supported language. The implementation is solid: de.json covers all major UI sections, uses proper pluralization keys, and includes correct parameter interpolation. The integration in config.ts and SettingsGeneral.tsx is clean and follows existing patterns. No regressions or security issues were identified.
Testing
No automated tests were added for the new locale. Consider adding a test that verifies all keys from the English locale exist in de.json to prevent future translation gaps. This can be done by comparing key structures or using a snapshot test.
Open Cowork Bot
There was a problem hiding this comment.
Review mode: follow-up after new commits
Findings
-
[Minor] Unresolved: Language detection using
startsWith
As noted in the previous review,src/renderer/components/settings/SettingsGeneral.tsx:11-13usesstartsWith('de'), which matchesde-AT,de-DE, etc. This is not addressed in the new commits. Consider normalizing the language code before comparison. -
[Minor] Unresolved: Possible missing translation keys
The previous review flagged that keys likecommon.search,common.remove,common.download, andcommon.importmay be absent fromde.jsonif they exist in the English locale. This has not been verified. Ensure all keys used in the UI either have a German translation or a fallback string int()calls. -
[Nit] Unresolved: Chinese comments removed
Two Chinese comments were removed fromsrc/renderer/i18n/config.ts. Not functionally impactful, but reduces readability for Chinese-speaking developers.
What's improved
The only changes in this follow-up are the addition of the "german" translation key to en.json and zh.json. This ensures the language name “German” / “德语” appears correctly when the German locale is active, addressing a gap from the initial PR. No new issues introduced.
Summary
The new commits add the missing "german" key to English and Chinese language files. The three minor issues from the previous review remain unaddressed. No regressions or security issues.
Testing
Not run (automation). Consider adding a test that verifies all keys from the English locale are present in de.json to prevent translation drift.
Open Cowork Bot
There was a problem hiding this comment.
Review mode: follow-up after new commits
Findings
-
[Minor] Resolved: Language detection normalized
The previous review flagged thati18n.language.startsWith('de')would incorrectly match regional variants likede-AT. The new commit replaces this withi18n.language.split('-')[0]and exact equality checks (lang === 'zh' ? 'zh' : lang === 'de' ? 'de' : 'en'), which correctly handlesde-DE,de-CH, etc. (src/renderer/components/settings/SettingsGeneral.tsx:11-13) -
Previous review items re-evaluated
- Possible missing translation keys: Based on the provided excerpts, the German locale (
de.json) contains all keys present in the English locale under the sections shown (e.g.,language.english,language.chinese,language.german). The translation appears complete. No evidence of missing keys was found in the examined context. - Chinese comments removed from
config.ts: The new commit replaced Chinese comments with English ones. This is a stylistic choice with no functional impact.
- Possible missing translation keys: Based on the provided excerpts, the German locale (
-
No new issues introduced
The only code changes beyond thede.jsonfile are the language detection fix and English comment additions. No regressions, security concerns, or data loss risks are introduced.
Summary
The follow-up commits successfully address the previous review's main concern (language detection). The PR remains a clean addition of German i18n support with all necessary infrastructure changes. No action required.
Testing
Not run (automation). Consider adding a test that validates all keys from the English locale are present in de.json to prevent translation drift in future updates.
Open Cowork Bot
Adds complete German i18n support (~450 translated keys) and registers 'de' as a supported language in the settings UI.
Changes