summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick 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)
commit1f812448dfcc22a4eae00ee9e1f839e8cca759a2 (patch)
treeb5b87375d64673eefe56248ee9b91de684acfbc9
parent5032fd43cfa0585e8b3f0fca94a7bc50832fc5bc (diff)
ob_error(), ob_warn(), ob_info(): Internationalize
-rw-r--r--TODO1
-rw-r--r--lib/output.sh6
-rw-r--r--locale/en_US/libopkbuild_2.sh5
3 files changed, 8 insertions, 4 deletions
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 <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"'