zsh: rewrite locale modification code
use a function to make it more readable and shorter
This commit is contained in:
parent
0c9d346602
commit
0afa2600f8
|
@ -82,15 +82,28 @@ if command -v virsh > /dev/null; then
|
||||||
export LIBVIRT_DEFAULT_URI="qemu:///system"
|
export LIBVIRT_DEFAULT_URI="qemu:///system"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use ISO 8601 date & time.
|
function _modify_locale() {
|
||||||
if [[ "${LC_TIME}" != "en_DK.utf8" ]] && command -v locale > /dev/null; then
|
local category=${1}
|
||||||
[[ "$(locale --all-locales)" == *en_DK* ]] && export LC_TIME="en_DK.utf8"
|
local value=${2}
|
||||||
fi
|
|
||||||
|
|
||||||
|
if command -v locale > /dev/null; then
|
||||||
|
if [[ "$(locale --all-locales)" == *${value}* ]]; then
|
||||||
|
export ${category}=${value}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Use ISO 8601 date & time.
|
||||||
|
_modify_locale LC_TIME en_DK.utf8
|
||||||
# Use english messages
|
# Use english messages
|
||||||
if [[ "${LC_MESSAGES}" != "en_US.utf8" ]] && command -v locale > /dev/null; then
|
_modify_locale LC_MESSAGES en_CA.utf8
|
||||||
[[ "$(locale --all-locales)" == *en_US* ]] && export LC_MESSAGES="en_US.utf8"
|
# Use german currency
|
||||||
fi
|
_modify_locale LC_MONETARY de_DE.utf8
|
||||||
|
# german paper sizes
|
||||||
|
_modify_locale LC_PAPER de_DE.utf8
|
||||||
|
|
||||||
|
unfunction _modify_locale
|
||||||
|
|
||||||
export CCACHE_DIR="/var/cache/ccache"
|
export CCACHE_DIR="/var/cache/ccache"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user