Related branches

As soon as I noticed that lightdm will be the default dm in Oneiric, I realized that there is a need to patch lightdm similarly to how we patch gdm. It seems that lightdm uses the original (simplistic) gdm method to set the i18n environment.

gdm takes the $LANG value from ~/.profile or /etc/default/locale. (The $LC_MESSAGES value is derived from a language name, though, either in Xsession - the language_environment_update() function - or language-selector.)

As regards language/keyboard choosers, those features seem to be available.http://www.freedesktop.org/wiki/Software/LightDM/Design
I take it that there is a need to make a design decision on whether the language/keyboard choosers shall be enabled in Ubuntu by default. Personally I'd prefer that they are.

Btw, when I messed with gdm patches I noticed that the keyboard layout chooser seems to have been dropped in gdm 3.

I have patched lightdm so it no longer assigns an invalid value to LANG. However, at this time ~/.profile is ignored, so LANG gets populated with the system value, which lightdm sets by sourcing /etc/default/locale (in /etc/init/lightdm.conf, I think). I take it for granted that lightdm will source ~/.profile somehow as is requested in bug #794315. (I miss a dash script like /etc/gdm/Xsession - is "PreSession" going to serve that purpose?)

lightdm now also sets the language environment variables correctly from dmrc. language-selector has been modified so it updates lightdm's dmrc cache file and ~/.dmrc when lightdm is in use.

@Robert
The v. 0.41 changes in language-selector presuppose that lightdm's dmrc cache files are user editable. We'd better reach a conclusion on that soon, because currently, when you try to change language from language-selector, it fails.

The cache files are not user editable. The purpose of the cache is lightdm reads from it if ~/.dmrc does not exist (e.g. if the home directory is not yet mounted). if changing ~/.dmrc does not updated lightdm, then this is a bug in lightdm.

What about the question I asked on the merge proposal then? If the user changes ~/.dmrc, and lightdm reads from the cache at next login because HOME isn't yet mounted, it reads old info, doesn't it?

We also have the situation when the user sets a new language at login. If HOME isn't mounted then, only the cache file will be updated, and if the user opens language-selector in that session, l-s will read old info from ~/.dmrc since the cache file isn't even user readable.

As regards GDM, these situations are taken care of by both GDM and language-selector read from and write to the cache file at first hand (which basically makes ~/.dmrc redundant). I'm not saying that this is the only way to deal with it, but I want to make sure that we don't introduce buggy behavior.

The fix in LightDM is it no longer sets any locale environment. The defaults for LANG and LANGUAGE are sourced from /etc/default/locale and then it is up to the users .profile to set their language (which is populated by language-selector). The fields in ~/.dmrc are ignored entirely.

Btw, are you talking about Ubuntu or upstream or both? Personally I'd prefer that we keep providing the opportunity to set the display language at login, at least in Ubuntu.

If I understand it correctly, the code for a language widget is still there, and the (.dmrc based) Natty model for how a language chooser may play together with language-selector can be applied to LightDM as well.

I fully understand that you are loaded with various aspects of LightDM, and I offer to help fix this in a similar way as it works in Natty with GDM. If somebody re-activates the LightDM language chooser (as is), I'll try to take it from there.

Yves-Alexis, the fields in .dmrc are only there so the greeter can know which language to set by default in the list of options. The locale settings must be set externally to the display manager as it is not the only method of logging into the system (e.g. text terminal logins). So by LightDM not touching the locale settings it uses the correct settings as defined by the distribution.

Gunnar, I've closed this bug because it fixes the specific problem which was setting the locale to an invalid value. There are some other issues here which need to be tracked in other bugs:
- Does LightDM support a greeter overriding the user language (currently broken, not opposed to solving this)
- Does the Ubuntu greeter provide an appropriate method for users to switch languages?

Robert, I disagree about lightdm not touching the locale setting. If there are other ways to login to the system, fine. That doesn't prevent to read .dmrc which has the correct locale selected by the user.