GNOME Bugzilla – Bug 649078
Ignores LC_TIME (thus forces weeks to start on Sundays for me)
Last modified: 2011-08-09 23:03:48 UTC
I want my weeks to start on Mondays, but still use an en_US locale otherwise. I tried setting LC_TIME to de_DE.UTF-8, but nothing changed.
I also set my weeks to start on Monday in Evolution, it would be best if the Shell just took this setting. What I want is basically: (1) take the setting from Evolution, if available (2) take the setting from LC_TIME otherwise, unless overriden by LC_ALL or LANGUAGE And my test locale is: LANG=en_US.utf8 LC_CTYPE="en_US.utf8" LC_NUMERIC="en_US.utf8" LC_TIME=de_DE.UTF-8 LC_COLLATE="en_US.utf8" LC_MONETARY="en_US.utf8" LC_MESSAGES=en_US.UTF-8 LC_PAPER="en_US.utf8" LC_NAME="en_US.utf8" LC_ADDRESS="en_US.utf8" LC_TELEPHONE="en_US.utf8" LC_MEASUREMENT="en_US.utf8" LC_IDENTIFICATION="en_US.utf8" LC_ALL=
From calendar.js: // FIXME: This is actually the fallback method for GTK+ for the week start; // GTK+ by preference uses nl_langinfo (NL_TIME_FIRST_WEEKDAY). We probably // should add a C function so we can do the full handling. That is an easy fix that would make it respect LC_TIME. Not really sure that picking up random Evolution settings makes sense - eventual plan is that the categories of LC_* will be settable from System SEttings. h
*** Bug 649363 has been marked as a duplicate of this bug. ***
Created attachment 190556 [details] [review] calendar: Improve week start handling Add a helper function (mostly copied from gtkcalendar.c) for getting the first week day for the current locale, using nl_langinfo if available and falling back to the GTK+ gettext fallback otherwise. Use that function in the calendar, so that the LC_TIME setting is used if possible. (In reply to comment #2) > eventual plan is that the categories of LC_* will be settable from > System Settings. The setting is now in master, though it seems that LC_* isn't set anywhere (yet?)
*** Bug 651822 has been marked as a duplicate of this bug. ***
Comment on attachment 190556 [details] [review] calendar: Improve week start handling >+# _NL_TIME_FIRST_WEEKDAY is an enum and not a define >+AC_MSG_CHECKING([for _NL_TIME_FIRST_WEEKDAY]) >+AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], >+ [[char c; >+ c = *((unsigned char *) nl_langinfo(_NL_TIME_FIRST_WEEKDAY));]])], So... I see that this is just copied straight from gtk, so I guess we know it works, but... (a) the cast to (unsigned char *) is bizarre given that nl_langinfo returns a char *, and the variable it's being assigned to is a char, (b) doing anything at all with the return value of nl_langinfo is bizarre since we're not actually running the program, merely linking it, (c) linking it is bizarre, since we only need to test that it compiles. >+ else if (week_origin == 19971291) /* Monday */ typo, should be 19971201. (Also, kill whoever invented that "API".) >+ g_warning ("Whoever translated calendar:week_start:0 did so wrongly.\n"); should probably indicate that it's talking about gtk's translations
Created attachment 193186 [details] [review] calendar: Improve week start handling (In reply to comment #6) > So... I see that this is just copied straight from gtk, so I guess we know it > works, but... (a) the cast to (unsigned char *) is bizarre [...], > (b) doing anything at all with the return value of nl_langinfo is bizarre [...], > (c) linking it is bizarre I assumed it was bizarre for a reason, but sure, let's do something comprehensible. > >+ else if (week_origin == 19971291) /* Monday */ > > typo, should be 19971201. (Also, kill whoever invented that "API".) Ooops. Also, hints in form of name/address are appreciated. > >+ g_warning ("Whoever translated calendar:week_start:0 did so wrongly.\n"); > > should probably indicate that it's talking about gtk's translations Done.
Attachment 193186 [details] pushed as 7ed3fac - calendar: Improve week start handling