diff options
-rw-r--r-- | lib/locale.sh | 62 |
1 files changed, 24 insertions, 38 deletions
diff --git a/lib/locale.sh b/lib/locale.sh index 1cb1111..4d519a3 100644 --- a/lib/locale.sh +++ b/lib/locale.sh @@ -29,27 +29,20 @@ _OB_LOCALE_PATH='@@LOCALEDIR@@/%s/LC_MESSAGES/%s.ms' ob_get_text_domain() { - _ob_local - if [ ${#} -ne 0 ]; then - _ob_return 125 - return ${?} + return 125 fi echo "${_OB_TEXT_DOMAIN}" - _ob_return 0 - return ${?} + return 0 } ob_set_text_domain() { - _ob_local - if [ ${#} -eq 1 ]; then _OB_TEXT_DOMAIN="${1}" else - _ob_return 125 - return ${?} + return 125 fi # Make sure LC_MESSAGES is set. @@ -71,65 +64,58 @@ ob_set_text_domain() if ! _ob_try_load_messages "${_OB_DEFAULT_LOCALE}"; then ob_warn 'Cannot load messages in "%s" domain.' \ "${_OB_TEXT_DOMAIN}" - _ob_return 1 - return ${?} + return 1 fi fi fi - _ob_return 0 - return ${?} + return 0 } ob_set_locale_path() { - _ob_local _obslp_format + local format= if [ ${#} -eq 1 ]; then - _obslp_format="${1}" + format="${1}" else - _ob_return 125 - return ${?} + return 125 fi - _OB_LOCALE_PATH="${_obslp_format}" + _OB_LOCALE_PATH="${format}" - _ob_return 0 - return ${?} + return 0 } ob_get_msg() { - _ob_local _obgm_msgid + local msgid= if [ ${#} -eq 1 ]; then - _obgm_msgid="${1}" + msgid="${1}" else - _ob_return 125 - return ${?} + return 125 fi - IFS= eval echo \$\{"msg_${_OB_TEXT_DOMAIN}_${_obgm_msgid}"\} + IFS= eval echo \$\{"msg_${_OB_TEXT_DOMAIN}_${msgid}"\} - _ob_return 0 - return ${?} + return 0 } _ob_try_load_messages() { - _ob_local _obtlm_locale _obtlm_ms + local locale= + local ms= - _obtlm_locale="${1}" - _obtlm_ms="$(printf "${_OB_LOCALE_PATH}" \ - "${_obtlm_locale}" "${_OB_TEXT_DOMAIN}")" + locale="${1}" + ms="$(printf "${_OB_LOCALE_PATH}" \ + "${locale}" "${_OB_TEXT_DOMAIN}")" - if [ -f "${_obtlm_ms}" ]; then - . "${_obtlm_ms}" + if [ -f "${ms}" ]; then + . "${ms}" else - _ob_return 1 - return ${?} + return 1 fi - _ob_return 0 - return ${?} + return 0 } |