Set initial value for language and improve auto detection

This commit is contained in:
Michael Boelen 2016-07-12 20:32:15 +02:00
parent cb76421d9c
commit 07a113e46e
3 changed files with 11 additions and 7 deletions

View File

@ -33,13 +33,12 @@ compressed-uploads=yes
# Show non-zero exit code when warnings are found
error-on-warnings=no
# Use Lynis in your own language (available languages: en fr nl)
language=en
# Use Lynis in your own language (by default auto-detected)
language=
# Add your Lynis Enterprise license key here
# Lynis Enterprise license key
license-key=
# Defines the role of the system (desktop, server)
machine-role=server

View File

@ -139,7 +139,9 @@
# Language
language | lang)
LogText "Language set via profile to ${VALUE}"
LANGUAGE="${VALUE}"
if [ ! -z "${VALUE}" ]; then
LANGUAGE="${VALUE}"
fi
AddSetting "language" "${LANGUAGE}" "Language"
;;

7
lynis
View File

@ -99,8 +99,11 @@ Make sure to execute ${PROGRAM_NAME} from untarred directory or check your insta
fi
# Auto detection of language based on locale (first two characters). Set to English when nothing found.
LANGUAGE=$(locale | egrep "^LANG=" | cut -d= -f2 | cut -d_ -f1)
if [ "${LANGUAGE}" = "" ]; then LANGUAGE="en"; fi
LANGUAGE=$(locale | egrep "^LANG=" | cut -d= -f2 | cut -d_ -f1 | egrep "^[a-z]{2}$")
if [ -z "${LANGUAGE}" ]; then
#Debug "Result: no (valid) language found, setting to default language (en)"
LANGUAGE="en"
fi
#
#################################################################################
#