add missing label translations (#1385)

This commit is contained in:
abhix4
2025-06-20 05:16:21 +05:30
committed by GitHub
parent 48d1df65b6
commit 310dbf4854
3 changed files with 27 additions and 17 deletions

View File

@@ -55,18 +55,18 @@ export default function LabelsPage() {
? updateLabel({ id: editingLabel.id!, name: data.name, color: data.color })
: createLabel({ color: data.color, name: data.name }),
{
loading: 'Saving label...',
success: 'Label saved successfully',
error: 'Failed to save label',
loading: t('common.labels.savingLabel'),
success: t('common.labels.saveLabelSuccess'),
error: t('common.labels.failedToSavingLabel'),
},
);
};
const handleDelete = async (id: string) => {
toast.promise(deleteLabel({ id }), {
loading: 'Deleting label...',
success: 'Label deleted successfully',
error: 'Failed to delete label',
loading: t('common.labels.deletingLabel'),
success: t('common.labels.deleteLabelSuccess'),
error: t('common.labels.failedToDeleteLabel'),
finally: async () => {
await refetch();
},
@@ -88,7 +88,7 @@ export default function LabelsPage() {
trigger={
<Button onClick={() => setEditingLabel(null)}>
<Plus className="mr-2 h-4 w-4" />
Create Label
{t('common.mail.createNewLabel')}
</Button>
}
editingLabel={editingLabel}
@@ -114,7 +114,7 @@ export default function LabelsPage() {
<p className="text-muted-foreground py-4 text-center text-sm">{error.message}</p>
) : labels?.length === 0 ? (
<p className="text-muted-foreground py-4 text-center text-sm">
No labels created yet. Click the button above to create one.
{t('common.mail.noLabelsAvailable')}
</p>
) : (
<div className="grid grid-cols-2 gap-2 sm:grid-cols-4 md:grid-cols-6">
@@ -148,7 +148,7 @@ export default function LabelsPage() {
</Button>
</TooltipTrigger>
<TooltipContent className="dark:bg-panelDark mb-1 bg-white">
Edit Label
{t('common.labels.editLabel')}
</TooltipContent>
</Tooltip>
<Tooltip>
@@ -163,7 +163,7 @@ export default function LabelsPage() {
</Button>
</TooltipTrigger>
<TooltipContent className="dark:bg-panelDark mb-1 bg-white">
Delete Label
{t('common.labels.deleteLabel')}
</TooltipContent>
</Tooltip>
</div>

View File

@@ -22,6 +22,7 @@ import { Label } from '@/components/ui/label';
import { useState, useEffect } from 'react';
import { useForm } from 'react-hook-form';
import { Command } from 'lucide-react';
import { useTranslations } from 'use-intl';
interface LabelDialogProps {
trigger?: React.ReactNode;
@@ -44,7 +45,7 @@ export function LabelDialog({
const isControlled = open !== undefined;
const dialogOpen = isControlled ? open : isOpen;
const setDialogOpen = isControlled ? onOpenChange! : setIsOpen;
const t = useTranslations();
const form = useForm<LabelType>({
defaultValues: {
name: '',
@@ -90,7 +91,7 @@ export function LabelDialog({
{trigger && <DialogTrigger asChild>{trigger}</DialogTrigger>}
<DialogContent showOverlay={true}>
<DialogHeader>
<DialogTitle>{editingLabel ? 'Edit Label' : 'Create New Label'}</DialogTitle>
<DialogTitle>{editingLabel ? t('common.labels.editLabel') : t('common.mail.createNewLabel')}</DialogTitle>
</DialogHeader>
<Form {...form}>
<form
@@ -109,7 +110,7 @@ export function LabelDialog({
name="name"
render={({ field }) => (
<FormItem>
<FormLabel>Label Name</FormLabel>
<FormLabel>{t('common.labels.labelName')}</FormLabel>
<FormControl>
<Input placeholder="Enter label name" {...field} autoFocus />
</FormControl>
@@ -118,7 +119,7 @@ export function LabelDialog({
)}
/>
<div className="space-y-2">
<Label>Color</Label>
<Label>{t('common.labels.color')}</Label>
<div className="w-full">
<div className="flex flex-wrap gap-2">
{LABEL_COLORS.map((color, index) => (
@@ -146,10 +147,10 @@ export function LabelDialog({
</div>
<div className="flex justify-end gap-2">
<Button className="h-8" type="button" variant="outline" onClick={handleClose}>
Cancel
{t('common.actions.cancel')}
</Button>
<Button className="h-8 [&_svg]:size-4" type="submit">
{editingLabel ? 'Save Changes' : 'Create Label'}
{editingLabel ? t('common.actions.saveChanges') : t('common.labels.createLabel')}
<div className="flex h-5 items-center justify-center gap-1 rounded-sm bg-white/10 px-1 dark:bg-black/10">
<Command className="h-3 w-3 text-white dark:text-[#929292]" />
<CurvedArrow className="mt-1.5 h-3.5 w-3.5 fill-white dark:fill-[#929292]" />

View File

@@ -328,12 +328,21 @@
"mb": "{amount} MB"
},
"labels": {
"color":"Color",
"labelName":"Label Name",
"createLabel":"Create Label",
"deleteLabel": "Delete Label",
"deleteLabelConfirm": "Are you sure you want to delete this label?",
"deleteLabelConfirmDescription": "This action cannot be undone.",
"deleteLabelConfirmCancel": "Cancel",
"deleteLabelConfirmDelete": "Delete",
"deleteLabelSuccess": "Label deleted successfully"
"deleteLabelSuccess": "Label deleted successfully",
"failedToDeleteLabel":"Failed to delete label",
"deletingLabel":"Deleting label...",
"editLabel":"Edit Label",
"savingLabel":"Saving label...",
"failedToSavingLabel":"Failed to save label",
"saveLabelSuccess":"Label saved successfully"
}
},
"navigation": {