]> arthur.barton.de Git - ConfigScripts.git/commitdiff
Make locale setting much more smarter
authorAlexander Barton <alex@barton.de>
Fri, 22 Apr 2011 20:26:19 +0000 (22:26 +0200)
committerAlexander Barton <alex@barton.de>
Fri, 22 Apr 2011 20:26:19 +0000 (22:26 +0200)
Now UTF8 terminals are detected much better.

sys/profile

index 7471952b9e53080de3c7cc178d3b58ca590abc60..bfebb1ff17adf311747638f26c349de6ff935226 100644 (file)
@@ -13,11 +13,16 @@ export PROFILEREAD
 [ -n "$UID" ] || UID=`id -u`
 export UID
 
-# Set locale if it is not set or doesn't contain a dot;
-# but all system messages should still be in "native" ("C") language.
+# Indicates LC_CTYPE an UTF-8 terminal?
+[ -n "$LC_CTYPE" ] \
+       && LC_encoding="${LC_CTYPE#*.}" || LC_encoding="ISO8859-1"
+# Set locale if it is not set or doesn't contain a dot:
 [ "$LANG" = "${LANG#*.}" -a "$LANG" != "C" ] \
-       && export LANG="${LANG:-de_DE}.ISO8859-1"
+       && export LANG="${LANG:-de_DE}.${LC_encoding}"
+# All system messages should still be in "native" ("C") language:
 export LC_MESSAGES="C"
+# Clean up ...
+unset LC_CTYPE LC_encoding
 
 # Initialize PATH variable
 if [ -x /usr/libexec/path_helper ]; then