Bug 80212 - Swedish (sv) locale info has wrong first_weekday and first_workday
Summary: Swedish (sv) locale info has wrong first_weekday and first_workday
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc
Version: 8.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL: http://www.se.gnome.org/sv/lokal/datu...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-12-22 11:28 UTC by Christian Rose
Modified: 2016-11-24 15:19 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-04-22 17:01:03 UTC
Embargoed:


Attachments (Terms of Use)

Description Christian Rose 2002-12-22 11:28:23 UTC
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
1
$ locale first_workday
1

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 11:58:47 UTC
In http://www.dkuug.dk/JTC1/SC22/WG20/docs/n972-14652ft.pdf, the following is
mentioned:


week
----
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 15:13:40 UTC
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 07:52:29 UTC
With RHL9 I get

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


I assume I can close the bug now, right?

Comment 5 Christian Rose 2003-04-22 15:09:51 UTC
Yes. Confirmed. Thanks.

Comment 6 Martin Norback 2003-04-22 15:47:43 UTC
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 16:17:58 UTC
Martin, was your comment supposed to go into bug 56657 instead?

Comment 8 Ulrich Drepper 2003-04-22 17:01:03 UTC
Fixed in current release.


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