on xenial help sign in
Set locale as well as language when starting greeter
059b6d4Michael Terry
data/unity8-greeter-wrapper+16−3
@@ -30,6 +30,15 @@ cleanup()
30 exit 0
30 exit 0
31}
31}
32
32
33+set_greeter_var()
34+{
35+ export "$1=$2"
36+ gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "{'$1': '$2'}"
37+ if [ -n "$INIT_PID" ]; then
38+ initctl set-env --global "$1=$2"
39+ fi
40+}
41+
33SUB_SOCKET=$XDG_RUNTIME_DIR/mir_socket
42SUB_SOCKET=$XDG_RUNTIME_DIR/mir_socket
34rm -f $SUB_SOCKET # clear socket in case we were hard shut down
43rm -f $SUB_SOCKET # clear socket in case we were hard shut down
35
44
@@ -46,8 +55,7 @@ export DESKTOP_SESSION=ubuntu-touch
46# We disable ofono using pulse. It causes problems with racing with the user's
55# We disable ofono using pulse. It causes problems with racing with the user's
47# pulse. We need to come up with a better long-term fix for this, because we
56# pulse. We need to come up with a better long-term fix for this, because we
48# eventually need the greeter to play ringtones for users that aren't logged in.
57# eventually need the greeter to play ringtones for users that aren't logged in.
49−export PA_DISABLED=1
58+set_greeter_var PA_DISABLED 1
50−gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "{'PA_DISABLED': '1'}"
51
59
52# Normal unity8 sessions are entirely driven by Upstart. But greeters
60# Normal unity8 sessions are entirely driven by Upstart. But greeters
53# are special. They need access to the file descriptors that lightdm
61# are special. They need access to the file descriptors that lightdm
@@ -74,7 +82,12 @@ export UPSTART_SESSION=$(/sbin/initctl list-sessions | grep "^$INIT_PID " | cut
74if [ "$(id -u phablet 2>/dev/null)" = "32011" ]; then
82if [ "$(id -u phablet 2>/dev/null)" = "32011" ]; then
75 USER_LANG=$(gdbus call --system --dest org.freedesktop.Accounts --object-path /org/freedesktop/Accounts/User32011 --method org.freedesktop.DBus.Properties.Get org.freedesktop.Accounts.User Language | cut -d\' -f2)
83 USER_LANG=$(gdbus call --system --dest org.freedesktop.Accounts --object-path /org/freedesktop/Accounts/User32011 --method org.freedesktop.DBus.Properties.Get org.freedesktop.Accounts.User Language | cut -d\' -f2)
76 if [ -n "$USER_LANG" ]; then
84 if [ -n "$USER_LANG" ]; then
77− export LANGUAGE="$USER_LANG"
85+ set_greeter_var LANGUAGE "$USER_LANG"
86+ fi
87+ USER_LOCALE=$(gdbus call --system --dest org.freedesktop.Accounts --object-path /org/freedesktop/Accounts/User32011 --method org.freedesktop.DBus.Properties.Get org.freedesktop.Accounts.User FormatsLocale | cut -d\' -f2)
88+ if [ -n "$USER_LOCALE" ]; then
89+ set_greeter_var LANG "$USER_LOCALE"
90+ set_greeter_var LC_ALL "$USER_LOCALE"
78 fi
91 fi
79fi
92fi
80
93