From 3c96056f9f00fd448972339225fd28c1ec4bd546 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 11 Mar 2019 23:14:31 -0400 Subject: _ob_get_msg(): New internal function Use it in _ob_*_msg(). --- (limited to 'lib') diff --git a/lib/locale.sh b/lib/locale.sh index ae3c88c..b564f7f 100644 --- a/lib/locale.sh +++ b/lib/locale.sh @@ -142,3 +142,17 @@ ob_get_msg() return 0 } + +_ob_get_msg() +{ + local msgid="${1}" + shift 1 + local orig_text_domain= + + orig_text_domain="$(ob_get_text_domain)" + ob_set_text_domain "${_OB_INTERNAL_TEXT_DOMAIN}" + ob_get_msg "${msgid}" + ob_set_text_domain "${orig_text_domain}" + + return 0 +} diff --git a/lib/output.sh b/lib/output.sh index 0befca1..bc262e9 100644 --- a/lib/output.sh +++ b/lib/output.sh @@ -88,12 +88,8 @@ _ob_error_msg() { local msgid="${1}" shift 1 - local orig_text_domain= - orig_text_domain="$(ob_get_text_domain)" - ob_set_text_domain "${_OB_INTERNAL_TEXT_DOMAIN}" - ob_error "$(ob_get_msg "${msgid}")" "${@}" - ob_set_text_domain "${orig_text_domain}" + ob_error "$(_ob_get_msg "${msgid}")" "${@}" return 0 } @@ -102,12 +98,8 @@ _ob_warn_msg() { local msgid="${1}" shift 1 - local orig_text_domain= - orig_text_domain="$(ob_get_text_domain)" - ob_set_text_domain "${_OB_INTERNAL_TEXT_DOMAIN}" - ob_warn "$(ob_get_msg "${msgid}")" "${@}" - ob_set_text_domain "${orig_text_domain}" + ob_warn "$(_ob_get_msg "${msgid}")" "${@}" return 0 } @@ -116,12 +108,8 @@ _ob_info_msg() { local msgid="${1}" shift 1 - local orig_text_domain= - orig_text_domain="$(ob_get_text_domain)" - ob_set_text_domain "${_OB_INTERNAL_TEXT_DOMAIN}" - ob_info "$(ob_get_msg "${msgid}")" "${@}" - ob_set_text_domain "${orig_text_domain}" + ob_info "$(_ob_get_msg "${msgid}")" "${@}" return 0 } -- cgit v0.9.1