summaryrefslogtreecommitdiff
path: root/src/lib/librelib
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-09-11 10:19:02 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-09-11 15:43:36 -0400
commit8443cad920a59918069dbee3891b4b9595c528a3 (patch)
tree944abe452a5db85b045d422a39088bca7094a5cb /src/lib/librelib
parent4b9f4323abfaa0f4030cc29aed97e0716f9c5852 (diff)
librelib: Internationalize (actually use the internationalization stuff)
Diffstat (limited to 'src/lib/librelib')
-rwxr-xr-xsrc/lib/librelib30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/lib/librelib b/src/lib/librelib
index dc4969f..c5578a2 100755
--- a/src/lib/librelib
+++ b/src/lib/librelib
@@ -16,9 +16,18 @@
default_libdir=/usr/lib/libretools
+if ! type gettext &>/dev/null; then
+ gettext() { echo "$@"; }
+fi
+
print() {
- fmt=$1; shift
- printf -- "$fmt\n" "$@"
+ mesg=$1
+ shift
+ printf -- "$(gettext "$mesg")\n" "$@"
+}
+
+prose() {
+ print "$@" | fmt -su
}
cmd=${0##*/}
@@ -27,17 +36,16 @@ usage() {
print 'Usage: . $(%s LIBRARY)' "$cmd"
print "Finds a shell library file"
echo
- print "While some libraries can be sourced just by their name because"
- print "they are installed in PATH (like libremessages), some are not"
- print "installed there (like conf.sh), so a path must be given."
- print "Hardcoding that path is the way of the dark side."
+ prose "While some libraries can be sourced just by their name because
+ they are installed in PATH (like libremessages), some are not
+ installed there (like conf.sh), so a path must be given.
+ Hardcoding that path is the way of the dark side."
echo
- print "By default, it looks for the files in '%s'," "$default_libdir"
- print "but this can be changed with the environmental variable"
- print "LIBRETOOLS_LIBDIR."
+ prose 'By default, it looks for the files in `%s`, but this can be
+ changed with the environmental variable LIBRETOOLS_LIBDIR.' "$default_libdir"
echo
print "Example usage:"
- print ' . $(librelib conf.sh)'
+ printf ' . $(%s conf.sh)\n' "$cmd"
}
main() {
@@ -64,7 +72,7 @@ main() {
return 0;
fi
done
- printf 'librelib: could not find library `%s`\n' "$lib" >> /dev/stderr
+ print '%s: could not find library: %s' "$cmd" "$lib" >> /dev/stderr
return 1
}