Comment 3 for bug 803858

Revision history for this message
Robert Ancell (robert-ancell) wrote : Re: Unable to switch between Chinese and English in LightDM

I think the correct layer to do this in is the session layer, rather than by getting the user to explicitly choose a language. This is because (as I understand it) users do not need to pick a particular language, but instead have a small set they use.

This could be accomplished by making new sessions /usr/share/xsessions/gnome-en.desktop and /usr/share/xsessions/gnome-zh.desktop which are copies of /usr/share/xsessions/gnome.desktop. This would mean the user could choose the session language from the session type combo box.

In /etc/X11/Xsession.d/99locale-session, you can check for the session and override the users locale settings, i.e.:
if [ $DESKTOP_SESSION = "gnome-en" ] ; then
    LANG=en_US.utf8
    DESKTOP_SESSION=gnome
elif [ $DESKTOP_SESSION = "gnome-zh" ] ; then
    LANG=zh_CN.utf8
    DESKTOP_SESSION=gnome
fi

(This is not tested and theoretical)