1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-18 13:41:56 +00:00

Now printing a warning if $LANG is set incorrectly.

This commit is contained in:
Ben Hilburn 2016-07-07 13:51:26 -04:00
parent 1c9ec53d58
commit 4666bd49e6

View file

@ -1052,13 +1052,23 @@ powerlevel9k_init() {
# Display a warning if the terminal does not support 256 colors
local term_colors
term_colors=$(echotc Co)
if (( term_colors < 256 )); then
if (( $term_colors < 256 )); then
print -P "%F{red}WARNING!%f Your terminal appears to support less than 256 colors!"
print -P "If your terminal supports 256 colors, please export the appropriate environment variable"
print -P "_before_ loading this theme in your \~\/.zshrc. In most terminal emulators, putting"
print -P "%F{blue}export TERM=\"xterm-256color\"%f at the top of your \~\/.zshrc is sufficient."
fi
# If the terminal `LANG` is set to `C`, this theme will not work at all.
local term_lang
term_lang=$(echo $LANG)
if [[ $term_lang == 'C' ]]; then
print -P "\t%F{red}WARNING!%f Your terminal's 'LANG' is set to 'C', which breaks this theme!"
print -P "\t%F{red}WARNING!%f Please set your 'LANG' to a UTF-8 language, like 'en_US.UTF-8'"
print -P "\t%F{red}WARNING!%f _before_ loading this theme in your \~\.zshrc. Putting"
print -P "\t%F{red}WARNING!%f %F{blue}export LANG=\"en_US.UTF-8\"%f at the top of your \~\/.zshrc is sufficient."
fi
# Display a warning if deprecated segments are in use.
typeset -AH deprecated_segments
# old => new