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 /internal/icons.zsh | |
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 'internal/icons.zsh')
-rwxr-xr-x | internal/icons.zsh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/icons.zsh b/internal/icons.zsh index 55d1b33e..2b47339d 100755 --- a/internal/icons.zsh +++ b/internal/icons.zsh @@ -3,6 +3,10 @@ typeset -gA icons function _p9k_init_icons() { [[ $+_p9k_icon_mode == 1 && $_p9k_icon_mode == $POWERLEVEL9K_MODE ]] && return typeset -g _p9k_icon_mode=$POWERLEVEL9K_MODE + typeset -g _p9k_locale=${LC_ALL:-$LANG} + if [[ $_p9k_locale != *.(utf|UTF)(-|)8 ]]; then + _p9k_locale=${${(@M)$(locale -a):#*.(utf|UTF)(-|)8}[1]:-en_US.UTF-8} + fi case $POWERLEVEL9K_MODE in 'flat'|'awesome-patched') @@ -521,6 +525,7 @@ function _p9k_init_icons() { function print_icon() { emulate -L zsh && setopt no_hist_expand extended_glob no_prompt_bang prompt_{cr,percent,subst,sp} _p9k_init_icons + local LC_ALL=$_p9k_locale local icon_name=$1 local var_name=POWERLEVEL9K_${icon_name} if [[ -n "${(tP)var_name}" ]]; then @@ -538,6 +543,7 @@ function print_icon() { function get_icon_names() { emulate -L zsh && setopt no_hist_expand extended_glob no_prompt_bang prompt_{cr,percent,subst,sp} _p9k_init_icons + local LC_ALL=$_p9k_locale # Iterate over a ordered list of keys of the icons array for key in ${(@kon)icons}; do echo -n "POWERLEVEL9K_$key: " |