From 6a62aa4d3afd2d39748f626e1fdd277d6cfc7d68 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 15 May 2022 22:12:13 +0200 Subject: [PATCH] Making sure language and encoding is dynamic when setting vconsole parameters. --- archinstall/lib/installer.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index a86347e5..b5711920 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -1057,7 +1057,7 @@ class Installer: def set_keyboard_language(self, language: str) -> bool: from .systemd import localectl_status - + log(f"Setting keyboard language to {language}", level=logging.INFO) if len(language.strip()): if not verify_keyboard_layout(language): @@ -1080,7 +1080,12 @@ class Installer: # This needs to be explicitly set in some cases due to https://github.com/archlinux/archinstall/issues/596 if LANG := localectl_status().get('x11_layout'): with open(f"{self.target}/etc/vconsole.conf", "a") as vconsole: - vconsole.write(f"LANG={LANG}\n") + with open(f'{self.target}/etc/locale.conf', 'r') as locale: + locale_data = locale.read() + + # TODO: A bit of a hack to convert LANG=en_US.UTF-8 into just US.UTF-8 + locale_and_encoding = locale_data.split('=', 1)[1].split('_', 1)[1].split('.', 1)[0] + vconsole.write(f"LANG={LANG}_{locale_and_encoding}\n") return True