Re: [patch] locale-aware date format for ftp and file

Kalle Olavi Niemitalo <[email protected]>
Newsgroups gmane.comp.web.links
Message-ID <[email protected]>
Jakub Bogusz <[email protected]> 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");
>  		else
> -			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.

_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev
signature.asc (application/pgp-signature, 188 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHfB2CHm9IGt60eMgRApEdAKCGcrWleqMExPdFzC65eE7b8yDb8wCgro+A
F1j4FUPxXQvMyhx04kaDdXw=
=nXud
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.