summaryrefslogtreecommitdiff
path: root/src/lib/librelib
diff options
context:
space:
mode:
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
}