diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-03-12 00:59:39 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-03-12 00:59:39 (EDT) |
commit | 1f812448dfcc22a4eae00ee9e1f839e8cca759a2 (patch) | |
tree | b5b87375d64673eefe56248ee9b91de684acfbc9 | |
parent | 5032fd43cfa0585e8b3f0fca94a7bc50832fc5bc (diff) |
ob_error(), ob_warn(), ob_info(): Internationalize
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | lib/output.sh | 6 | ||||
-rw-r--r-- | locale/en_US/libopkbuild_2.sh | 5 |
3 files changed, 8 insertions, 4 deletions
@@ -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 <http://www.gnu.org/licenses/>. +# 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"' |