gnome-menus does not honour LANGUAGE variable

Bug #556545 reported by Arne Goetje
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gnome-menus (Ubuntu)
Fix Released
High
Martin Pitt

Bug Description

Binary package hint: gnome-menus

When the LANGUAGE environment variable is set to a different language code than what is specified in LANG or LC_MESSSAGES, LANGUAGE should be preferred. gnome-menus only takes LC_MESSAGES into account.

Test case:
LANG = de_DE.utf8
LANGUAGE = en_US:en

Expected result: the menus are displayed in English.
Actual result: The top layer of the mneus (Applications, Places, System) is displayed in English, all the subsequent entries are displayed in German.

When grepping the code for 'locale', I found this snippet in libmenu/entry-directories.c:

locale = g_strdup (setlocale (LC_MESSAGES, NULL));
  if (locale == NULL)
    {
      menu_verbose ("cached_dir_load_entries_from_cache_file(): setlocale() failed, aborting\n");
      return FALSE;
    }

  /* canonicalize .UTF-8 to .utf8 (only happens at end of string) */
  s = strstr (locale, ".UTF-8");
  if (s != NULL)
      strcpy (s, ".utf8");

  g_snprintf (cache_file, sizeof(cache_file), "%s/desktop.%s.cache", dirname, locale);
  g_free (locale);

I think this should be modified to something like this:
if LANGUAGE is set, get the value; split the language codes by the ':' delimiter, try if dirname/desktop.languagecode.cache is present, if not try the next language code; else try LC_MESSAGES.

Not sure if anything else needs to be modified though.

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: gnome-menus 2.30.0-0ubuntu2
ProcVersionSignature: Ubuntu 2.6.32-19.28-generic 2.6.32.10+drm33.1
Uname: Linux 2.6.32-19-generic i686
Architecture: i386
Date: Tue Apr 6 22:20:59 2010
EcryptfsInUse: Yes
ProcEnviron:
 LANGUAGE=en_US:en
 LANG=de_DE.utf8
 SHELL=/bin/bash
SourcePackage: gnome-menus

Revision history for this message
Arne Goetje (arnegoetje) wrote :
Changed in gnome-menus (Ubuntu):
importance: Undecided → High
milestone: none → ubuntu-10.04
status: New → Triaged
Changed in gnome-menus (Ubuntu):
assignee: nobody → Canonical Desktop Team (canonical-desktop-team)
Martin Pitt (pitti)
Changed in gnome-menus (Ubuntu):
assignee: Canonical Desktop Team (canonical-desktop-team) → Martin Pitt (pitti)
status: Triaged → In Progress
Martin Pitt (pitti)
Changed in gnome-menus (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnome-menus - 2.30.0-0ubuntu4

---------------
gnome-menus (2.30.0-0ubuntu4) lucid; urgency=low

  * debian/update-gnome-menus-cache: Unset $LANGUAGE, so that we are actually
    getting the translation that we expect. (LP: #556545, part 1)
  * 22_desktop-cache.patch: Do not use the cache if we have $LANGUAGE;
    properly implementing multi-locale/language lookup is too intrusive for
    lucid at this point. (LP: #556545, part 2)
 -- Martin Pitt <email address hidden> Fri, 09 Apr 2010 09:40:57 +0200

Changed in gnome-menus (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.