From 3f50e53b7460f4a779a30b1f21110ccab281d050 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Sun, 12 Mar 2017 17:08:05 +0100 Subject: [PATCH] 12_locale: Detect and revert auto-correction of LC_* variables 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/core/12_locale/12_locale.zprofile b/core/12_locale/12_locale.zprofile index e6256ee..6d7e40f 100644 --- a/core/12_locale/12_locale.zprofile +++ b/core/12_locale/12_locale.zprofile @@ -9,6 +9,7 @@ # 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' ]] \ -- 2.39.2