On Wed, Jun 02, 1999 at 12:37:09PM +0100, Julian Gilbey wrote: > Or use the incantation: > if command -v gettext; then echo=gettext; else echo=echo; fi > and use $echo in place of echo everywhere. Hm. I wrote this: >>>> i18n_sh start #!/bin/sh xecho () { if command -v gettext >/dev/null 2>&1; then TEXTDOMAIN=$TEXTDOMAIN gettext -s "$*" elif [ -n "$BASH" ]; then echo $"$*" else echo $* fi } TEXTDOMAIN=textutils xecho missing list of positions >>>> i18n_sh end So, something like this at the top of shell scripts ought to work and automatically detect gettext/bash as necessary. Of course, it relies on having the gettext binary installed to be useful for non-bash shells. I've tried it. I can't get the $"..." syntax to do anything though, YMMV :} It works fine if I run it with ash too. SRH -- Steve Haslam Debian GNU/Linux araqnid@debian.org orbit, gnome-libs, gnome-core, gnome-control-center, gdm, p3nfs, theme-convertors, device3dfx. what, me worry?
Attachment:
pgpJnBKPnh9It.pgp
Description: PGP signature