From 8dd51011df7b8dc44673c61ee67ebdbc7690b6a4 Mon Sep 17 00:00:00 2001 From: grunfink Date: Mon, 2 Feb 2026 18:10:01 +0100 Subject: Use the translated month names in date labels. --- html.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'html.c') diff --git a/html.c b/html.c index 7b93e49..8634d4b 100644 --- a/html.c +++ b/html.c @@ -225,7 +225,20 @@ xs_str *html_date_label(snac *user, const char *date) return xs_str_utctime(t, "%Y-%m-%d %H:%M"); } - return xs_str_utctime(t, "%b%d %H:%M"); + xs_str *date = xs_str_utctime(t, "%b%d %H:%M"); + + struct tm tm; + localtime_r(&t, &tm); + + if (tm.tm_mon >= 0 && tm.tm_mon <= 11) { + /* copy the 3letter translated month name */ + const char *m = L(months[tm.tm_mon]); + + if (xs_is_string(m) && strlen(m) >= 3) + memcpy(date, m, 3); + } + + return date; } return xs_crop_i(xs_dup(date), 0, 10); -- cgit v1.2.3