diff options
author | romkatv <roman.perepelitsa@gmail.com> | 2019-08-17 10:22:31 +0300 |
---|---|---|
committer | romkatv <roman.perepelitsa@gmail.com> | 2019-08-17 10:22:31 +0300 |
commit | 33e1dd77908c0ae9a12b07b8e88f4ae16a9e53bd (patch) | |
tree | 0986539021fa4045bb1cfdc001a63e88b42141c8 /config | |
parent | 96ba1b6f7d54b455c008b61318c97ec0965b0033 (diff) |
Try harder when running on a system with incorrectly configured locale.
ZSH will still be broken when locale is misconfigured but at least p10k
will work so users will look for help elsewhere.
Fixes #173.
Diffstat (limited to 'config')
-rw-r--r-- | config/p10k-classic.zsh | 4 | ||||
-rw-r--r-- | config/p10k-lean.zsh | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index affca816..7d73e965 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -16,7 +16,9 @@ fi () { emulate -L zsh setopt no_unset - local LC_ALL=C.UTF-8 + if [[ ${LC_ALL:-${LANG:-}} != *.(utf|UTF)(-|)8 ]]; then + local LC_ALL=${${(@M)$(locale -a):#*.(utf|UTF)(-|)8}[1]:-en_US.UTF-8} + fi # Unset all configuration options. This allows you to apply configiguration changes without # restarting zsh. Edit ~/.p10k.zsh and type `source ~/.p10k.zsh`. diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index 5b4183ff..2a9f8f2a 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -16,7 +16,9 @@ fi () { emulate -L zsh setopt no_unset - local LC_ALL=C.UTF-8 + if [[ ${LC_ALL:-${LANG:-}} != *.(utf|UTF)(-|)8 ]]; then + local LC_ALL=${${(@M)$(locale -a):#*.(utf|UTF)(-|)8}[1]:-en_US.UTF-8} + fi # Unset all configuration options. This allows you to apply configiguration changes without # restarting zsh. Edit ~/.p10k.zsh and type `source ~/.p10k.zsh`. |