Added support for multiple languages

This commit is contained in:
Michael Boelen 2016-06-11 14:09:41 +02:00
parent 7ff4f3b1d3
commit f851834dbd
4 changed files with 30 additions and 3 deletions

View File

@ -388,6 +388,9 @@ config:compliance_standards:cis,hipaa,iso27001,pci-dss:
# Show non-zero exit code when warnings are found (default: no)
#error-on-warnings=yes
# Set output to a different language
#language=es
# Enable quick mode (no waiting for keypresses, same as --quick option)
#quick=yes

View File

@ -93,6 +93,7 @@ unset LANG
HOSTID=""
IDS_IPS_TOOL_FOUND=0
IPTABLESBINARY=""
LANGUAGE="en-US"
LINUX_VERSION=""
LINUXCONFIGFILE=""
LMDBINARY=""

View File

@ -126,6 +126,11 @@
GROUP_NAME="${VALUE}"
;;
# Language
language | lang)
LANGUAGE="${VALUE}"
;;
# Lynis Enterprise license key
license_key | license-key)
LICENSE_KEY="${VALUE}"

24
lynis
View File

@ -89,6 +89,14 @@ Make sure to execute ${PROGRAM_NAME} from untarred directory or check your insta
DBDIR="${I}"
fi
done
# Import translations. First import English to prefill all texts
if [ ! -f ${DBDIR}/languages/en-US ]; then
echo "Could not find languages directory (file: ${DBDIR}/languages/en-US)"
exit 1
else
. ${DBDIR}/languages/en-US
fi
#
#################################################################################
#
@ -432,7 +440,7 @@ ${YELLOW}Note: ${WHITE}Cancelling the program can leave temporary files behind${
echo " ${RED}Error${NORMAL}: ${WHITE}Invalid option '${WRONGOPTION_value}'${NORMAL}"
else
if [ ${VIEWHELP} -eq 0 ]; then
echo " ${RED}No command specified.${WHITE} Exiting..${NORMAL}"
echo " ${RED}No command provided.${WHITE} Exiting..${NORMAL}"
echo ""
fi
fi
@ -533,12 +541,22 @@ ${NORMAL}
#
#################################################################################
#
# Read profile/template/plugins
# Read profile/language
#
#################################################################################
#
SafePerms ${INCLUDEDIR}/profiles
. ${INCLUDEDIR}/profiles
# Import a different language when configured
if [ ! "${LANGUAGE}" = "en-US" ]; then
if [ ! -f ${DBDIR}/languages/${LANGUAGE} ]; then
Display "Warning: could not find languages directory (file: ${DBDIR}/languages/${LANGUAGE})"
else
LogText "Importing language file (${DBDIR}/languages/${LANGUAGE})"
. ${DBDIR}/languages/${LANGUAGE}
fi
fi
#
#################################################################################
#
@ -767,7 +785,7 @@ ${NORMAL}
PLUGIN_PHASE=$1
if [ ${PLUGIN_PHASE} -eq 0 -o ${PLUGIN_PHASE} -gt 2 ]; then echo "Incorrect phase number when calling RunPlugins"; ExitFatal; fi
LogTextBreak
InsertPluginSection "Plugins (phase ${PLUGIN_PHASE})"
InsertPluginSection "Plugins (${GEN_PHASE} ${PLUGIN_PHASE})"
if [ ${PLUGIN_PHASE} -eq 1 ]; then
Display --text "Note: plugins have more extensive tests, which may take a few minutes to complete"
Display --text " "