[Top][All Lists]

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

Re: Changes in nl_langinfo() and strftime() API in glibc

From: Rafal Luzynski
Subject: Re: Changes in nl_langinfo() and strftime() API in glibc
Date: Wed, 24 Jan 2018 11:20:48 +0100 (CET)

24.01.2018 10:51 Bruno Haible <address@hidden> wrote:
> Hi Rafal,
> > https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=2239076
> This documentation patch is too vague, IMO. It purports to document
> "Specify when to use %OB instead of %B." But as a programmer who is not
> aware of Polish and Greek grammar, it does not precisely answer the question:
> When should I use %OB, and when should I use %B, in strftime?

Since I am not a native English speaker I have ceased writing the
documentation to the native English speakers. As I am able to write
a documentation which is kinda correct, I am unable to write a better
documentation than those who did it. I think that this document is
a balance between being concise and being a book about Slavic or
Indo-European grammar which would be too long and too boring for
most of the programmers.

Short answer to all your questions: whatever date format you use
you should make it translatable, like:

    strftime (s, max, _("%A, %B %d, %y), ...

so you leave the correct format for the translators. This should
have been true since forever because the local date formats are not
limited to whether the date is full or the month is standalone but
also includes things like whether there are dots and/or commas,
date-month order, leading zeros or spaces, etc.

Indeed, as a programmer you are not obliged to know the native
languages. But it can be useful sometimes when you have to teach
the translators.

> I would look in time.texi; I find the answer too vague: "as part of a
> complete date".
> Is 24 January 2018 a complete date? I'd guess yes.


> Is 24 January a complete date? I'd guess no.

Incorrect. Explanation below.

> Is January 2018 a complete date? I'd guess no.


> Is January a complete date? I guess you meant no.


> Is that what you intended to mean?

So, indeed, you did not understand correctly and it's not
your fault but the fault of the documentation. But did not
the documentation mention that a full date is a date with
the day number included?

The issue is when the day number and the month name appear
together. Some languages require a genitive case here, like
it can also be said in English: "24th of January", meaning
"the 24th day of January". It's simliar in Spanish:
"24 de enero". But in English and Spanish this is easy:
just insert "of" and "de" everywhere and the problem is
fixed. It is more complex in Catalan: they also require
"de" but it is abbreviated to "d’" if a month name starts
with a vowel, like "abril": "24 d’abril" - this is already
too complex for glibc. That's even more complex in Slavic,
Baltic, Greek and few more languages which feature a heavy
declension: in Polish January is "styczeń" (standalone,
a nominative case) but when formatting a date it's obligatory
to say "24 stycznia" (a genitive case). A complete implementation
of this system would be larger than whole implementation of
strftime(), I suppose. :-)

So, when there is no day number (and nothing similar, like
"the second week of" or "the first Sunday of") the month
name counts as standalone, a nominative case. Also when the
year number is included this still counts as standalone
because we are still talking about a month, not a day of
a month (or another part of a month).

Sorry if this message is so long. As you can see, it is too
long to put it into the documentation. I think I should write
a blog article about it.



reply via email to

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