From 1af705f3fdd4f2b0c8fde9d42589c0ae09960edf Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Wed, 5 Aug 2026 20:02:34 -0400 Subject: [PATCH] Localize calendar date pickers to the active UI locale (#234) * Localize calendar date pickers to the active UI locale. Pass the Inertia locale into Reka calendars, translate a11y labels, and use dayjs LL/LLL for DatePicker display text. Co-authored-by: Cursor * Localize remaining dayjs date displays across the UI. Route list/calendar/preview timestamps through localized LL/LLL helpers so formats follow the active UI locale instead of English or Portuguese-locked patterns. Co-authored-by: Cursor * Use scheduled-or-now timestamps in platform previews. Drive preview labels from the post schedule when set, localize Discord without dayjs calendar(), and expose a single formatPreviewPostedAt helper. Co-authored-by: Cursor * Fix preview schedule wiring and Discord/Facebook timestamp labels. Restore hasPickedTime from any saved scheduled_at, keep time on non-today Discord labels, and use a localized just-now fallback for unschedled Facebook previews. Co-authored-by: Cursor * Fix API key expiry day shift and tighten calendar range titles. Format date-only expiry in UTC calendar days, and use compact dayjs titles for calendar day/week headers. Co-authored-by: Cursor * Replace frontend date source greps with Inertia API key assertions. Drop the Vue/TS file scanner and assert expiry calendar days through ApiKeyController props instead. Co-authored-by: Cursor * Localize calendar week titles with day-first dayjs formats. Avoid English month-day order in week headers and chart axis labels so locales like pt-BR keep natural day-first dates. Co-authored-by: Cursor * Split preview timestamp formatting into named platform helpers. Replace the style-switch formatPreviewPostedAt with clear per-platform helpers so call sites read as formatDiscordPreview / formatXPreview / etc. Co-authored-by: Cursor --------- Co-authored-by: Cursor --- lang/ar/common.php | 3 + lang/de/common.php | 3 + lang/el/common.php | 3 + lang/en/common.php | 3 + lang/es/common.php | 3 + lang/fr/common.php | 3 + lang/it/common.php | 3 + lang/ja/common.php | 3 + lang/ko/common.php | 3 + lang/nl/common.php | 3 + lang/pl/common.php | 3 + lang/pt-BR/common.php | 3 + lang/ru/common.php | 3 + lang/tr/common.php | 3 + lang/uk/common.php | 3 + lang/zh/common.php | 3 + resources/js/components/DatePicker.vue | 22 +++- .../automations/AutomationRunsChart.vue | 10 +- .../js/components/posts/PickTimePopover.vue | 11 +- .../components/posts/editor/CommentsTab.vue | 2 +- .../posts/editor/PostEditorTabs.vue | 2 + .../js/components/posts/editor/PreviewTab.vue | 2 + .../posts/previews/BlueskyPreview.vue | 8 +- .../posts/previews/DiscordPreview.vue | 8 +- .../posts/previews/FacebookPreview.vue | 9 +- .../posts/previews/MastodonPreview.vue | 10 +- .../posts/previews/PlatformPreview.vue | 3 + .../js/components/posts/previews/XPreview.vue | 5 +- .../ui/date-range-picker/DateRangePicker.vue | 10 +- resources/js/composables/useCalendarLocale.ts | 15 +++ resources/js/date.ts | 122 +++++++++++++++++- resources/js/pages/automations/Index.vue | 4 +- resources/js/pages/labels/Index.vue | 4 +- resources/js/pages/posts/Calendar.vue | 24 ++-- resources/js/pages/posts/Edit.vue | 6 +- resources/js/pages/posts/Index.vue | 8 +- resources/js/pages/posts/Show.vue | 6 +- .../js/pages/settings/workspace/ApiKeys.vue | 2 +- resources/js/pages/signatures/Index.vue | 4 +- tests/Feature/ApiKeyControllerTest.php | 28 +++- 40 files changed, 312 insertions(+), 61 deletions(-) create mode 100644 resources/js/composables/useCalendarLocale.ts diff --git a/lang/ar/common.php b/lang/ar/common.php index e99f2356..51f6e74d 100644 --- a/lang/ar/common.php +++ b/lang/ar/common.php @@ -35,7 +35,10 @@ 'empty' => 'لم يتم العثور على منطقة زمنية', ], + 'just_now' => 'الآن', + 'date_picker' => [ + 'label' => 'منتقي التاريخ', 'select' => 'اختر التاريخ', ], diff --git a/lang/de/common.php b/lang/de/common.php index 4e6d4b99..0d0db425 100644 --- a/lang/de/common.php +++ b/lang/de/common.php @@ -35,7 +35,10 @@ 'empty' => 'Keine Zeitzone gefunden', ], + 'just_now' => 'Gerade eben', + 'date_picker' => [ + 'label' => 'Datumsauswahl', 'select' => 'Datum auswählen', ], diff --git a/lang/el/common.php b/lang/el/common.php index c18cb1a1..4155a6ad 100644 --- a/lang/el/common.php +++ b/lang/el/common.php @@ -35,7 +35,10 @@ 'empty' => 'Δεν βρέθηκε ζώνη ώρας', ], + 'just_now' => 'Μόλις τώρα', + 'date_picker' => [ + 'label' => 'Επιλογή ημερομηνίας', 'select' => 'Επιλογή ημερομηνίας', ], diff --git a/lang/en/common.php b/lang/en/common.php index 6bda1664..cdb34a74 100644 --- a/lang/en/common.php +++ b/lang/en/common.php @@ -35,7 +35,10 @@ 'empty' => 'No timezone found', ], + 'just_now' => 'Just now', + 'date_picker' => [ + 'label' => 'Date picker', 'select' => 'Select date', ], diff --git a/lang/es/common.php b/lang/es/common.php index 2a532649..bbf28c6e 100644 --- a/lang/es/common.php +++ b/lang/es/common.php @@ -35,7 +35,10 @@ 'empty' => 'No se encontró zona horaria', ], + 'just_now' => 'Justo ahora', + 'date_picker' => [ + 'label' => 'Selector de fecha', 'select' => 'Seleccionar fecha', ], diff --git a/lang/fr/common.php b/lang/fr/common.php index 2531f3ea..f8d9c249 100644 --- a/lang/fr/common.php +++ b/lang/fr/common.php @@ -35,7 +35,10 @@ 'empty' => 'Aucun fuseau horaire trouvé', ], + 'just_now' => 'À l’instant', + 'date_picker' => [ + 'label' => 'Sélecteur de date', 'select' => 'Sélectionner une date', ], diff --git a/lang/it/common.php b/lang/it/common.php index 1d7cf87a..8f8d7503 100644 --- a/lang/it/common.php +++ b/lang/it/common.php @@ -35,7 +35,10 @@ 'empty' => 'Nessun fuso orario trovato', ], + 'just_now' => 'Proprio ora', + 'date_picker' => [ + 'label' => 'Selettore data', 'select' => 'Seleziona data', ], diff --git a/lang/ja/common.php b/lang/ja/common.php index 539f41fe..37140022 100644 --- a/lang/ja/common.php +++ b/lang/ja/common.php @@ -35,7 +35,10 @@ 'empty' => 'タイムゾーンが見つかりません', ], + 'just_now' => 'たった今', + 'date_picker' => [ + 'label' => '日付ピッカー', 'select' => '日付を選択', ], diff --git a/lang/ko/common.php b/lang/ko/common.php index ef309ea0..8d418371 100644 --- a/lang/ko/common.php +++ b/lang/ko/common.php @@ -35,7 +35,10 @@ 'empty' => '시간대를 찾을 수 없습니다', ], + 'just_now' => '방금', + 'date_picker' => [ + 'label' => '날짜 선택기', 'select' => '날짜 선택', ], diff --git a/lang/nl/common.php b/lang/nl/common.php index 6046682e..5dbc4b61 100644 --- a/lang/nl/common.php +++ b/lang/nl/common.php @@ -35,7 +35,10 @@ 'empty' => 'Geen tijdzone gevonden', ], + 'just_now' => 'Zojuist', + 'date_picker' => [ + 'label' => 'Datumperkiezer', 'select' => 'Datum selecteren', ], diff --git a/lang/pl/common.php b/lang/pl/common.php index d4b0e2db..7315d1c1 100644 --- a/lang/pl/common.php +++ b/lang/pl/common.php @@ -35,7 +35,10 @@ 'empty' => 'Nie znaleziono strefy czasowej', ], + 'just_now' => 'Właśnie teraz', + 'date_picker' => [ + 'label' => 'Wybór daty', 'select' => 'Wybierz datę', ], diff --git a/lang/pt-BR/common.php b/lang/pt-BR/common.php index 5c41d709..4af658d4 100644 --- a/lang/pt-BR/common.php +++ b/lang/pt-BR/common.php @@ -35,7 +35,10 @@ 'empty' => 'Fuso horário não encontrado', ], + 'just_now' => 'Agora mesmo', + 'date_picker' => [ + 'label' => 'Seletor de data', 'select' => 'Selecionar data', ], diff --git a/lang/ru/common.php b/lang/ru/common.php index aecc5a2c..7a58a033 100644 --- a/lang/ru/common.php +++ b/lang/ru/common.php @@ -35,7 +35,10 @@ 'empty' => 'Часовой пояс не найден', ], + 'just_now' => 'Только что', + 'date_picker' => [ + 'label' => 'Выбор даты', 'select' => 'Выберите дату', ], diff --git a/lang/tr/common.php b/lang/tr/common.php index f73011a5..615d5ba4 100644 --- a/lang/tr/common.php +++ b/lang/tr/common.php @@ -35,7 +35,10 @@ 'empty' => 'Saat dilimi bulunamadı', ], + 'just_now' => 'Az önce', + 'date_picker' => [ + 'label' => 'Tarih seçici', 'select' => 'Tarih seç', ], diff --git a/lang/uk/common.php b/lang/uk/common.php index 07dbb68b..6887d706 100644 --- a/lang/uk/common.php +++ b/lang/uk/common.php @@ -35,7 +35,10 @@ 'empty' => 'Часовий пояс не знайдено', ], + 'just_now' => 'Щойно', + 'date_picker' => [ + 'label' => 'Вибір дати', 'select' => 'Виберіть дату', ], diff --git a/lang/zh/common.php b/lang/zh/common.php index 1eeb850b..7f7ec022 100644 --- a/lang/zh/common.php +++ b/lang/zh/common.php @@ -35,7 +35,10 @@ 'empty' => '未找到时区', ], + 'just_now' => '刚刚', + 'date_picker' => [ + 'label' => '日期选择器', 'select' => '选择日期', ], diff --git a/resources/js/components/DatePicker.vue b/resources/js/components/DatePicker.vue index 83235ce7..374147f2 100644 --- a/resources/js/components/DatePicker.vue +++ b/resources/js/components/DatePicker.vue @@ -1,6 +1,7 @@ @@ -182,8 +186,14 @@ const displayText = computed(() => { - +
@@ -212,4 +222,4 @@ const displayText = computed(() => {
- \ No newline at end of file + diff --git a/resources/js/components/automations/AutomationRunsChart.vue b/resources/js/components/automations/AutomationRunsChart.vue index c1cf4daa..dd40d05a 100644 --- a/resources/js/components/automations/AutomationRunsChart.vue +++ b/resources/js/components/automations/AutomationRunsChart.vue @@ -1,9 +1,8 @@