Skip to content

Commit

Permalink
Set LANG variable on startup (#843)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmhewitt authored Oct 20, 2024
1 parent cc5b114 commit 81d4a9d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ public class Installer.App : Gtk.Application {
}

public static int main (string[] args) {
// When the installer starts on a live iso session, LANG is set to C.UTF-8, which causes gettext to ignore the
// LANGUAGE variable. To enable runtime language switching, we need to set LANG to something other than C.UTF-8. See:
// https://github.com/autotools-mirror/gettext/blob/8f089a25a48a2855e2ca9c700984f4dc514cfcb6/gettext-runtime/intl/dcigettext.c#L1509-L1525
var current_lang = Environment.get_variable ("LANG");
if (current_lang == null || current_lang.has_prefix ("C.")) {
Environment.set_variable ("LANG", "en_US.UTF-8", true);
}

GLib.Intl.setlocale (LocaleCategory.ALL, "");
GLib.Intl.bindtextdomain (Build.GETTEXT_PACKAGE, Build.LOCALEDIR);
GLib.Intl.bind_textdomain_codeset (Build.GETTEXT_PACKAGE, "UTF-8");
Expand Down

0 comments on commit 81d4a9d

Please sign in to comment.