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

Giovanni Scafora linuxmania at gmail.com
Mon Apr 2 12:43:57 EDT 2007


Let's me know if it's corrext.

Fixed gettext support to makeworld after Andrew's email.

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

diff --git a/scripts/makeworld b/scripts/makeworld
index b9d318c..3a8d136 100755
--- a/scripts/makeworld
+++ b/scripts/makeworld
@@ -20,37 +20,46 @@
 #   USA.
 #

+# gettext initialization"
+source gettext.sh
+
+TEXTDOMAIN=makeworld
+export TEXTDOMAIN
+TEXTDOMAINDIR='@localedir@'
+export TEXTDOMAINDIR
+
 version="3.0.0"
 toplevel=$(pwd)

 usage() {
-	echo "makeworld version $version"
-	echo "usage: $0 [options] <destdir> <category> [category] ..."
-	echo "options:"
-	echo "  -b, --builddeps  Build missing dependencies from source"
-	echo "  -B, --noccache   Do not use ccache during build"
-	echo "  -c, --clean      Clean up work files after build"
-	echo "  -C, --cleancache Clean up source files from the cache"
-	echo "  -d, --nodeps     Skip all dependency checks"
-	echo "  -e, --noextract  Do not extract source files (use existing src/ dir)"
-	echo "  -f, --force      Overwrite existing packages"
-	echo "  -i, --install    Install package after successful build"
-	echo "  -m, --nocolor    Disable colorized output messages"
-	echo "  -h, --help       This help"
-	echo "  -o, --nobuild    Download and extract files only"
-	echo "  -r, --rmdeps     Remove installed dependencies after a
successful build"
-	echo "  -s, --syncdeps   Install missing dependencies with pacman"
-	echo "  -S, --usesudo    Use sudo when running pacman commands"
+	echo "$(gettext "makeworld version %s")" $version
+	local msg=$0; shift
+	printf "$(gettext "usage: \$msg [options] <destdir> <category>
[category] ...")" $*
+	echo "$(gettext "options:")"
+	echo "$(gettext "  -b, --builddeps  Build missing dependencies from source")"
+	echo "$(gettext "  -B, --noccache   Do not use ccache during build")"
+	echo "$(gettext "  -c, --clean      Clean up work files after build")"
+	echo "$(gettext "  -C, --cleancache Clean up source files from the cache")"
+	echo "$(gettext "  -d, --nodeps     Skip all dependency checks")"
+	echo "$(gettext "  -e, --noextract  Do not extract source files (use
existing src/ dir)")"
+	echo "$(gettext "  -f, --force      Overwrite existing packages")"
+	echo "$(gettext "  -i, --install    Install package after successful build")"
+	echo "$(gettext "  -m, --nocolor    Disable colorized output messages")"
+	echo "$(gettext "  -h, --help       This help")"
+	echo "$(gettext "  -o, --nobuild    Download and extract files only")"
+	echo "$(gettext "  -r, --rmdeps     Remove installed dependencies
after a successful build")"
+	echo "$(gettext "  -s, --syncdeps   Install missing dependencies
with pacman")"
+	echo "$(gettext "  -S, --usesudo    Use sudo when running pacman commands")"
 	echo
-	echo "These options can be passed to pacman:"
+	echo "$(gettext "These options can be passed to pacman:")"
 	echo
-	echo "  --noconfirm      Do not ask for confirmation when resolving
dependencies"
-	echo "  --noprogressbar  Do not show a progress bar when downloading files"
+	echo "$(gettext "  --noconfirm      Do not ask for confirmation when
resolving dependencies")"
+	echo "$(gettext "  --noprogressbar  Do not show a progress bar when
downloading files")"
 	echo
-	echo "Where <category> is one or more directory names under the ABS root"
-	echo "eg: makeworld -c /packages base lib editors"
+	echo "$(gettext "Where <category> is one or more directory names
under the ABS root")"
+	echo "$(gettext "eg: makeworld -c /packages base lib editors")"
 	echo
-	echo "This should be run from the toplevel directory of ABS (usually
/var/abs)"
+	echo "$(gettext "This should be run from the toplevel directory of
ABS (usually /var/abs)")"
 }

 if [ $# -lt 2 ]; then
@@ -154,18 +163,18 @@ for category in $*; do
 			d=$(date +"[%b %d %H:%M]")
 			echo -n "$d  " >>$toplevel/build.log
 			case $buildstatus in
-				0) echo "$pkgname already built -- skipping" >>$toplevel/build.log ;;
-				1) echo "$pkgname was built successfully" >>$toplevel/build.log ;;
-				2) echo "$pkgname build failed" >>$toplevel/build.log ;;
+				0) echo "$(gettext "%s already built -- skipping")" $pkgname
>>$toplevel/build.log ;;
+				1) echo "$(gettext "%s was built successfully")" $pkgname
>>$toplevel/build.log ;;
+				2) echo "$(gettext "%s build failed")" $pkgname >>$toplevel/build.log ;;
 			esac
 		fi
 	done
 done
 ed=$(date +"[%b %d %H:%M]")

-echo "makeworld complete." >>$toplevel/build.log
-echo "  started:  $sd" >>$toplevel/build.log
-echo "  finished: $ed" >>$toplevel/build.log
+echo "$(gettext "makeworld complete.")" >>$toplevel/build.log
+echo "$(gettext "  started:  %s")" $sd >>$toplevel/build.log
+echo "$(gettext "  finished: %s")" $ed >>$toplevel/build.log

 exit 0

-- 
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