1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-31 03:49:01 +00:00

Add checks for $lang variable

We now use AppleLanguages to provide a good language to Zenmap.
This should prevent Zenmap from choosing wrong locale/languages settings.
This commit is contained in:
vincent
2016-06-17 08:55:34 +00:00
parent 02eced2fef
commit 4c1ef96578

View File

@@ -34,15 +34,14 @@ PYTHONPATH="$bundle_res/lib/zenmap"
export PYTHONPATH
# We need a UTF-8 locale.
if test "x$LANG" == "x"; then
lang=`defaults read .GlobalPreferences AppleLocale 2>/dev/null`
if test "$?" != "0"; then
lang=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null | sed 's/_.*//'`
fi
if test "$?" == "0"; then
export LANG="`grep \"\`echo $lang\`_\" /usr/share/locale/locale.alias | \
tail -n1 | sed 's/\./ /' | awk '{print $2}'`.UTF-8"
fi
if [ -z ${lang+x} ]; then
# lang is unset
lang=`defaults read /Library/Preferences/.GlobalPreferences AppleLanguages 2>/dev/null | awk '{ print $1 }' | head -n2 | tail -n1 | sed 's/\,/ /'`
if [ -z ${lang+x} ]; then
# lang is still unset
lang=`defaults read .GlobalPreferences AppleLocale 2>/dev/null`
fi
export LANG="`grep \"\`echo $lang\`_\" /usr/share/locale/locale.alias | tail -n1 | sed 's/\./ /' | awk '{print $2}'`.UTF-8"
fi
if test -f "$bundle_lib/charset.alias"; then