Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions archinstall/lib/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,16 +660,12 @@ def set_locale(self, locale_config: LocaleConfiguration) -> bool:
# in the first column of the entry; check for both cases.
entry_re = re.compile(rf'#{lang}(\.{encoding})?{modifier} {encoding}')

lang_value = None
for index, line in enumerate(locale_gen_lines):
if entry_re.match(line):
uncommented_line = line.removeprefix('#')
locale_gen_lines[index] = uncommented_line
locale_gen_lines[index] = line.removeprefix('#')
locale_gen.write_text(''.join(locale_gen_lines))
lang_value = uncommented_line.split()[0]
break

if lang_value is None:
else:
error(f"Invalid locale: language '{locale_config.sys_lang}', encoding '{locale_config.sys_enc}'")
return False

Expand All @@ -679,7 +675,7 @@ def set_locale(self, locale_config: LocaleConfiguration) -> bool:
error(f'Failed to run locale-gen on target: {e}')
return False

(self.target / 'etc/locale.conf').write_text(f'LANG={lang_value}\n')
(self.target / 'etc/locale.conf').write_text(f'LANG={lang}.{encoding}{modifier}\n')
return True

def set_timezone(self, zone: str) -> bool:
Expand Down