Signed-off-by: Gordian Edenhofer <gordian.edenhofer@gmail.com> --- contrib/pacscripts.sh.in | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/contrib/pacscripts.sh.in b/contrib/pacscripts.sh.in index 4a1e0c5..0c5e926 100644 --- a/contrib/pacscripts.sh.in +++ b/contrib/pacscripts.sh.in @@ -27,6 +27,17 @@ set -o errexit declare -r myname='pacscripts' declare -r myver='@PACKAGE_VERSION@' +# gettext initialization +export TEXTDOMAIN='pacman' +export TEXTDOMAINDIR='@localedir@' + +# Determine whether we have gettext; make it a no-op if we do not +if ! type -p gettext >/dev/null; then + gettext() { + printf "%s\n" "$@" + } +fi + conf="@sysconfdir@/pacman.conf" if [ ! -r "$conf" ]; then @@ -45,18 +56,22 @@ error() { } usage() { - echo "${myname} (pacman) v${myver}" + printf "%s (pacman) %s\n" "$myname" "$myver" + echo + printf -- "$(gettext "Prints the {pre,post}_{install,remove,upgrade} scripts of a given package")\n" echo - echo "Prints the {pre,post}_{install,remove,upgrade} scripts of a given package." + printf -- "$(gettext "Usage: %s <pkgname|pkgfile>")\n" "$0" echo - echo "Usage: ${myname} <pkgname|pkgfile>" + printf -- "$(gettext "Options:")\n" + printf -- " -h, --help " + printf -- "$(gettext "Print this help message")\n" + printf -- " -v, --version " + printf -- "$(gettext "Print program name and version")\n" echo - echo " Options:" - echo " -h, --help Print this help message" - echo " -v, --version Print program name and version" + printf -- "$(gettext "Examples:")" + printf -- " %s gconf-editor\n" "$myname" + printf -- " %s gconf-editor-3.0.1-3-x86_64.pkg.tar.xz\n" "$myname" echo - echo "Example: ${myname} gconf-editor" - echo "Example: ${myname} gconf-editor-3.0.1-3-x86_64.pkg.tar.xz" } version() { -- 2.10.0