This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC][PATCH] Multiple locales: Use the correct date and time formats (bug 10496, 23724).


4.11.2018 04:07 TAMUKI Shoichi <tamuki@linet.gr.jp> wrote:
> [...]
> Although I am no expert in sq_AL locale,

Sure, neither am I.  That's why I'm trying to approach the actual native
speakers (off-list).

> if d_t_fmt which is fixed
> width suddenly becomes variable width, I just thought that there might
> be people in trouble.

I'm trying to understand the use case where people might be in trouble
if the date width varies.  It it maybe that someone may be trying to extract
pieces of the date (e.g., the current month or the current week day) from
the
output of date finding a substring at specified constant index?  If yes then
there are more reasons why this may not work, especially in non-English
locales,
and better ways to achieve the correct results.

> I have roughly checked in the current locale data to see which locale
> uses a variable width at d_t_fmt.  The result is:
> 
> ca_ES:	"%A, %-d %B de %Y, %T %Z"
> cs_CZ:	"%a<U00A0>%-d.<U00A0>%B<U00A0>%Y,<U00A0>%H:%M:%S<U00A0>%Z"
> hu_HU:	"%Y. %b. %-e., %A, %H:%M:%S %Z"
> it_CH:	"%a %-d %b %Y, %T"
> it_IT:	"%a %-d %b %Y, %T"
> nr_ZA:	"%a %-e %b %Y %T %Z"
> pl_PL:	"%a, %-d %b %Y, %T"
> ss_ZA:	"%a %-e %b %Y %T %Z"
> st_ZA:	"%a %-e %b %Y %T %Z"
> szl_PL:	"%a, %-d %b %Y, %T"
> tn_ZA:	"%a %-e %b %Y %T %Z"
> ts_ZA:	"%a %-e %b %Y %T %Z"
> xh_ZA:	"%a %-e %b %Y %T %Z"

Thank you for this survey!  Yes, this is an evidence that variable width
date formats may be acceptable.

> > > [...]
> > > >  %
> > > >  % Appropriate date representation
> > > > -d_fmt       "%Y-%b-%d"
> > > > +d_fmt       "%-d.%-m.%y"
> > > 
> > > Likewise, how about using "%_d.%_m.%y" instead.
> > 
> > No, additional space before a month number looks definitely bad.
> > We use dots or other punctuation characters and zero padding to avoid
> > spaces in a string which normally should have no spaces.
> 
> For example, "LANG=C date" shows a space as padding to keep it a
> constant width.

This is a different case.  When you execute "date" with no arguments
it uses the date format which consists of numbers and words: day number,
abbreviated month name, abbreviated weekday name, etc.  It is correct
to separate them with spaces, and not so bad to add more spaces, when
needed.  In my case I was referring to a string which consists exclusively
of digits and punctuation characters (like 5.11.2018 or 11/5/18) which
should not contain spaces.  That's why zero-padding exists.  (e.g.,
05.11.18 or 11/05/18). " 5.11.2018" may not be so bad but "11/ 5/18"
is rather weird.

> Anyway, if people involved in that locale are not particularly
> troubled, I think that there is no problem without padding.

Yes, thank you for helping me formulate my question more precisely
and more clearly for native speaker.  I will ask them if they expect
the formatted dates to have a constant width and if making the width
variable will cause a trouble for them.

Regards,

Rafal


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]