From 534894c38db6d0f9f0fdf66b3918bac34740588f Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Mon, 25 May 2026 16:17:32 +0200 Subject: [PATCH] feat: locale-aware date format in email list with preset picker #331 --- components/settings/calendar-settings.tsx | 27 +------ components/settings/language-settings.tsx | 89 ++++++++++++++++++++++- lib/utils.ts | 88 +++++++++++++++++++--- locales/cs/common.json | 17 +++-- locales/da/common.json | 17 +++-- locales/de/common.json | 17 +++-- locales/en/common.json | 17 +++-- locales/es/common.json | 17 +++-- locales/fr/common.json | 17 +++-- locales/it/common.json | 17 +++-- locales/ja/common.json | 17 +++-- locales/ko/common.json | 17 +++-- locales/lv/common.json | 17 +++-- locales/nl/common.json | 17 +++-- locales/pl/common.json | 17 +++-- locales/pt/common.json | 17 +++-- locales/ru/common.json | 17 +++-- locales/tr/common.json | 17 +++-- locales/uk/common.json | 17 +++-- locales/zh/common.json | 17 +++-- stores/settings-store.ts | 12 ++- 21 files changed, 342 insertions(+), 163 deletions(-) diff --git a/components/settings/calendar-settings.tsx b/components/settings/calendar-settings.tsx index b8e655f8..4154f17b 100644 --- a/components/settings/calendar-settings.tsx +++ b/components/settings/calendar-settings.tsx @@ -4,17 +4,14 @@ import { useTranslations } from 'next-intl'; import { useCalendarStore, CalendarViewMode } from '@/stores/calendar-store'; import { useSettingsStore } from '@/stores/settings-store'; import { usePolicyStore } from '@/stores/policy-store'; -import { SettingsSection, SettingItem, Select, RadioGroup, ToggleSwitch } from './settings-section'; +import { SettingsSection, SettingItem, Select, ToggleSwitch } from './settings-section'; export function CalendarSettings() { const t = useTranslations('calendar.settings'); const tViews = useTranslations('calendar.views'); - const tDays = useTranslations('calendar.days'); const { viewMode, setViewMode } = useCalendarStore(); const { - timeFormat, - firstDayOfWeek, showTimeInMonthView, showWeekNumbers, enableCalendarTasks, @@ -40,28 +37,6 @@ export function CalendarSettings() { /> - - updateSetting('dateFormat', value as DateFormat)} + options={[ + { value: 'smart', label: t('date_format.smart') }, + { value: 'relative', label: t('date_format.relative') }, + { value: 'full', label: t('date_format.full') }, + ]} + /> +
+
+ {t('date_format.preview_today')} + {preview.today} +
+
+ {t('date_format.preview_this_week')} + {preview.thisWeek} +
+
+ {t('date_format.preview_older')} + {preview.older} +
+
+ +
+ + + updateSetting('timeFormat', value as TimeFormat)} + options={[ + { value: '12h', label: t('time_format.12h') }, + { value: '24h', label: t('time_format.24h') }, + ]} + /> + + + +