From f0967f90ebde6764de8bcb53cb777f0510da63f0 Mon Sep 17 00:00:00 2001 From: Luis Felipe Marzagao Date: Wed, 29 Apr 2026 00:47:22 +0000 Subject: [PATCH] fix: implement useTranslations for start date on event modal --- components/calendar/event-modal.tsx | 221 +++++++++++++++------------- locales/en/common.json | 16 +- locales/fr/common.json | 16 +- locales/pt/common.json | 14 ++ 4 files changed, 159 insertions(+), 108 deletions(-) diff --git a/components/calendar/event-modal.tsx b/components/calendar/event-modal.tsx index 346338a3..e5e31a36 100644 --- a/components/calendar/event-modal.tsx +++ b/components/calendar/event-modal.tsx @@ -130,6 +130,15 @@ export function EventModal({ const timeFormat = useSettingsStore((s) => s.timeFormat); const timeDisplayFmt = timeFormat === "12h" ? "h:mm a" : "HH:mm"; const isEdit = !!event; + + const formatEventDate = useCallback((startD: Date): string => { + const dayOfWeek = format(startD, "EEE").toLowerCase(); + const month = format(startD, "MMM").toLowerCase(); + const day = format(startD, "d"); + const year = format(startD, "yyyy"); + return `${t(`days.${dayOfWeek}`)}, ${t(`months.${month}`)} ${day}, ${year}`; + }, [t]); + const [mode, setMode] = useState<"view" | "edit">(isEdit ? "view" : "edit"); const userIsOrganizer = useMemo(() => { @@ -495,14 +504,14 @@ export function EventModal({ return (
-
-

{event.title || t("events.no_title")}

- -
+
+

{event.title || t("events.no_title")}

+ +
-
+
@@ -517,7 +526,7 @@ export function EventModal({
- {format(startD, "EEE, MMM d, yyyy")} + {formatEventDate(startD)} {!event.showWithoutTime && ( {format(startD, timeDisplayFmt)} – {format(endD, timeDisplayFmt)} @@ -550,48 +559,48 @@ export function EventModal({
)}
-
+
-
-
- {t("participants.rsvp_label")} -
- - - -
+
+
+ {t("participants.rsvp_label")} +
+ + +
+
); } @@ -638,7 +647,7 @@ export function EventModal({
- {format(startD, "EEE, MMM d, yyyy")} + {formatEventDate(startD)} {event.showWithoutTime ? ( {t("events.all_day")} @@ -767,16 +776,16 @@ export function EventModal({ return (
-
-

- {isEdit ? t("events.edit") : t("events.create")} -

- -
+
+

+ {isEdit ? t("events.edit") : t("events.create")} +

+ +
-
+
@@ -986,69 +995,69 @@ export function EventModal({
)}
-
+
-
-
- {isEdit && onDelete && ( - showDeleteConfirm ? ( -
-
- - {t("form.delete_confirm")} - - {hasParticipants && ( -

- {t("participants.cancel_notification")} -

- )} -
- - +
+
+ {isEdit && onDelete && ( + showDeleteConfirm ? ( +
+
+ + {t("form.delete_confirm")} + + {hasParticipants && ( +

+ {t("participants.cancel_notification")} +

+ )}
- ) : ( - ) - )} - {isEdit && onDuplicate && !showDeleteConfirm && ( + +
+ ) : ( - )} -
- -
- - -
+ )}
+ +
+ + +
+
); } diff --git a/locales/en/common.json b/locales/en/common.json index a884fe2e..d1dc60eb 100644 --- a/locales/en/common.json +++ b/locales/en/common.json @@ -2272,6 +2272,20 @@ "sat": "Sat", "sun": "Sun" }, + "months": { + "jan": "Jan", + "feb": "Feb", + "mar": "Mar", + "apr": "Apr", + "may": "May", + "jun": "Jun", + "jul": "Jul", + "aug": "Aug", + "sep": "Sep", + "oct": "Oct", + "nov": "Nov", + "dec": "Dez" + }, "notifications": { "event_created": "Event created", "event_updated": "Event updated", @@ -2749,4 +2763,4 @@ "unified_mailbox": { "search_unavailable": "Search is not available in the unified view" } -} +} \ No newline at end of file diff --git a/locales/fr/common.json b/locales/fr/common.json index b37618cd..289aed51 100644 --- a/locales/fr/common.json +++ b/locales/fr/common.json @@ -2261,6 +2261,20 @@ "sat": "Sam", "sun": "Dim" }, + "months": { + "jan": "Jan", + "feb": "Fév", + "mar": "Mar", + "apr": "Avr", + "may": "Mai", + "jun": "Juin", + "jul": "Juil", + "aug": "Aoû", + "sep": "Sep", + "oct": "Oct", + "nov": "Nov", + "dec": "Déc" + }, "notifications": { "event_created": "Événement créé", "event_updated": "Événement mis à jour", @@ -2738,4 +2752,4 @@ "custom": "Personnalisé" } } -} +} \ No newline at end of file diff --git a/locales/pt/common.json b/locales/pt/common.json index 8ee68311..e75aae52 100644 --- a/locales/pt/common.json +++ b/locales/pt/common.json @@ -2261,6 +2261,20 @@ "sat": "Sáb", "sun": "Dom" }, + "months": { + "jan": "Jan", + "feb": "Fev", + "mar": "Mar", + "apr": "Abr", + "may": "Mai", + "jun": "Jun", + "jul": "Jul", + "aug": "Ago", + "sep": "Set", + "oct": "Out", + "nov": "Nov", + "dec": "Dez" + }, "notifications": { "event_created": "Evento criado", "event_updated": "Evento atualizado",