resolve inconsistencies in translation usage#1499
Conversation
WalkthroughThis update replaces hardcoded English UI text in mail-related components with translation function calls for internationalization. It also adjusts the logic for generating translation keys for mail categories and adds new translation keys to the English locale JSON file. No exported interfaces or control flow are changed. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UIComponent
participant TranslationModule
User->>UIComponent: Interacts with mail UI (e.g., opens details, prints, replies)
UIComponent->>TranslationModule: Requests localized string via t('key')
TranslationModule-->>UIComponent: Returns localized string
UIComponent-->>User: Displays localized UI text
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/mail/locales/en.json (1)
190-191: Minor JSON style inconsistencyKey/value pairs elsewhere follow the pattern
"key": "value"(space after the colon).
For visual consistency consider:- "print":"Print" + "print": "Print"No functional impact, purely cosmetic.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
apps/mail/components/mail/mail-display.tsx(3 hunks)apps/mail/components/mail/mail.tsx(1 hunks)apps/mail/components/mail/thread-display.tsx(3 hunks)apps/mail/locales/en.json(2 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/components/mail/mail-display.tsx (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/components/mail/mail.tsx (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/components/mail/thread-display.tsx (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
🔇 Additional comments (8)
apps/mail/locales/en.json (1)
210-211: Add new keys to all locale files
printThreadis now referenced in code. Make sure the same key is added (even temporarily with the English string) to every other locale to avoid run-time fallback / missing-message warnings.apps/mail/components/mail/thread-display.tsx (3)
890-891: Good switch to i18n helper
replyAlllabel now uses the translation helper – matchescommon.threadDisplay.replyAllinen.json.
983-985: Verify key existence across locales
common.threadDisplay.printThreadis new. If any non-English locale is missing this key the UI will show a fallback/empty string.
993-995: Correct section for “Unsubscribe”Moving the key to
mailDisplay.unsubscribekeeps similar actions together – nice tidy-up.apps/mail/components/mail/mail-display.tsx (3)
1485-1487: Excellent internationalization improvement!The replacement of hardcoded "Details" text with
t('common.mailDisplay.details')properly enables localization for this UI element.
1635-1637: Good translation implementation!The "Print" label is now properly internationalized with
t('common.mailDisplay.print'), maintaining consistency with the overall i18n effort.
1658-1660: Consistent translation pattern applied!The "To:" label replacement with
t('common.mailDisplay.to')follows the established translation key naming convention and enables proper localization.apps/mail/components/mail/mail.tsx (1)
834-834: Improved translation key construction logic!The refined approach to creating camelCase translation keys (e.g., "All Mail" → "allMail") is well-implemented. The logic correctly handles multi-word category IDs by lowercasing only the first word and preserving proper casing for subsequent words. The fallback to
cat.nameensures graceful degradation when translations are missing.
Description
fix the categories label translations and more on thread display.
Type of Change
Please delete options that are not relevant.
Areas Affected
Please check all that apply:
Testing Done
Describe the tests you've done:
Security Considerations
For changes involving data or authentication:
Checklist
Additional Notes
Add any other context about the pull request here.
Screenshots/Recordings
Add screenshots or recordings here if applicable.
By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation