summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2013-07-12 14:51:02 (EDT)
committer P. J. McDermott <pjm@nac.net>2013-07-12 14:51:02 (EDT)
commit0bfe781486acca9271ef85800ba6f15120a84f7d (patch)
treece5087e20330010308d66ed03f9c2c1d69196d9e /lib
parent23a067a9e53aaef24f1800e65f7ceba04bd8e68f (diff)
Fix run time locale dir configuration.
Diffstat (limited to 'lib')
-rw-r--r--lib/locale.sh19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/locale.sh b/lib/locale.sh
index bbfdc63..8baf235 100644
--- a/lib/locale.sh
+++ b/lib/locale.sh
@@ -27,7 +27,7 @@ TEXT_DOMAIN='pro_archman'
load_locale()
{
- local localedir
+ local localedir localepath
# Make sure LC_MESSAGES is set.
if [ "x${LC_MESSAGES+set}" != 'xset' ]; then
@@ -42,15 +42,19 @@ load_locale()
if [ "${ARCHMAN_LOCALEDIR+set}" = 'set' ]; then
localedir="${ARCHMAN_LOCALEDIR:-.}"
+ localepath='%s/%s/%s.ms'
else
localedir="${LOCALEDIR}"
+ localepath="${LOCALE_PATH}"
fi
# Try to load the locale.
- if ! _try_load_locale "${localedir}" "${LC_MESSAGES%.*}"; then
- if ! _try_load_locale "${localedir}" "${LC_MESSAGES%_*}"; then
- if ! _try_load_locale "${localedir}" "${DEFAULT_LOCALE}"
- then
+ if ! _try_load_locale "${localedir}" "${localepath}" \
+ "${LC_MESSAGES%.*}"; then
+ if ! _try_load_locale "${localedir}" "${localepath}" \
+ "${LC_MESSAGES%_*}"; then
+ if ! _try_load_locale "${localedir}" "${localepath}" \
+ "${DEFAULT_LOCALE}"; then
warn 'Cannot load locale'
return 1
fi
@@ -72,10 +76,11 @@ get_msg()
_try_load_locale()
{
local localedir="${1}"
- local locale="${2}"
+ local localepath="${2}"
+ local locale="${3}"
local ms
- ms="$(printf "${LOCALE_PATH}" \
+ ms="$(printf "${localepath}" \
"${localedir}" "${locale}" "${TEXT_DOMAIN}")"
if [ -f "${ms}" ]; then