[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
glibc locale inconsistencies (was: [util-linux] cal doesn't honor first_
From: |
Martin Norbäck |
Subject: |
glibc locale inconsistencies (was: [util-linux] cal doesn't honor first_weekday value from locale) |
Date: |
22 Nov 2001 17:18:44 +0100 |
tor 2001-11-22 klockan 15.35 skrev address@hidden:
> > It is you who is referring to glibc, not me. I am referring to locale
>
> The POSIX definition of locale does not have the concept of
> "first weekday". It is a GNU extension only present in glibc.
I've been doing some more research on the subject.
There is no standard defining first_weekday, however there is a working
document named ISO/IEC JTC1/SC22/WG20 N553 which describes ISO/IEC FCD
14652 (supposedly to become standard ISO/IEC 14652). The document I've
found is from 1997-12-22, and I don't know it's current status.
glibc uses some of the fields from this document, however, it has
divided the "week" field into "week-ndays", "week-1stday", and
"week-1stweek".
With this definition, it seems that first_weekday=1 actually means the
first day, as defined by the "week" (or "week-1stday") keyword.
So, assuming that the glibc fields have the meaning of this document,
then there are some locales which are in error (in glibc 2.2.4). For
instance the de_DE locale has the following values:
day="Sonntag;Montag;Dienstag;Mittwoch;Donnerstag;Freitag;Samstag"
week-ndays=7
week-1stday=19971201
week-1stweek=4
first_weekday=1
Which would mean that 1997-12-01 is actually a "Sonntag", but it is a
Monday.
The C/POSIX locale has the following values:
day="Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday"
week-ndays=7
week-1stday=19971130
week-1stweek=4
first_weekday=7
which would mean that the first week day to display is Saturday.
sv_SE has the following values:
sv_SE
day="söndag;måndag;tisdag;onsdag;torsdag;fredag;lördag"
week-ndays=7
week-1stday=19971130
week-1stweek=0
first_weekday=1
but should really have:
day="måndag;tisdag;onsdag;torsdag;fredag;lördag;söndag"
week-ndays=7
week-1stday=19971201 [a Monday]
week-1stweek=4 [Thursday]
first_weekday=1 [Monday]
since Sweden uses ISO 8601.
The full text of this document can be found at:
http://anubis.dkuug.dk/jtc1/sc22/wg20/docs/14652fcd.doc
or
http://anubis.dkuug.dk/jtc1/sc22/wg20/docs/14652fcd.txt
and looking in
http://anubis.dkuug.dk/jtc1/sc22/wg20/docs/
you can find other documents, note for instance
http://anubis.dkuug.dk/jtc1/sc22/wg20/docs/n608.txt
which seems to be a ballot concerning this document.
Following is a small section:
4.6 LC_TIME
The following keywords shall be defined:
[...]
day Define the full weekday names for calendar systems
with weeks of constant length, to be referenced by
the %a field descriptor. The length of the week and
a gregorian date for the first weekday is defined
by the "week" keyword. The operand shall consist of
semicolon-separated strings. The first string shall
be the full name of the day corresponding to the
first day of the week (default Sunday), the second
the full name of the day corresponding to the
second day of the week (default Monday), and so on.
week Shall be used to define the number of days in a
week, which is the first weekday - the first
weekday has the value 1, and which week is to be
considered the first in a year. The first operand
is an integer specifying the number of days in the
week, The second operand is an integer specifying
the gregorian date in the format YYYYMMDD with a
leading <hyphen-minus> if before Christ. The third
operand is an integer specifying the weekday number
to be contained in the first week of the year. If
the keyword is not specified the values are taken
as 7, 19971130 (a Sunday), and 7 (Saturday),
respectively. ISO 8601 conforming applications
should use the values 7, 19971201 (a Monday), and 4
(Thursday), respectively.
first_weekday Shall be used to define the first day to be
displayed, for example in a calendar display
utility. The operand is an integer specifying
the day number (1 = first) according to the
information specified with the "day" keyword.
The keyword may be omitted, and then the value 1
is taken, corresponding to Sunday for a week
beginning Sunday, or to Monday for a week
beginning Monday.
first_workday Shall be used to define the first workday as an
integer according to the day numbering specified
with the "week" keyword.
I'll see if I can find more information about the glibc interpretation
of these fields. It would be a good thing if it was the same as in this
proposed standard.
Regards,
Martin
--
[ http://www.dtek.chalmers.se/~d95mback/ ] [ PGP: 0x453504F1 ] [ UIN:
4439498 ]
Opinions expressed above are mine, and not those of my future
employees.
SIGBORE: Signature boring error, core dumped
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- glibc locale inconsistencies (was: [util-linux] cal doesn't honor first_weekday value from locale),
Martin Norbäck <=