zshrc: Insert a condition for loading /etc/default/locale
authorFrank Terbeck <ft@bewatermyfriend.org>
Wed, 8 Jul 2009 10:59:31 +0000 (12:59 +0200)
committerFrank Terbeck <ft@bewatermyfriend.org>
Wed, 8 Jul 2009 10:59:31 +0000 (12:59 +0200)
In 76706fcdd9c160d7f3212e597d2139f45531da72 we started loading
/etc/default/locale unconditionally in order to pick up sane defaults
for a given system.

While this is a good idea in most cases, because users may still
customize the locale for their interactive sessions in ~/.zshrc.local,
this does cause problems when you need most of your shells in the
default locale and a few in another from time to time.

That is the case for 'iso-term' a script that changes utf8 parts of the
default environment to iso885915 and then calls an x11 terminal
emulator.

This change enables us to conditionally turn off sourcing the default
locale file by inserting ZSH_NO_DEFAULT_LOCALE=1 into the environment of
the calling process.

etc/zsh/zshrc

index 43dab29..e747fe2 100644 (file)
@@ -252,6 +252,7 @@ GRML_ZSH_CNF_HANDLER=${GRML_ZSH_CNF_HANDLER:-/usr/share/command-not-found/comman
 BATTERY=${BATTERY:-0}
 GRMLSMALL_SPECIFIC=${GRMLSMALL_SPECIFIC:-1}
 GRML_ALWAYS_LOAD_ALL=${GRML_ALWAYS_LOAD_ALL:-0}
+ZSH_NO_DEFAULT_LOCALE=${ZSH_NO_DEFAULT_LOCALE:-0}
 
 if isgrmlcd ; then
     GRML_WARN_SKEL=${GRML_WARN_SKEL:-0}
@@ -483,7 +484,9 @@ zrclocal() {
 #}}}
 
 # locale setup {{{
-xsource "/etc/default/locale"
+if (( ZSH_NO_DEFAULT_LOCALE == 0 )); then
+    xsource "/etc/default/locale"
+fi
 
 for var in LANG LC_ALL LC_MESSAGES ; do
     [[ -n ${(P)var} ]] && export $var