Feel free to edit the Background and Desired behavior sections, for the case you think that changes or additions are motivated.
Please insert possible comments at the bottom of the page.
Background
GDM and LanguageSelector do currently not work quite well together.
- Variable inconsistency
The LanguageSelector GUI distinguishes between language for translation purposes on one hand, and non-translation locale settings on the other hand. In the tab for language it sets the LANGUAGE environment variable, while the LANG variable is set in the tab for non-translation locale settings.
The GDM login screen provides a tool for setting the translation language only. However, the variable that GDM sets is LANG.
- Not all applications recognize the LANGUAGE variable
When the gettext specific variable LANGUAGE is set, it's given preference over LANG for the purpose of translation. However, some applications do not recognize LANGUAGE, and fall back to LANG when translating menus and messages.
For those reasons, one by one or together, users run into various variants of locale related unexpected behavior, and bug reports such as these are submitted:
Desired behavior
As the LanguageSelector UI already indicates, users should be able to set translation language respective other locales independently of each other, without any risk that those settings are mixed up.
Applications that don't recognize the LANGUAGE variable should display menus and messages in the primary language, even if they cannot benefit from the priority list feature that LANGUAGE provides.
Suggested solution
(by GunnarHj 2010-10-05)
This solution suggests changes to a few LanguageSelector files and one GDM file (Xsession.in).
LanguageSelector
When setting the variable for non-translation locales, i.e. LANG, LanguageSelector updates the Language value in ~/.dmrc and /var/cache/gdm/$USER/dmrc. However, GDM uses the dmrc Language value to determine the pre-selected language in the list box at the login screen for selecting the user language. Therefore the LanguageSelector code should be changed, so that the dmrc update instead happens when the translation language variable, i.e. LANGUAGE, is set.
GDM
The chosen language is assigned to the LANG variable. Instead the priority list, both in the LANGUAGE variable and in ~/.profile, should be updated, so that
LANGUAGE aware applications use the correct list,
the correct list is displayed next time the user opens the language tab in LanguageSelector, and
- the chosen language does not interfere with the non-translation locales.
The chosen language should also be assigned to the LC_MESSAGES environment variable, so those applications that don't recognize LANGUAGE will still use the correct language for translation.
Patches and PPA for testing
Two patches with this solution have been attached to bug report #553162.
I have also created the PPA Test of code for setting locales and uploaded versions of GDM and LanguageSelector with the suggested changes. It means that you can test the solution by just installing the binary files, provided that you upgrade to Ubuntu 10.10. Example:
sudo dpkg -i language-selector_0.6.6localefix6_all.deb