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 649078 - Ignores LC_TIME (thus forces weeks to start on Sundays for me)
Ignores LC_TIME (thus forces weeks to start on Sundays for me)
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: calendar
3.0.x
Other All
: Normal normal
: ---
Assigned To: Dan Winship
gnome-shell-maint
: 649363 651822 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-05-01 11:17 UTC by Julian Andres Klode
Modified: 2011-08-09 23:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
calendar: Improve week start handling (6.63 KB, patch)
2011-06-24 03:07 UTC, Florian Müllner
reviewed Details | Review
calendar: Improve week start handling (6.59 KB, patch)
2011-08-03 14:59 UTC, Florian Müllner
committed Details | Review

Description Julian Andres Klode 2011-05-01 11:17:54 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.
Comment 1 Julian Andres Klode 2011-05-01 11:24:13 UTC
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=
Comment 2 Owen Taylor 2011-05-02 15:24:10 UTC
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
Comment 3 Dan Winship 2011-05-04 12:21:07 UTC
*** Bug 649363 has been marked as a duplicate of this bug. ***
Comment 4 Florian Müllner 2011-06-24 03:07:56 UTC
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?)
Comment 5 Jasper St. Pierre (not reading bugmail) 2011-07-21 16:31:49 UTC
*** Bug 651822 has been marked as a duplicate of this bug. ***
Comment 6 Dan Winship 2011-08-03 14:08:08 UTC
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
Comment 7 Florian Müllner 2011-08-03 14:59:57 UTC
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.
Comment 8 Florian Müllner 2011-08-09 23:03:43 UTC
Attachment 193186 [details] pushed as 7ed3fac - calendar: Improve week start handling