]> arthur.barton.de Git - ax-zsh.git/commitdiff
12_locale: Detect and revert auto-correction of LC_* variables
authorAlexander Barton <alex@barton.de>
Sun, 12 Mar 2017 16:08:05 +0000 (17:08 +0100)
committerAlexander Barton <alex@barton.de>
Sun, 12 Mar 2017 16:08:37 +0000 (17:08 +0100)
Some systems (tested with macOS 10.12) auto-correct the output of LC_xxx
variables when using the locale(1) tool and the locale isn't supported:

  $ LANG=de locale
  LC_MESSAGES="de"

vs.

  $ LANG=de locale
  LC_MESSAGES="C"

So try to detect and revert this.

core/12_locale/12_locale.zprofile

index e6256eeba610a72c05205a4092431900a54cc71f..6d7e40f4f9995e20371f9b9d4805b4662fbdf673 100644 (file)
@@ -9,6 +9,7 @@
 # tset(1) behaviour.
 while true; do
        lc_messages=$(locale 2>/dev/null | fgrep LC_MESSAGES | cut -d'=' -f2)
 # tset(1) behaviour.
 while true; do
        lc_messages=$(locale 2>/dev/null | fgrep LC_MESSAGES | cut -d'=' -f2)
+       [[ "$lc_messages" = '"C"' && "$LANG" != 'C' && "$LC_ALL" != 'C' ]] && lc_messages=$LANG
        lc_messages=$lc_messages:gs/\"//
        locale=$lc_messages:r
        [[ "$OSTYPE" = 'linux-gnu' && $locale != 'C' ]] \
        lc_messages=$lc_messages:gs/\"//
        locale=$lc_messages:r
        [[ "$OSTYPE" = 'linux-gnu' && $locale != 'C' ]] \