]> arthur.barton.de Git - ax-zsh.git/commitdiff
12_locale: Only Linux seems to lowercase & transform the encoding
authorAlexander Barton <alex@barton.de>
Sun, 12 Mar 2017 16:01:38 +0000 (17:01 +0100)
committerAlexander Barton <alex@barton.de>
Sun, 12 Mar 2017 16:01:38 +0000 (17:01 +0100)
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.

core/12_locale/12_locale.zprofile

index 04d8a2a8ef9fec34afe236c30bfac32f7335e242..e6256eeba610a72c05205a4092431900a54cc71f 100644 (file)
@@ -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