From: Alexander Barton Date: Sun, 12 Mar 2017 16:01:38 +0000 (+0100) Subject: 12_locale: Only Linux seems to lowercase & transform the encoding X-Git-Url: https://arthur.barton.de/gitweb/?p=ax-zsh.git;a=commitdiff_plain;h=7c30c44cfe91f64624352da58a330623fa0af3bc;ds=sidebyside 12_locale: Only Linux seems to lowercase & transform the encoding At least macOS and FreeBSD use the "raw" form. But note that Linux uses the raw from as well for the "C.UTF-8" locale and not the transformed "C.utf8", so add an exception for this case. --- diff --git a/core/12_locale/12_locale.zprofile b/core/12_locale/12_locale.zprofile index 04d8a2a..e6256ee 100644 --- a/core/12_locale/12_locale.zprofile +++ b/core/12_locale/12_locale.zprofile @@ -11,7 +11,9 @@ while true; do lc_messages=$(locale 2>/dev/null | fgrep LC_MESSAGES | cut -d'=' -f2) lc_messages=$lc_messages:gs/\"// locale=$lc_messages:r - encoding=$lc_messages:e:l:gs/-// + [[ "$OSTYPE" = 'linux-gnu' && $locale != 'C' ]] \ + && encoding=$lc_messages:e:l:gs/-// \ + || encoding=$lc_messages:e [[ -n "$encoding" ]] && locale="$locale.$encoding" [[ -z "$LANG$LANGUAGE$LC_ALL$LC_MESSAGES" ]] && unset lc_messages