From 01675c627059e0cca491e7e0d8bf8aced13dc322 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Wed, 3 Nov 2021 10:47:39 +0100 Subject: [PATCH] [date] elinks-date-format.patch from PLD --- po/pl.po | 12 ++++++++++++ src/protocol/ftp/ftp.c | 10 ++++------ src/util/file.h | 7 ++++--- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/po/pl.po b/po/pl.po index bc1d6e44..ed907c31 100644 --- a/po/pl.po +++ b/po/pl.po @@ -7413,6 +7413,18 @@ msgstr "~Pełny ekran" msgid "~BeOS terminal" msgstr "Terminal ~BeOS" +#: src/protocol/ftp/ftp.c:1160 src/util/file.c:464 +msgid "%b %e %Y" +msgstr "%e.%m.%Y " + +#: src/protocol/ftp/ftp.c:1162 src/util/file.c:466 +msgid "%b %e %H:%M" +msgstr "%e.%m %H:%M" + +#: src/protocol/ftp/ftp.c:1165 src/protocol/ftp/ftp.c:1172 src/util/file.c:473 +msgid " " +msgstr " " + #. name: #: src/protocol/auth/auth.c:332 msgid "Authentication" diff --git a/src/protocol/ftp/ftp.c b/src/protocol/ftp/ftp.c index 5182a491..c036298a 100644 --- a/src/protocol/ftp/ftp.c +++ b/src/protocol/ftp/ftp.c @@ -1237,7 +1237,7 @@ display_dir_entry(struct cache_entry *cached, off_t *pos, int *tries, /* LC_TIME=fi_FI.UTF_8 can generate "elo___ 31 23:59" * where each _ denotes U+00A0 encoded as 0xC2 0xA0, * thus needing a 19-byte buffer. */ - char date[80]; + char date[MAX_STR_LEN]; int wr; if (ftp_info->local_time_zone) @@ -1247,16 +1247,16 @@ display_dir_entry(struct cache_entry *cached, off_t *pos, int *tries, if (current_time > when + 6L * 30L * 24L * 60L * 60L || current_time < when - 60L * 60L) - fmt = "%b %e %Y"; + fmt = gettext("%b %e %Y"); else - fmt = "%b %e %H:%M"; + fmt = gettext("%b %e %H:%M"); wr = strftime(date, sizeof(date), fmt, when_tm); add_cp_html_to_string(&string, format->libc_codepage, date, wr); } else #endif - add_to_string(&string, " "); + add_to_string(&string, gettext(" ")); /* TODO: Above, the number of spaces might not match the width * of the string generated by strftime. It depends on the * locale. So if ELinks knows the timestamps of some FTP @@ -1270,8 +1270,6 @@ display_dir_entry(struct cache_entry *cached, off_t *pos, int *tries, * Any solution chosen here should also be applied to the * file: protocol handler. */ - add_char_to_string(&string, ' '); - if (ftp_info->type == FTP_FILE_DIRECTORY && format->colorize_dir) { add_to_string(&string, "dircolor); diff --git a/src/util/file.h b/src/util/file.h index 0f20bf3c..906ee700 100644 --- a/src/util/file.h +++ b/src/util/file.h @@ -4,6 +4,7 @@ #include #include +#include "intl/libintl.h" #include "util/conv.h" #include "util/string.h" @@ -252,16 +253,16 @@ stat_date(struct string *string, struct stat *stp) if (current_time > when + 6L * 30L * 24L * 60L * 60L || current_time < when - 60L * 60L) - fmt = "%b %e %Y"; + fmt = gettext("%b %e %Y"); else - fmt = "%b %e %H:%M"; + fmt = gettext("%b %e %H:%M"); add_date_to_string(string, fmt, &when); add_char_to_string(string, ' '); return; } #endif - add_to_string(string, " "); + add_to_string(string, gettext(" ")); } #ifdef __cplusplus