[pacman-dev] [PATCH] Fixed gettext support in abs

Giovanni Scafora linuxmania at gmail.com
Mon Apr 2 11:27:16 EDT 2007


Fixed gettext support to abs after Andrew's email

Signed-off-by: Giovanni Scafora <linuxmania at gmail.com>

diff --git a/scripts/abs b/scripts/abs
index 2ec4322..315ece3 100755
--- a/scripts/abs
+++ b/scripts/abs
@@ -1,5 +1,13 @@
 #!/bin/bash

+# gettext initialization"
+source gettext.sh
+
+TEXTDOMAIN=abs
+export TEXTDOMAIN
+TEXTDOMAINDIR='@localedir@'
+export TEXTDOMAINDIR
+
 CONFDIR="/etc/abs"
 CONNMODE="m"

@@ -9,14 +17,15 @@ CONNMODE="m"
 [ -f ~/.abs.conf ] && source ~/.abs.conf

 usage() {
-	echo "Arch Build System -- synchronization utility"
-	echo "usage: $0 [-p] [repository1 [repository2 ...]]"
+	echo "$(gettext "Arch Build System -- synchronization utility")"
+	local msg=$0; shift
+	printf "$(gettext "usage: \$msg [-p] [repository1 [repository2 ...]]")" $*
 	echo
-	echo "abs will synchronize PKGBUILD scripts from the CVS repository"
-	echo "into $ABSROOT.  You can follow different package trees by"
-	echo "editing /etc/abs/supfile.* files.  If no argument is given, abs "
-	echo "will synchronize from supfiles specified in /etc/abs/abs.conf."
-	echo "If -p is specified, the connection is opened in passive mode."
+	echo "$(gettext "abs will synchronize PKGBUILD scripts from the CVS
repository")"
+	echo "$(gettext "into %s.  You can follow different package trees
by")" $ABSROOT
+	echo "$(gettext "editing /etc/abs/supfile.* files.  If no argument
is given, abs ")"
+	echo "$(gettext "will synchronize from supfiles specified in
/etc/abs/abs.conf.")"
+	echo "$(gettext "If -p is specified, the connection is opened in
passive mode.")"
 }

 update() {
@@ -43,11 +52,11 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
 fi

 if [ ! -d "$ABSROOT" ]; then
-	echo "abs: $ABSROOT does not exist (or is not a directory)"
+	echo "$(gettext "abs: %s does not exist (or is not a directory)")" $ABSROOT
 	exit 1
 fi
 if [ ! -w "$ABSROOT" ]; then
-	echo "abs: no write permissions in $ABSROOT"
+	echo "$(gettext "abs: no write permissions in %s")" $ABSROOT
 	exit 1
 fi

@@ -56,7 +65,7 @@ if [ "$(type -p cvsup)" ]; then
 elif [ "$(type -p csup)" ]; then
 	CVSUP="csup"
 else
-	echo "abs: missing CVS synchronization utility.  Install cvsup or csup."
+	echo "$(gettext "abs: missing CVS synchronization utility.  Install
cvsup or csup.")"
 	exit 1
 fi

-- 
1.5.0.6



-- 
Giovanni Scafora
Arch Linux Trusted User (voidnull)
http://www.archlinux.org
linuxmania at gmail.com




More information about the pacman-dev mailing list