Re: [util-linux] cal doesn't honor first_weekday value from locale

From: Christian Rose (
Date: 2001-11-23 14:18:14

On Thu, 22 Nov 2001 wrote:
>     I don't understand what you mean by that.
>     sv_SE does not distinguish country? Then what is SE?
> I mean that if you ask glibc what the first day of the week is,
> it never answers Sunday, independent of the locale.
> This means that asking glibc to find out whether it should be
> Sunday or Monday is meaningless, it is equivalent to always
> start at Monday.

Then the glibc locale data should get fixed for those locales where the
value is wrong. I have had no problems myself reporting things that were
wrong for the sv_SE locale, and the glibc people fixed it.

> So, people who advocate the glibc call should take the situation
> in the entire world into account, not just that in Sweden.

We do. But things should get fixed in glibc, and not by a bad hack in
util-linux that breaks the locales where the value is correct.

> Since the original cal program in Unix starts at Sunday, we may conclude
> that thirty years ago Sunday was what felt most natural to these
> authors. Don't know whether they would feel different today.

A lot of things Unix started in the US. Locales, or the need for locales,
were basically unknown, because noone assumed it would get used in any
significant scale anywhere else. Today we know that's no longer true, thus
reasoning that it should be the way it is because it always has been is
only foolish, because today is a totally different situation.

> You point out that some of these Swedish calendars were generated
> by American programs. Apparently the authors of these American programs
> felt that the week starts at Sunday.

I'm sure they do. Judging from my localization experience, most americans
agree on that Sunday is the day a week calendar should begin with. In
other words, totally the opposite from Sweden.

> [By the way, there are many more Swedish websites with a calendar
> starting with söndag. Avoiding those clearly produced by a standard
> foreign calendar generator program, let me mention a few more
> .]

A lot of these are similar, and I suspect they share the same backend
code, which most likely is not produced in Sweden (if it was, the author
never attended school).

> I do not want to make a special Swedish exception in the cal source.

You don't need to. Just make it fetch the value from the locale.

> Referring to glibc does not work. There is clearly a use for
> calendars starting the week on Sunday.

Yes, but the locales that you think are wrong should get fixed in glibc.
If you want Sunday first no matter what the locale says, nothing stops
you from adding an -s flag to cal, similar to the -m flag. But the default
with no flags should be using the value from the locale.

> Really, I cannot see any advantage in changing the default.

Because it is broken?

> These Swedes that cannot stand seeing a calendar start on Sunday
> may alias "cal" to "cal -m", or recompile cal with "#if 1" instead
> of "#if 0".

"These Swedes" that you speak of are almost the entire Swedish population.
Also, nothing indicates that there aren't other countries with a similar
problem. In fact, it is very likely, the only reason we don't know is
because we haven't investigated it. Thus, telling a lot of users
world-wide to alias their cal commandlines is hardly an option, especially
when we already have the locale system. No need to reinvent the wheel (or
hardwire it in this case).


Arkiv genererat av hypermail 2.1.1.