Paul Eggert wrote:
> Ondřej Vašík <> writes:
>> as reported in by
>> Daniel Qarras, ls -l shows iso long format for en_* locales.
> I just now read that Bugzilla report, and the diagnosis and the
> patch do not seem correct.  The diagnosis says:
>> In ls.c (case locale_time_style)  is dcgettext (NULL, long_time_format[i],
>> LC_TIME); ... that translates the string, but the translation is THE SAME as
>> the default - as the format is the same for en_* locales.
> But that is not what the ls.c source code does.  The code does this:
>                     char const *locale_format =
>                       dcgettext (NULL, long_time_format[i], LC_TIME);
>                     if (locale_format == long_time_format[i])
>                       goto case_long_iso_time_style;
> The "==" test returns true when dcgettext returns the msgid (its 2nd
> argument) because it finds no translation.

Right. We don't have any translations for "en".

I noticed this previously and assumed it was on purpose.
I.E. we can override the default time style by
providing an en "translation" for the time formats.

Note one can't use LC_TIME=C to set the format,
as that will also cause nl_langinfo to lookup the abbreviated
months in that locale. I.E. the following would show
english abbreviations: LC_TIME=C LANG=fr_FR.utf8 ls -l

What I do is to set TIME_STYLE as follows:

# traditional unix time format with abbreviated month translated from locale
export TIME_STYLE='+%b %e  %Y
%b %e %H:%M'


Reply via email to