Bug 80212 - Swedish (sv) locale info has wrong first_weekday and first_workday
Swedish (sv) locale info has wrong first_weekday and first_workday
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2002-12-22 06:28 EST by Christian Rose
Modified: 2007-04-18 12:49 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-04-22 13:01:03 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Christian Rose 2002-12-22 06:28:23 EST
This is a split-up of bug 56657.

With glibc-2.2.93-5 as shipped with Red Hat Linux 8.0, and using the sv_SE
locale, one gets this:

$ locale first_weekday
$ locale first_workday

This is clearly wrong, as Monday and not Sunday is used as the first day of week
in Sweden (please see
http://www.se.gnome.org/sv/lokal/datum_och_tid/index.en.html for details).
Hence, these values in glibc for the sv_SE locale should get corrected, and use
Monday as first_weekday and first_workday.
Comment 2 Christian Rose 2002-12-22 06:58:47 EST
In http://www.dkuug.dk/JTC1/SC22/WG20/docs/n972-14652ft.pdf, the following is

Is used to define the number of days in a week, and which weekday 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, and it specifies a day that is a first weekday (all
other first weekdays may then be calculated by adding or subtracting a whole
multiplum of the number of days in the week as specified with the first
operand). The third operand is an integer specifying the weekday number to be
contained in the first week of the year. The third operand may also be
understood as the number of days required in a week for it to be considered 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. This keyword is optional.

Since Sweden uses ISO8601, the value of "week" should probably also be changed
according to the last part of the above.
Comment 3 Daniel Resare 2002-12-22 10:13:40 EST
From the specifiation cited above (ISO/IEC 14652:2002(E)) it is obvious that the
value of 'week' is the one that should be changed (at least for swedish) and not
'first_weekday'/'first_workday'. (IMHO the standard is just silly).

The correct algorithm for determining what day to display first in a weekview
goes something like this:

1) Find out what weekday is associated with the date appearing in the second
field of 'week'. This involves doing some kind of lookup of an arbitrary date.

2) move forward in the list of weekdays the amount indicated by 'first_weekday' - 1

Since first_weekday defaults to 1 (which is the value to use for cases I can
think of) the correct value to change is the value of "week".

However, I have yet to find information about how all this information is
exposed to userspace (outside of libc). Does anyone have pointers?
Comment 4 Ulrich Drepper 2003-04-22 03:52:29 EDT
With RHL9 I get

$ LC_ALL=sv_SE locale first_weekday
$ LC_ALL=sv_SE locale first_workday

I assume I can close the bug now, right?
Comment 5 Christian Rose 2003-04-22 11:09:51 EDT
Yes. Confirmed. Thanks.
Comment 6 Martin Norback 2003-04-22 11:47:43 EDT
Just an interesting observation about the values of those LC_TIME fields:

week-1stday is 19971130 (a Sunday) except for de_DE and en_US where it is
19971201 (a Monday)
week-1stweek is 0 except for de_DE and en_US where it is 4
first_weekday/first_workday is 1 except for sv_SE and bg_BG where it is 2 and
fa_IR where it is 7

It seems de_DE and en_US roughly tries to implement ISO/IEC TR 14652
(http://anubis.dkuug.dk/jtc1/sc22/wg20/docs/n972-14652ft.pdf), but that document
also specifies that the first day of the "day" field should be dictated by the
week field (which maps to week-1stday in glibc naming).

I can only concluded that this is a mess, and that it will be long before the
locale field values can be trusted, see also bug 56657 and bug 56513.

The technical report marks LC_TIME as "controversial". Agreed :)
Comment 7 Christian Rose 2003-04-22 12:17:58 EDT
Martin, was your comment supposed to go into bug 56657 instead?
Comment 8 Ulrich Drepper 2003-04-22 13:01:03 EDT
Fixed in current release.

Note You need to log in before you can comment on or make changes to this bug.