[elinks-dev] [patch] locale-aware date format for ftp and file
Kalle Olavi Niemitalo
kon at iki.fi
Wed Jan 2 15:25:43 PST 2008
Jakub Bogusz <qboosh at pld-linux.org> writes:
> The attached patch allows to localize the date format used for ftp and
> file listings, like it's done in utilities like ls.
> Especially "%b %e %Y" format string used currently is specific to
> English and some other languages usually don't put the day of month
> between month and year - so I think the date format should be locale-aware.
This was last proposed on 2007-06-19, with subject "Date format
for directory listings".
> if (current_time > when + 6L * 30L * 24L * 60L * 60L
> || current_time < when - 60L * 60L)
> - fmt = "%b %e %Y";
> + fmt = gettext("%b %e %Y");
> - fmt = "%b %e %H:%M";
> + fmt = gettext("%b %e %H:%M");
These strings will be given to strftime, therefore you should
make sure that they are in the charset indicated by LC_TIME;
either by calling bind_textdomain_codeset and changing
current_charset accordingly, or by changing both LC_TIME and
LC_CTYPE with setlocale (which might fail if the system does not
support the locale, so seems a bad idea).
Then also, I think you should use dcgettext with LC_TIME instead
of plain gettext. This is because e.g. fi_FI has empty strings
for am_pm, and if the translation for the selected LC_MESSAGES
uses e.g. "%I:%M %p", the output will have 12-hour time without
any AM/PM indication, thus being ambiguous. So it will be better
to use LC_TIME for both the format string and the inserted
strings than mix LC_TIME with LC_MESSAGES. This way, the display
of times will depend solely on the ambient LC_TIME, and not on
the language the user selects within ELinks.
> - add_to_string(string, " ");
> + add_to_string(string, gettext(" "));
I think this should have a comment for translators.
Or, generate an HTML table instead and let the renderer align the columns.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 188 bytes
Desc: not available
More information about the elinks-dev