summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/locale.sh37
1 files changed, 19 insertions, 18 deletions
diff --git a/lib/locale.sh b/lib/locale.sh
index 833c487..2bde6e0 100644
--- a/lib/locale.sh
+++ b/lib/locale.sh
@@ -28,20 +28,24 @@ _OB_LOCALE_PATH='@@LOCALEDIR@@/%s/LC_MESSAGES/%s.ms'
ob_get_text_domain()
{
+ _ob_local
+
if [ ${#} -ne 0 ]; then
- return 125
+ return $(_ob_return 125)
fi
echo "${_OB_TEXT_DOMAIN}"
- return 0
+ return $(_ob_return 0)
}
ob_set_text_domain()
{
+ _ob_local
+
if [ ${#} -eq 1 ]; then
_OB_TEXT_DOMAIN="${1}"
else
- return 125
+ return $(_ob_return 125)
fi
# Make sure LC_MESSAGES is set.
@@ -63,49 +67,48 @@ ob_set_text_domain()
if ! _ob_try_load_messages "${_OB_DEFAULT_LOCALE}"; then
ob_warn 'Cannot load messages in "%s" domain.' \
"${_OB_TEXT_DOMAIN}"
- return 1
+ return $(_ob_return 1)
fi
fi
fi
- return 0
+ return $(_ob_return 0)
}
ob_set_locale_path()
{
- _obslp_format=
+ _ob_local _obslp_format
if [ ${#} -eq 1 ]; then
_obslp_format="${1}"
else
- unset _obslp_format
- return 125
+ return $(_ob_return 125)
fi
_OB_LOCALE_PATH="${_obslp_format}"
- unset _obslp_format
- return 0
+ return $(_ob_return 0)
}
ob_get_msg()
{
- _obgm_msgid=
+ _ob_local _obgm_msgid
if [ ${#} -eq 1 ]; then
_obgm_msgid="${1}"
else
- unset _obgm_msgid
- return 125
+ return $(_ob_return 125)
fi
IFS= eval echo "\$\{msg_${_OB_TEXT_DOMAIN}_${_obgm_msgid}\}"
- return 0
+ return $(_ob_return 0)
}
_ob_try_load_messages()
{
+ _ob_local _obtlm_locale _obtlm_ms
+
_obtlm_locale="${1}"
_obtlm_ms="$(printf "${_OB_LOCALE_PATH}" \
"${_obtlm_locale}" "${_OB_TEXT_DOMAIN}")"
@@ -113,10 +116,8 @@ _ob_try_load_messages()
if [ -f "${_obtlm_ms}" ]; then
. "${_obtlm_ms}"
else
- unset _obtlm_locale _obtlm_ms
- return 1
+ return $(_ob_return 1)
fi
- unset _obtlm_locale _obtlm_ms
- return 0
+ return $(_ob_return 0)
}