← Back to team overview

desktop-packages team mailing list archive

Re: [Bug 868149] Re: Need to set $LANG from .dmrc for backwards compatibility

 

Gunnar Hjalmarsson [2011-10-06 19:10 -0000]:
> > Did it change in the new GDM, or is this an Ubuntu specific thing?
> 
> It's an Ubuntu specific thing in GDM 2. (In GDM 3 ~/.dmrc isn't used.)

Argh, why did we use that? Whenever we discussed that we were quite
adamant to not redefine the meaning of existing fields, to not break
other DMs and backwards compat. :-( As it seems that existing
configuration files can now contain a locale (as it should), or a
language (which really is broken), I guess we can only apply a
heuristic, as e. g. en_GB is both (but more likely a language, as we
never officially supported non-UTF8 locales and gdm never allowed you
to set one).

> Otherwise, the language2locale() function I proposed in
> https://code.launchpad.net/~gunnarhj/lightdm/lang-chooser/+merge/78226
> might be handy. You could use that function to convert ~/.dmrc
> "Language" values that does not contain a '.' before setting LANG.

Please note. By definition, a language name does not have enough
information to turn it into a proper locale for $LANG, unless you also
know which country the user is. I rather propose to apply a heuristic
to find out whether it's a language or a locale, and assign it to
$LANGUAGE/$LANG respectively.

I think this heuristic should work, assuming that we only support
UTF-8 in .dmrc:

  '.' in the name → locale; break
  no '_' in the name → language; break
  now we have something like ll_CC[suffix]
  ll in {'en', 'es', 'zh', 'pt'} → language
  else it's a locale

That works for any ll_CC.UTF-8 (locale), simple language ("de"),
specially handled country specific language (en_GB, zh_TW), UTF-8
locales without suffix (sr_RS@latin, sr_RS).

Martin
-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to lightdm in Ubuntu.
https://bugs.launchpad.net/bugs/868149

Title:
  Need to set $LANG from .dmrc for backwards compatibility

Status in “lightdm” package in Ubuntu:
  Fix Released
Status in “lightdm” source package in Oneiric:
  Fix Released

Bug description:
  This is fallout from bug 864618: In that bug we disabled the
  set_language() call as it invalidly sets $LANG to the "Language"
  property of accountsservice, which cannot work because $LANG is a
  locale and "Language" is only a language name.

  However, set_language() also sets the $LANG variable from ~/.dmrc,
  which we need for backwards compatibility and derivatives.

  So what should happen is that all the code which does the `locale -a`
  guesswork needs to be dropped, and only these parts remain which
  evaluate ~/.dmrc.

  Please see http://pad.ubuntu.com/locale-handling for details.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/868149/+subscriptions


References