diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/locale.sh | 19 |
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 |