diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/locale.sh | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/locale.sh b/lib/locale.sh index 9b9ccbe..bbfdc63 100644 --- a/lib/locale.sh +++ b/lib/locale.sh @@ -27,6 +27,8 @@ TEXT_DOMAIN='pro_archman' load_locale() { + local localedir + # Make sure LC_MESSAGES is set. if [ "x${LC_MESSAGES+set}" != 'xset' ]; then if [ "x${LC_ALL+set}" = 'xset' ]; then @@ -38,10 +40,17 @@ load_locale() fi fi + if [ "${ARCHMAN_LOCALEDIR+set}" = 'set' ]; then + localedir="${ARCHMAN_LOCALEDIR:-.}" + else + localedir="${LOCALEDIR}" + fi + # Try to load the locale. - if ! _try_load_locale "${LC_MESSAGES%.*}"; then - if ! _try_load_locale "${LC_MESSAGES%_*}"; then - if ! _try_load_locale "${DEFAULT_LOCALE}"; then + if ! _try_load_locale "${localedir}" "${LC_MESSAGES%.*}"; then + if ! _try_load_locale "${localedir}" "${LC_MESSAGES%_*}"; then + if ! _try_load_locale "${localedir}" "${DEFAULT_LOCALE}" + then warn 'Cannot load locale' return 1 fi |