Skip to content

Commit 81d4a9d

Browse files
authored
Set LANG variable on startup (#843)
1 parent cc5b114 commit 81d4a9d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Application.vala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ public class Installer.App : Gtk.Application {
7979
}
8080

8181
public static int main (string[] args) {
82+
// When the installer starts on a live iso session, LANG is set to C.UTF-8, which causes gettext to ignore the
83+
// LANGUAGE variable. To enable runtime language switching, we need to set LANG to something other than C.UTF-8. See:
84+
// https://github.com/autotools-mirror/gettext/blob/8f089a25a48a2855e2ca9c700984f4dc514cfcb6/gettext-runtime/intl/dcigettext.c#L1509-L1525
85+
var current_lang = Environment.get_variable ("LANG");
86+
if (current_lang == null || current_lang.has_prefix ("C.")) {
87+
Environment.set_variable ("LANG", "en_US.UTF-8", true);
88+
}
89+
8290
GLib.Intl.setlocale (LocaleCategory.ALL, "");
8391
GLib.Intl.bindtextdomain (Build.GETTEXT_PACKAGE, Build.LOCALEDIR);
8492
GLib.Intl.bind_textdomain_codeset (Build.GETTEXT_PACKAGE, "UTF-8");

0 commit comments

Comments
 (0)