[pacman-dev] [PATCH] Gettext support in updatesync
Giovanni Scafora
linuxmania at gmail.com
Mon Apr 2 13:46:24 EDT 2007
Add gettext support to updatesync.
Signed-off-by: Giovanni Scafora <linuxmania at gmail.com>
diff --git a/scripts/updatesync b/scripts/updatesync
index 7c6dab2..3a75b1f 100755
--- a/scripts/updatesync
+++ b/scripts/updatesync
@@ -21,36 +21,46 @@
# USA.
#
+# gettext initialization"
+source gettext.sh
+
+TEXTDOMAIN=updatesync
+export TEXTDOMAIN
+TEXTDOMAINDIR='@localedir@'
+export TEXTDOMAINDIR
+
myver='3.0.0'
# functions
usage() {
- echo "updatesync $myver"
- echo "usage: $0 <action> <destfile> <option> [package_directory]"
+ echo "$(gettext "updatesync %s")" $myver
+ local msg=$0; shift
+ printf "$(gettext "usage: \$msg <action> <destfile> <option>
[package_directory]")" $*
echo
- echo "updatesync will update a sync database by reading a PKGBUILD and"
- echo "modifying the destfile. updatesync updates the database in a temporary"
- echo "directory and then compresses it to <destfile>."
+ echo "$(gettext "updatesync will update a sync database by reading a
PKGBUILD and")"
+ echo "$(gettext "modifying the destfile. updatesync updates the
database in a temporary")"
+ echo "$(gettext "directory and then compresses it to <destfile>.")"
echo
- echo "There are two types of actions:"
+ echo "$(gettext "There are two types of actions:")"
echo
- echo "upd - Will update a package's entry or create it if it doesn't exist."
- echo " It takes the package's PKGBUILD as an option."
- echo "del - Will remove a package's entry from the db."
- echo " It takes the package's name as an option."
+ echo "$(gettext "upd - Will update a package's entry or create it if
it doesn't exist.")"
+ echo "$(gettext " It takes the package's PKGBUILD as an option.")"
+ echo "$(gettext "del - Will remove a package's entry from the db.")"
+ echo "$(gettext " It takes the package's name as an option.")"
echo
- echo "updatesync will calculate md5sums of packages in the same directory as"
- echo "<destfile>, unless an alternate [package_directory] is specified."
+ echo "$(gettext "updatesync will calculate md5sums of packages in
the same directory as")"
+ echo "$(gettext "<destfile>, unless an alternate [package_directory]
is specified.")"
echo
- echo "example: updatesync upd /home/mypkgs/custom.db.tar.gz PKGBUILD"
+ echo "$(gettext "example: updatesync upd
/home/mypkgs/custom.db.tar.gz PKGBUILD")"
echo
echo
exit 0
}
error () {
- echo "==> ERROR: $*" >&2
+ local msg=$*; shift
+ printf "$(gettext "==> ERROR: \$msg")" $* >&2
}
die () {
@@ -85,7 +95,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
@@ -108,17 +118,17 @@ fi
opt_force=""
if [ ! -f "$option" ]; then
- die "$option not found"
+ die "$(gettext "%s not found")" $option
fi
if [ "$action" = "upd" ]; then # INSERT / UPDATE
unset pkgname pkgver pkgrel options
- source $option || die "failed to parse $option"
+ source $option || die "$(gettext "failed to parse %s")" $option
pkgfile="$pkgdir/$pkgname-$pkgver-$pkgrel-$CARCH.$PKGEXT"
if [ ! -f "$pkgfile" ]; then
- die "could not find $pkgname-$pkgver-$pkgrel-$CARCH.$PKGEXT - aborting"
+ die "$(gettext "could not find %s-%s-%s-%s.%s - aborting")"
$pkgname $pkgver $pkgrel $CARCH $PKGEXT
fi
if check_force; then
--
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