Skip to content

Commit

Permalink
Enable the correct language in the locale.gen list
Browse files Browse the repository at this point in the history
the original code does not distinguish the document comments inside the locale.gen file from the real locale list. The language was then enabled from the header comments of the file instead of the correct value in the list.

The new code verify tha the complete locale string is just after the first character of the string, enablig only the correct value of the locale list.
An example:
#  en_US.UTF-8 UTF-8 --> document header, should not be enabled
#en_US.UTF-8 UTF-8 --> correct section to enable

Related to this request:
https://code.chakralinux.org/tools/calamares-chakra/issues/2
  • Loading branch information
AlmAck committed Mar 3, 2018
1 parent 561ba6b commit 382c193
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/modules/localecfg/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,15 @@ def run():
with open("{!s}/etc/locale.gen".format(install_path), "w") as gen:
for line in text:
# always enable en_US
if en_us_locale in line and line[0] == "#":
if line.startswith(en_us_locale, 1):
# uncomment line
line = line[1:].lstrip()

for locale_value in locale_values:
if locale_value in line and line[0] == "#":
# check the locale value starting from
# the second index because we expect that
# the first one is a '#'
if line.startswith(locale_value, 1):
# uncomment line
line = line[1:].lstrip()

Expand Down

0 comments on commit 382c193

Please sign in to comment.