From 7f62d865ae7384f4c4bd489e2682ba52fabb7b62 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 11 Sep 2013 10:52:43 -0400 Subject: chroot-tools: internationalize --- src/chroot-tools/distcc-tool | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'src/chroot-tools/distcc-tool') diff --git a/src/chroot-tools/distcc-tool b/src/chroot-tools/distcc-tool index 3f7a30f..67bcd2d 100755 --- a/src/chroot-tools/distcc-tool +++ b/src/chroot-tools/distcc-tool @@ -28,35 +28,45 @@ # On Parabola, this means the packages: # bash, coreutils, sed, socat +if ! type gettext &>/dev/null; then + gettext() { echo "$@"; } +fi + panic() { - echo 'panic: malformed call to internal function' >&2 + echo "$(gettext 'panic: malformed call to internal function')" >&2 exit 1 } error() { - fmt=$1; shift - printf "ERROR: $fmt\n" "$@" >&2 + mesg="$(gettext "$1")"; shift + printf "$(gettext 'ERROR:') $mesg\n" "$@" >&2 exit 1 } +print() { + local mesg=$1 + shift + printf -- "$(gettext "$mesg")\n" "$@" +} + usage() { - echo "Usage: $0 COMMAND [COMMAND-ARGS]" - echo "Tool for using distcc within a networkless chroot" + print "Usage: $0 COMMAND [COMMAND-ARGS]" + print "Tool for using distcc within a networkless chroot" echo - echo "Commands:" - echo ' help print this message' - echo ' odaemon CHROOTPATH daemon to run outside of the chroot' - echo ' idaemon DISTCC_HOSTS daemon to run inside of the chroot' - echo ' rewrite DISTCC_HOSTS prints a rewritten version of DISTCC_HOSTS' - echo ' client HOST PORT connects stdio to TCP:$HOST:$PORT' - echo 'Commands: for internal use' - echo ' server counterpart to client; spawned by odaemon' + print "Commands:" + print ' help print this message' + print ' odaemon CHROOTPATH daemon to run outside of the chroot' + print ' idaemon DISTCC_HOSTS daemon to run inside of the chroot' + print ' rewrite DISTCC_HOSTS prints a rewritten version of DISTCC_HOSTS' + print ' client HOST PORT connects stdio to TCP:$HOST:$PORT' + print 'Commands: for internal use' + print ' server counterpart to client; spawned by odaemon' } errusage() { if [[ $# -gt 0 ]]; then - fmt=$1; shift - printf "ERROR: $fmt\n" "$@" >&2 + fmt="$(gettext "$1")"; shift + printf "$(gettext 'ERROR:') $fmt\n" "$@" >&2 fi usage >&2 exit 1 @@ -125,7 +135,7 @@ parse_DISTCC_HOSTS() { ;; # ZEROCONF +zeroconf) - error "$0 does not support the +zeroconf option" + error "%s does not support the +zeroconf option" "$0" exit 1 ;; # TCP_HOST or OLDSTYLE_TCP_HOST -- cgit v1.2.3-54-g00ecf