[pacman-dev] [PATCH] Gettext support in gensync
Giovanni Scafora
linuxmania at gmail.com
Mon Apr 2 09:45:59 EDT 2007
Add gettext support to gensync.
Signed-off-by: Giovanni Scafora <linuxmania at gmail.com>
diff --git a/scripts/gensync b/scripts/gensync
index f99cf59..fa88f32 100755
--- a/scripts/gensync
+++ b/scripts/gensync
@@ -20,28 +20,37 @@
# USA.
#
+# gettext initialization"
+source gettext.sh
+
+TEXTDOMAIN=gensync
+export TEXTDOMAIN
+TEXTDOMAINDIR='@localedir@'
+export TEXTDOMAINDIR
+
myver='3.0.0'
# functions
usage() {
- echo "gensync $myver"
- echo "usage: $0 <root> <destfile> [package_directory]"
+ echo "$(eval_gettext "gensync \$myver")"
+ gensync=$0
+ echo "$(eval_gettext "usage: \$gensync <root> <destfile>
[package_directory]")"
echo
- echo "gensync will generate a sync database by reading all PKGBUILD files"
- echo "from <root>. gensync builds the database in a temporary directory"
- echo "and then compresses it to <destfile>."
+ echo "$(gettext "gensync will generate a sync database by reading
all PKGBUILD files")"
+ echo "$(gettext "from <root>. gensync builds the database in a
temporary directory")"
+ echo "$(gettext "and then compresses it to <destfile>.")"
echo
- echo "gensync will calculate md5sums of packages in the same directory as"
- echo "<destfile>, unless an alternate [package_directory] is specified."
+ echo "$(gettext "gensync will calculate md5sums of packages in the
same directory as")"
+ echo "$(gettext "<destfile>, unless an alternate [package_directory]
is specified.")"
echo
- echo "note: The <destfile> name is important. It must be of the form"
- echo " {treename}.db.tar.gz where {treename} is the name of the custom"
- echo " package repository you configured in /etc/pacman.conf. The"
- echo " generated database must reside in the same directory as your"
- echo " custom packages (also configured in /etc/pacman.conf)"
+ echo "$(gettext "note: The <destfile> name is important. It must be
of the form")"
+ echo "$(gettext " {treename}.db.tar.gz where {treename} is the
name of the custom")"
+ echo "$(gettext " package repository you configured in
/etc/pacman.conf. The")"
+ echo "$(gettext " generated database must reside in the same
directory as your")"
+ echo "$(gettext " custom packages (also configured in
/etc/pacman.conf)")"
echo
- echo "example: gensync /var/abs/local /home/mypkgs/custom.db.tar.gz"
+ echo "$(gettext "example: gensync /var/abs/local
/home/mypkgs/custom.db.tar.gz")"
echo
echo
exit 0
@@ -83,7 +92,7 @@ fi
if [ -r /etc/makepkg.conf ]; then
source /etc/makepkg.conf
else
- echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2
+ echo "$(gettext "ERROR: /etc/makepkg.conf not found. Can not continue.")" >&2
exit 1 # $E_CONFIG_ERROR # TODO: error codes
fi
@@ -102,9 +111,9 @@ if [ "$3" != "" ]; then
pkgdir="$3"
fi
-[ ! -d "$rootdir" ] && die "invalid root dir: $rootdir"
+[ ! -d "$rootdir" ] && die "$(eval_gettext "invalid root dir: \$rootdir")"
-echo "gensync: building database entries, generating md5sums..." >&2
+echo "$(gettext "gensync: building database entries, generating
md5sums...")" >&2
cd "$destdir"
pkgs=""
@@ -113,7 +122,7 @@ forcepkgs=""
for file in $(find "$rootdir"/* -name "$BUILDSCRIPT"); do
unset pkgname pkgver pkgrel options
- source $file || die "failed to parse parse $file"
+ source $file || die "$(eval_gettext "failed to parse parse \$file")"
if [ "$pkgdir" != "" ]; then
pkgfile="$pkgdir/$pkgname-$pkgver-$pkgrel-$CARCH.$PKGEXT"
else
@@ -121,7 +130,7 @@ for file in $(find "$rootdir"/* -name "$BUILDSCRIPT"); do
fi
if [ ! -f "$pkgfile" ]; then
- error "could not find $pkgname-$pkgver-$pkgrel-$CARCH.$PKGEXT - skipping"
+ error "$(eval_gettext "could not find
\$pkgname-\$pkgver-\$pkgrel-\$CARCH.\$PKGEXT - skipping")"
else
if check_force; then
forcepkgs="$forcepkgs $pkgfile"
@@ -131,7 +140,7 @@ for file in $(find "$rootdir"/* -name "$BUILDSCRIPT"); do
fi
done
-echo "creating repo DB..."
+echo "$(gettext "creating repo DB...")"
# we'll trim the output just a tad, as gensync may be used on large repos
repo-add $destfile $pkgs --force $force_pkgs \
--
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