From 9c093f7a97fb0b9593a303ef7394c3bc5dea99b2 Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Sat, 18 Jun 2016 09:41:51 +0200 Subject: [PATCH] Improve language detection and showing related details --- lynis | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lynis b/lynis index dcfa2765..a597a9c8 100755 --- a/lynis +++ b/lynis @@ -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}