From 1f812448dfcc22a4eae00ee9e1f839e8cca759a2 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Tue, 12 Mar 2019 00:59:39 -0400 Subject: ob_error(), ob_warn(), ob_info(): Internationalize --- diff --git a/TODO b/TODO index 7114f44..cf846bf 100644 --- a/TODO +++ b/TODO @@ -42,7 +42,6 @@ Tasks * `src:foo` is the whole package. * Upload everything always. * Drop mksysconf. - * Internationalize "Error:" and "Warning:" in `ob_error()` and `ob_warn()`. * In executables, print error (using `printf`) and exit if `ob_set_text_domain()` fails. * Make `set -e` and drop `return 125` from library functions. `shift` diff --git a/lib/output.sh b/lib/output.sh index bd56715..cde8cef 100644 --- a/lib/output.sh +++ b/lib/output.sh @@ -34,7 +34,7 @@ ob_error() local format="${1}" shift 1 - printf '%s: Error: %s\n' "${0##*/}" "${@}" >&2 + printf "$(_get_msg 'output_error_format')\n" "${0##*/}" "${@}" >&2 exit 1 } @@ -54,7 +54,7 @@ ob_warn() local format="${1}" shift 1 - printf '%s: Warning: %s\n' "${0##*/}" "${@}" >&2 + printf "$(_get_msg 'output_warning_format')\n" "${0##*/}" "${@}" >&2 return 0 } @@ -74,7 +74,7 @@ ob_info() local format="${1}" shift 1 - printf '%s: %s\n' "${0##*/}" "${@}" >&2 + printf "$(_get_msg 'output_info_format')\n" "${0##*/}" "${@}" >&2 return 0 } diff --git a/locale/en_US/libopkbuild_2.sh b/locale/en_US/libopkbuild_2.sh index f4ae464..7d847f2 100644 --- a/locale/en_US/libopkbuild_2.sh +++ b/locale/en_US/libopkbuild_2.sh @@ -17,6 +17,11 @@ # You should have received a copy of the GNU General Public License # along with opkbuild. If not, see . +# lib/output.sh +msg_libopkbuild_2_output_error_format='%s: Error: %s' +msg_libopkbuild_2_output_warning_format='%s: Warning: %s' +msg_libopkbuild_2_output_info_format='%s: %s' + # lib/package.sh msg_libopkbuild_2_unable_to_detect_package_format='Unable to detect package format' msg_libopkbuild_2_bad_binary_name='Bad binary package name: "%s"' -- cgit v0.9.1