bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH]: ls: do not show long iso time format for en_* locales


From: Pádraig Brady
Subject: Re: [PATCH]: ls: do not show long iso time format for en_* locales
Date: Sat, 26 Sep 2009 00:29:05 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20071008)

Paul Eggert wrote:
> Ondřej Vašík <address@hidden> writes:
> 
>> as reported in https://bugzilla.redhat.com/show_bug.cgi?id=525134 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'

cheers,
Pádraig.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]