summaryrefslogtreecommitdiffstats
path: root/core/modules/system-check
diff options
context:
space:
mode:
authorSimon Rettberg2021-10-20 12:00:57 +0200
committerSimon Rettberg2021-10-20 12:00:57 +0200
commit2ca79c395b5c71634d77a8d04d23a4ad5f90b4b6 (patch)
tree8fba2cf5ab646b8cca6df6dfb802e67b5b0d0de2 /core/modules/system-check
parentkernel config: Sort alphabetically (diff)
downloadmltk-2ca79c395b5c71634d77a8d04d23a4ad5f90b4b6.tar.gz
mltk-2ca79c395b5c71634d77a8d04d23a4ad5f90b4b6.tar.xz
mltk-2ca79c395b5c71634d77a8d04d23a4ad5f90b4b6.zip
[system-check] Try harder to determine system language
Diffstat (limited to 'core/modules/system-check')
-rwxr-xr-xcore/modules/system-check/data/opt/openslx/scripts/systemd-system_check24
1 files changed, 15 insertions, 9 deletions
diff --git a/core/modules/system-check/data/opt/openslx/scripts/systemd-system_check b/core/modules/system-check/data/opt/openslx/scripts/systemd-system_check
index 4d4d7bd7..fd6809d6 100755
--- a/core/modules/system-check/data/opt/openslx/scripts/systemd-system_check
+++ b/core/modules/system-check/data/opt/openslx/scripts/systemd-system_check
@@ -10,13 +10,19 @@
declare -rg root_dir="/opt/openslx/system-check"
generate_messages() {
- local hook_dir="${root_dir}/hooks.d"
- local lang=en
+ local lang f hook_dir lang_dir
+ hook_dir="${root_dir}/hooks.d"
+ lang_dir=
# determine lang
- if [ -z "$LANG" ] && [ -s "/etc/default/locale" ]; then
- . /etc/default/locale
- fi
- [ -n "$LANG" ] && lang="${LANG:0:2}"
+
+ for f in "/etc/default/locale" "/etc/environment"; do
+ lang="$( unset LANG; . "$f" &> /dev/null; [ -n "$LANG" ] && echo "${LANG:0:2}" || echo "${LANGUAGE}" )"
+ if [ -d "${root_dir}/lang/${lang}" ]; then
+ lang_dir="${root_dir}/lang/${lang}"
+ break
+ fi
+ done
+ [ -z "$lang_dir" ] && lang_dir="${root_dir}/lang/en"
local dm_warning_file="$( \
awk -F'=' '$1 == "greeter-message-file" {print $2}' \
@@ -27,7 +33,7 @@ generate_messages() {
if [ ! -d "$hook_dir" ]; then
echo "Missing '$hook_dir' - dev failure?"
return 1
- fi
+ fi
for file in "$hook_dir"/*; do
[ -x "$file" ] || continue
(
@@ -75,10 +81,10 @@ print_tag() {
local tag="$1"
shift
# get localized message for this tag
- local file="${root_dir}/lang/${lang}/${tag}"
+ local file="${lang_dir}/${tag}"
if [ ! -f "$file" ]; then
# fallback
- echo "000000" "Missing translation for '$tag'."
+ echo "000000" "Missing translation for '$tag' in '$lang_dir'."
return 1
fi
while read -r line; do