From 23a067a9e53aaef24f1800e65f7ceba04bd8e68f Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 12 Jul 2013 14:39:40 -0400 Subject: Make locale dir configurable at run time. --- 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 -- cgit v0.9.1