add missing label translations#1385
Conversation
WalkthroughThe changes introduce internationalization for label management features in the mail application. All hardcoded English UI strings related to label creation, editing, deletion, and notifications are replaced with translation function calls. Corresponding translation keys are added to the English locale JSON file. No changes are made to logic or control flow. Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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 (3)
apps/mail/locales/en.json (1)
330-345: Inconsistent key naming:failedToSavingLabelThe key
failedToSavingLabelis grammatically awkward and diverges from thefailedToDeleteLabelpattern. Consider renaming it tofailedToSaveLabel(and update its usages) for clarity and consistency.apps/mail/app/(routes)/settings/labels/page.tsx (1)
89-93: Translation key for "Create New Label"The trigger button uses
t('common.mail.createNewLabel'), which refers to the mail context. It works, but consider unifying undercommon.labels.createLabelfor consistency in label management screens.apps/mail/components/labels/label-dialog.tsx (1)
94-95: Dialog title translationsThe title switches between
t('common.labels.editLabel')andt('common.mail.createNewLabel'). Both keys exist, but consider usingcommon.labels.createLabelfor the creation path to avoid mixing namespaces.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/mail/app/(routes)/settings/labels/page.tsx(5 hunks)apps/mail/components/labels/label-dialog.tsx(6 hunks)apps/mail/locales/en.json(1 hunks)
🔇 Additional comments (11)
apps/mail/locales/en.json (1)
330-345: Translations added for label managementNew entries under
common.labelscover label creation, editing, deletion, and feedback states. Ensure consistency and completeness of these keys across all locales.Run this script to verify that other locale JSON files have matching
common.labelsentries:#!/bin/bash LOCALES_DIR="apps/mail/locales" # Define expected translation keys keys=(color labelName createLabel deleteLabel deleteLabelConfirm deleteLabelConfirmDescription deleteLabelConfirmCancel deleteLabelConfirmDelete deleteLabelSuccess failedToDeleteLabel deletingLabel editLabel savingLabel failedToSavingLabel saveLabelSuccess) for file in "$LOCALES_DIR"/*.json; do [[ "$(basename "$file")" == "en.json" ]] && continue for key in "${keys[@]}"; do jq -e ".common.labels[\"$key\"]" "$file" >/dev/null || echo "Missing key '$key' in $file" done doneapps/mail/app/(routes)/settings/labels/page.tsx (5)
58-61: Internationalization applied correctly for save operationsThe toast messages in
handleSubmitnow uset('common.labels.savingLabel'),t('common.labels.saveLabelSuccess'), andt('common.labels.failedToSavingLabel'). The keys exist and align with the new locale entries.
67-70: Internationalization applied correctly for delete operationsThe toast messages in
handleDeletenow uset('common.labels.deletingLabel'),t('common.labels.deleteLabelSuccess'), andt('common.labels.failedToDeleteLabel'). The translations are consistent and correct.
115-118: Internationalization of empty state messageThe empty state now calls
t('common.mail.noLabelsAvailable'), matching the JSON entry and providing localized feedback when there are no labels.
147-152: Tooltip uses translated "Edit Label"The edit icon tooltip now leverages
t('common.labels.editLabel'), which matches theeditLabellocale entry.
158-167: Tooltip uses translated "Delete Label"The delete icon tooltip calls
t('common.labels.deleteLabel'), correctly localizing the delete action label.apps/mail/components/labels/label-dialog.tsx (5)
25-26: Translation hook integrationImporting and invoking
useTranslationsto obtaintis correct. The component now renders all UI text viat().
113-114: Form label internationalization
FormLabelnow usest('common.labels.labelName'), matching the locale entry for the label name field.
122-123: Color picker label translationThe color picker label uses
t('common.labels.color'), which aligns with the locale.
149-151: Cancel button translationThe cancel button label correctly references
t('common.actions.cancel').
152-154: Submit button translationsThe submit button text now depends on the mode: it uses
t('common.actions.saveChanges')when editing andt('common.labels.createLabel')when creating. Both keys are present and appropriate.
Description
TL;DR:
Filled missing translations and made sure useTranslation is applied where needed.
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