[HEADS UP] Changes in date formatting (strftime, nl_langinfo)

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

 



I'd like to notify you that today I've finished my works on date
formatting in glibc, that means upstream. These changes are already
arriving to Fedora Rawhide (they should be there tomorrow) and will
be part of Fedora 28. They will be included in glibc 2.27 (to be
released on February 1), or in pre-release upstream version
2.26.9000-1145 (in Fedora Rawhide: 2.26.9000-48).

What has been changed:

* strftime() family (including stftime_l(), wcstime(), wcstime_l(),
strptime() etc.): there are new format specifiers: %OB, %Ob, %Oh.
It has been specified that the currently existing format specifiers:
%B, %b, and %h generate the month names (%B--full month names, %b
and %h--abbreviated month names) in a grammatical form required when
the month is used as a part of a complete date (that means: together
with the day number) while the new format specifiers with %O (note:
this is O letter, the uppercase o, not the zero digit, 0) will generate
the month names in a grammatical form required when the month is named
by itself (without a day number, usually standalone). In most of the
languages there is no difference between those two forms. However,
there is a group of languages (about 20) where the correct form used in
the full date is a genitive case while standalone months must be
in a nominative case.

* strptime(): just accepts the new format specifiers: %OB, %Ob,
and %Oh; each of them recognizes any form of the month name.

* nl_langinfo() family (including nl_langinfo_l()): there are new
constants supported: ALTMON_1, ALTMON_2, … ALTMON_12, and also (kinda
undocumented): _NL_WALTMON_1, _NL_WALTMON_2, …, _NL_WALTMON_12;
_NL_ABALTMON_1, _NL_ABALTMON_2, …, _NL_ABALTMON_12; _NL_WABALTMON_1,
_NL_WABALTMON_2, …, _NL_WABALTMON_12. These new constants generate
the same month names as strftime() with %OB, %Ob, and %Oh format
specifiers (month names standalone, which means a nominative case
in some languages). The old constants MON_1, MON_2, …, MON_12,
ABMON_1, ABMON_2, …, ABMON_12 generate the same month names
as strftime() with %B, %b, and %h format specifiers--nothing new,
it has been the same since forever. But from now these constants
will generate the month names in a form used when the month name
is a part of a complete date. That means they are unsuitable to
generate the list of months standalone.

What needs to be changed:

* In Fedora: literally, nothing. The changes belong to upstreams
and I'm writing here in hope that some upstream developers are here
as well or you can forward the message to them. But of course
upstream software eventually lands in Fedora (as well as in other
distros). You may add "Requires: glibc >= 2.27" to the packages
which rely on this new feature, that means if their upstreams required
any changes in nl_langinfo() or strftime() calls.

* Translators: if you want this feature to be supported in your
language please notify me ASAP. There will be no change in the
languages for which the locale data in glibc are not changed.
So far only Polish language has been updated. Here is the list of
languages which probably need the update (the list may be incomplete):
Armenian, Asturian, Belarusian, Catalan, Croatian, Farsi, Greek,
Kashubian, Lithuanian, Ossetian, Russian, Scottish Gaelic,
Silesian, Sorbian (Upper and Lower), Ukrainian, Walloon.
These languages probably do not need the change but should put
their attention: Bosnian, Czech, Finnish, Serbian, Slovak.

* Applications using nl_langinfo() to display months: well, you
shouldn't use this function. This is a low-level function useful
to implement strftime(). But if you really want to you can but
you should stop using MON_* (and ABMON_*) and switch to ALTMON_*
(and _NL_ABALTMON_*) instead. You should detect whether it is
supported at compile time or at runtime. Well, it's tricky,
isn't it? Therefore it's better to use strftime().

* Applications using strftime() to format dates: if you display
a full date, including both the day number and the month name,
that is when the format specifier is "%d %b %Y" or "%B %e %Y"
or anything looking like that--no change is required. The only
case is when you display the month name standalone, whether it's
full ("%B") or abbreviated ("%b", "%h"), even when the year
number is included ("%B %Y"). This should be changed to "%OB"
and "%Ob".

* Other libraries than glibc which wrap or reimplement the same API
(like glib2 or gnulib): should enable this or apply the changes
to their implementation. By "enable" I mean "define the new
constants and do not raise an error when you see them or when
you see the %O[Bbh] format specifiers in strftime()".

* Other programming languages: the same as above, that means:
if your language just calls nl_langinfo() and strftime()
then make sure it calls it properly, defines the new constants
and does not raise errors, or if it implements the same feature
then the changes must be applied to your implementation.

* Testers: make sure the dates are displayed correctly, especially
in the calendars. You have to understand at least one of the
languages which I have mentioned above, though.

I guess this may lead to lots of questions and doubts. I have
answered many of them so far but I understand that my impact
is low so not many people heard the answers. Feel free to ask
here or better let's discuss this during DevConf.cz.

Regards,

Rafal


Links:

https://sourceware.org/bugzilla/show_bug.cgi?id=10871
http://austingroupbugs.net/view.php?id=258
https://sourceware.org/git/?p=glibc.git;a=blob;f=NEWS;hb=HEAD
https://rluzynski.fedorapeople.org/slides/2017-01-27-DevConf.cz/GenitiveMonths-updated.pdf
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux