GNOME Bugzilla – Bug 747346
calendar applet should respect locales' "first weekday" value
Last modified: 2015-04-24 09:35:41 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
The week start is picked up from the locale, see https://git.gnome.org/browse/gnome-shell/tree/src/shell-util.c#n168.
Created attachment 300958 [details] calendar widget not respecting first week day
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?
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
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.
(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 ...
> 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.
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.
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.
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