summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2013-07-12 14:39:40 (EDT)
committer P. J. McDermott <pjm@nac.net>2013-07-12 14:39:40 (EDT)
commit23a067a9e53aaef24f1800e65f7ceba04bd8e68f (patch)
tree252c44e9830f1cf219011ce3f23e94d0e90bd49c
parent57272bc27bed84b9426c21e7e76af6bf392cb9e6 (diff)
Make locale dir configurable at run time.
-rw-r--r--lib/locale.sh15
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