Conversation
WalkthroughThe change updates the command palette component to display command item titles using a translation function, enabling support for localization of these titles in the user interface. Changes
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 (
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Merge activity
|
| )} | ||
| <div className="ml-2 flex flex-1 flex-col"> | ||
| <span>{item.title}</span> | ||
| <span>{t(item.title)}</span> |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Verify translation key structure and add missing translations.
The change correctly adds i18n support, but there are potential issues with the current approach:
-
Hardcoded titles: Many command titles are hardcoded English strings (e.g., "Compose Email", "Search Emails" on lines 675, 684) rather than translation keys. The
t()function will look for these as keys in translation files. -
Inconsistent pattern: The existing group title translation (lines 779-780) uses structured keys like
common.commandPalette.groups.${groupKey}, suggesting a more organized approach.
Consider updating hardcoded command titles to use proper translation keys:
- mailCommands.push({
- title: 'Compose Email',
- icon: Pencil2,
+ mailCommands.push({
+ title: 'common.commandPalette.commands.composeEmail',
+ icon: Pencil2,Run this script to identify all hardcoded command titles that need translation keys:
🏁 Script executed:
#!/bin/bash
# Find hardcoded string titles in command definitions
rg -A 2 -B 2 "title:\s*['\"](?!common\.)[^'\"]+['\"]" apps/mail/components/context/command-palette-context.tsxLength of output: 370
🏁 Script executed:
#!/bin/bash
# Find hardcoded string titles in command definitions excluding common.* keys using PCRE2
rg --pcre2 -n -A 2 -B 2 "title:\s*['\"](?!common\.)[^'\"]+['\"]" apps/mail/components/context/command-palette-context.tsxLength of output: 1235
Ensure all command titles use structured translation keys
The command-palette titles currently include several hardcoded English strings. To prevent missing keys at runtime and maintain consistency with existing group translations (common.commandPalette.groups.*), please convert these titles to structured keys under common.commandPalette.commands.*. Specifically:
• apps/mail/components/context/command-palette-context.tsx
– Line 458: replace 'Unread Emails' → common.commandPalette.commands.unreadEmails
– Line 472: replace 'Starred Emails' → common.commandPalette.commands.starredEmails
– Line 486: replace 'With Attachments' → common.commandPalette.commands.withAttachments
– Line 500: replace 'Last 7 Days' → common.commandPalette.commands.last7Days
– Line 675: replace 'Compose Email' → common.commandPalette.commands.composeEmail
– Line 684: replace 'Search Emails' → common.commandPalette.commands.searchEmails
– Line 694: replace 'Filter Emails' → common.commandPalette.commands.filterEmails
– (Optional) Lines 704 & 713 for commented-out commands ('Saved Searches', 'Filter Builder') should become common.commandPalette.commands.savedSearches and common.commandPalette.commands.filterBuilder
Example diff for one command:
- title: 'Compose Email',
+ title: 'common.commandPalette.commands.composeEmail',Also update your translation JSON/PO files with matching entries for each new key.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In apps/mail/components/context/command-palette-context.tsx around lines 458,
472, 486, 500, 675, 684, and 694, replace hardcoded English command titles with
structured translation keys under common.commandPalette.commands.* (e.g.,
'Unread Emails' to common.commandPalette.commands.unreadEmails). This ensures
consistent i18n usage and prevents missing keys at runtime. Also update
translation JSON/PO files to include these new keys and optionally do the same
for commented-out commands on lines 704 and 713.

TL;DR
Added translation support for command palette item titles.
What changed?
Wrapped the
item.titlein the command palette with the translation functiont()to enable internationalization of command palette items.How to test?
Why make this change?
To improve the user experience for non-English speakers by ensuring command palette items are displayed in the user's preferred language, making the application more accessible to a global audience.
Summary by CodeRabbit