Improve language detection and showing related details

This commit is contained in:
Michael Boelen 2016-06-18 09:41:51 +02:00
parent 1be27c7b00
commit 9c093f7a97
1 changed files with 6 additions and 2 deletions

8
lynis
View File

@ -98,8 +98,9 @@ Make sure to execute ${PROGRAM_NAME} from untarred directory or check your insta
. ${DBDIR}/languages/en
fi
# Auto detection of language based on locale (first two characters)
# 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
#
#################################################################################
#
@ -554,8 +555,11 @@ ${NORMAL}
# Import a different language when configured
if [ ! "${LANGUAGE}" = "en" ]; then
LogText "Language is set to ${LANGUAGE}"
Display --indent 2 --text "- Detecting language and localization" --result "${LANGUAGE}" --color WHITE
if [ ! -f ${DBDIR}/languages/${LANGUAGE} ]; then
Display "Warning: could not find languages directory (file: ${DBDIR}/languages/${LANGUAGE})"
Display --indent 4 --text "${YELLOW}Notice:${NORMAL} no language file found for '${LANGUAGE}' (tried: ${DBDIR}/languages/${LANGUAGE})"
if IsDeveloperVersion; then Display --indent 4 --text "See https://github.com/CISOfy/lynis-sdk/documentation/10-translations.md for more details to help translating Lynis"; fi
sleep 5
else
LogText "Importing language file (${DBDIR}/languages/${LANGUAGE})"
. ${DBDIR}/languages/${LANGUAGE}