After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 747346 - calendar applet should respect locales' "first weekday" value
calendar applet should respect locales' "first weekday" value
Status: RESOLVED NOTGNOME
Product: gnome-shell
Classification: Core
Component: calendar
3.16.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2015-04-04 19:38 UTC by Andrei Dziahel
Modified: 2015-04-24 09:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
calendar widget not respecting first week day (295.98 KB, image/png)
2015-04-04 20:47 UTC, Andrei Dziahel
Details
Test program (1.25 KB, text/plain)
2015-04-05 20:22 UTC, Florian Müllner
Details

Description Andrei Dziahel 2015-04-04 19:38:00 UTC
Reproducing:

1. Go "Region & Language"
2. Under "formats" choose a locale where first day of week is not Sunday (e.g. Belarusian in my case, see full list on https://en.wikipedia.org/wiki/Names_of_the_days_of_the_week#Days_numbered_from_Monday )
3. Restart user session as suggested
4. Click current date indicator on top bar
5. Check calendar view in there

Expected: weeks begin with Monday (in case of Belarusian/Russian/Bulgarian/etc)

Instead: weeks begin with Sunday
Comment 1 Florian Müllner 2015-04-04 20:13:20 UTC
The week start is picked up from the locale, see https://git.gnome.org/browse/gnome-shell/tree/src/shell-util.c#n168.
Comment 2 Andrei Dziahel 2015-04-04 20:47:52 UTC
Created attachment 300958 [details]
calendar widget not respecting first week day
Comment 3 Florian Müllner 2015-04-04 21:20:54 UTC
It would be interesting to know which code path you are using (nl_langinfo() or the gtk+ fallback). The latter uses LC_MESSAGES rather than LC_TIME (which is disputable, but consistent with GTK+ itself), the former should use LC_TIME.

So does it work if you change LC_MESSAGES? If yes, are you using a libc other than glibc?
Comment 4 Andrei Dziahel 2015-04-04 22:18:01 UTC
I'm not sure what path does it use exactly, but Shell.util_get_week_start() ran in LG evaluator returns 0.

The gnome shell build log at https://build.opensuse.org/build/GNOME:Factory/openSUSE_Factory/x86_64/gnome-shell/_log says 

> [  175s] checking for _NL_TIME_FIRST_WEEKDAY... yes

so I guess it's nl_langinfo() path after all
Comment 5 Andrei Dziahel 2015-04-04 22:47:24 UTC
so, following example 

#include <langinfo.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>

int
main(int argc, char *argv[])
{
 printf("%i\n", nl_langinfo(_NL_TIME_FIRST_WEEKDAY)[0]);
 unsigned int li = nl_langinfo(_NL_TIME_WEEK_1STDAY);
 printf("%i\n", li);
 exit(EXIT_SUCCESS);
}

ran on my box prints 

> 1
> 19971130

which leads us to https://git.gnome.org/browse/gnome-shell/tree/src/shell-util.c#n186 resulting 

> week_start = (week_1stday + first_weekday - 1) % 7

be (0 + 1 - 1) % 7 = 0, which is Sunday.
Comment 6 Florian Müllner 2015-04-05 16:25:10 UTC
(In reply to Andrei Dziahel from comment #5)
> so, following example 
> 
> [...]
> 
> ran on my box prints 
> 
> > 1
> > 19971130

So according to that, the week starts on the first day of a Sunday-based week system - which is Sunday.

FWIW, I get the same result when running a similar test program with LC_TIME=be_BY.utf8, but not uk_UA.utf8 or ru_RU.utf8, which turn out

2
19971130

i.e. Monday (same for es_ES.utf8, de_DE.utf8 and en_GB.utf8 which I'm using).

So this looks very much like your locale is not behaving as you expect rather than a GNOME bug ...
Comment 7 Andrei Dziahel 2015-04-05 18:56:49 UTC
> FWIW, I get the same result when running a similar test program with LC_TIME=be_BY.utf8, but not uk_UA.utf8 or ru_RU.utf8

can you share it? my test being ran with LC_TIME=be_BY.utf8, ru_RU.utf8 and uk_UA.utf8 shows same numbers.
Comment 8 Florian Müllner 2015-04-05 20:22:54 UTC
Created attachment 300994 [details]
Test program

(In reply to Andrei Dziahel from comment #7)
> can you share it? my test being ran with LC_TIME=be_BY.utf8, ru_RU.utf8 and
> uk_UA.utf8 shows same numbers.

Sure, though its results obviously depend on the locale data installed on your system.
Comment 9 Andrei Dziahel 2015-04-05 20:52:47 UTC
Your test does print same results (1-0-0 in be_BY and 2-0-1 in ru_RU and en_GB), so gnome calendar looks like not the case. Thank you very much for assistance.
Comment 10 Andrei Dziahel 2015-04-24 09:35:41 UTC
a little heads up: I've filed a bug to glibc with a patch attached at https://sourceware.org/bugzilla/show_bug.cgi?id=18205