[pacman-dev] [PATCH] Gettext support in makeworld

Giovanni Scafora linuxmania at gmail.com
Mon Apr 2 10:08:55 EDT 2007


Add gettext support to makeworld.

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

diff --git a/scripts/makeworld b/scripts/makeworld
index b9d318c..b387c8a 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 "$(eval_gettext "makeworld version \$version")"
+	makeworld=$0
+	echo "$(eval_gettext "usage: \$makeworld [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 "$(eval_gettext "\$pkgname already built -- skipping")"
>>$toplevel/build.log ;;
+				1) echo "$(eval_gettext "\$pkgname was built successfully")"
>>$toplevel/build.log ;;
+				2) echo "$(eval_gettext "\$pkgname build failed")" >>$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 "$(eval_gettext "  started:  \$sd")" >>$toplevel/build.log
+echo "$(eval_gettext "  finished: \$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