Merge pull request #59 from YunoHost/fix-locale

[fix] Manage the case where there is no en_US locale commented
This commit is contained in:
Alexandre Aubin 2020-04-01 03:24:14 +02:00 committed by GitHub
commit 60e88c5da6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -528,7 +528,12 @@ function fix_locales() {
command -v locale-gen > /dev/null || apt_get_wrapper -o Dpkg::Options::="--force-confold" -y install locales
# Generate at least en_US.UTF-8
sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen && locale-gen
grep -q "^ *en_US.UTF-8" /etc/locale.gen || echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
# FIXME: here some day we should try to identify the user's lang from LANG or LC_ALL and generate the appropriate locale ...
# (and set this lang as the default in /etc/env 3 lines below)
locale-gen
# If no /etc/environment exists, default to en_US.UTF-8
[ "$(grep LC_ALL /etc/environment)" ] || echo 'LC_ALL="en_US.UTF-8"' >> /etc/environment