summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorGravatar grunfink2026-02-02 18:10:01 +0100
committerGravatar grunfink2026-02-02 18:10:01 +0100
commit8dd51011df7b8dc44673c61ee67ebdbc7690b6a4 (patch)
treeb246c1dd6d263b4bab54c537dcb78a359eb5e5b2 /html.c
parentAdded translatable month names. (diff)
downloadsnac2-8dd51011df7b8dc44673c61ee67ebdbc7690b6a4.tar.gz
snac2-8dd51011df7b8dc44673c61ee67ebdbc7690b6a4.tar.xz
snac2-8dd51011df7b8dc44673c61ee67ebdbc7690b6a4.zip
Use the translated month names in date labels.
Diffstat (limited to 'html.c')
-rw-r--r--html.c15
1 files changed, 14 insertions, 1 deletions
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)
225 return xs_str_utctime(t, "%Y-%m-%d %H:%M"); 225 return xs_str_utctime(t, "%Y-%m-%d %H:%M");
226 } 226 }
227 227
228 return xs_str_utctime(t, "%b%d %H:%M"); 228 xs_str *date = xs_str_utctime(t, "%b%d %H:%M");
229
230 struct tm tm;
231 localtime_r(&t, &tm);
232
233 if (tm.tm_mon >= 0 && tm.tm_mon <= 11) {
234 /* copy the 3letter translated month name */
235 const char *m = L(months[tm.tm_mon]);
236
237 if (xs_is_string(m) && strlen(m) >= 3)
238 memcpy(date, m, 3);
239 }
240
241 return date;
229 } 242 }
230 243
231 return xs_crop_i(xs_dup(date), 0, 10); 244 return xs_crop_i(xs_dup(date), 0, 10);