Refreshing 15-path-replace.patch and 22_ubuntu_i18n_oneiric.patch.
[debian/lxdm.git] / debian / patches / 22_ubuntu_i18n_oneiric.patch
1 Description: Adapt to the Oneiric model for setting languages/locales.
2 Forwarded: not-needed
3 Author: Gunnar Hjalmarsson <ubuntu@gunnar.cc>
4
5 --- a/data/Xsession
6 +++ b/data/Xsession
7 @@ -9,9 +9,20 @@
8         LXSESSION=/usr/bin/startlxde
9  fi
10  
11 +[ -f /etc/profile ] && . /etc/profile
12 +[ -f ~/.profile ] && . ~/.profile
13  [ -f /etc/xprofile ] && . /etc/xprofile
14  [ -f ~/.xprofile ] && . ~/.xprofile
15  
16 +# override ~/.profile if language was set on the greeter
17 +if [ -n "$GREETER_LANGUAGE" ]; then
18 +       language_list=${GREETER_LANGUAGE%.*}${GREETER_LANGUAGE#*.UTF-8}:en
19 +       export LANGUAGE="$language_list"
20 +       export LC_MESSAGES="$GREETER_LANGUAGE"
21 +       export LC_CTYPE="$GREETER_LANGUAGE"
22 +       export LC_COLLATE="$GREETER_LANGUAGE"
23 +fi
24 +
25  if [ -f /etc/X11/xinit/xinitrc-common ]; then
26  # fedora
27         . /etc/X11/xinit/xinitrc-common
28 --- a/src/lxdm.c
29 +++ b/src/lxdm.c
30 @@ -1297,11 +1297,6 @@
31                         session=g_key_file_get_string(dmrc,"Desktop","Session",NULL);
32                         alloc_session=TRUE;
33                 }
34 -               if(!lang || !lang[0])
35 -               {
36 -                       lang=g_key_file_get_string(dmrc,"Desktop","Language",NULL);
37 -                       alloc_lang=TRUE;
38 -               }
39                 g_key_file_free(dmrc);
40         }
41  
42 @@ -1411,9 +1406,9 @@
43         /* optionally override $LANG, $LC_MESSAGES, and $LANGUAGE */
44         if( lang && lang[0] )
45         {
46 -               env=g_environ_setenv(env, "LANG", lang, TRUE);
47 -               env=g_environ_setenv(env, "LC_MESSAGES", lang, TRUE);
48 -               env=g_environ_setenv(env, "LANGUAGE", lang, TRUE);
49 +               /* use this special environment variable to set the language related
50 +                  env. variables from Xsession after ~/.profile has been sourced */
51 +               env=g_environ_setenv(env, "GREETER_LANGUAGE", lang, TRUE);
52         }
53  
54         if( session_desktop_names && session_desktop_names[0] )