[pacman-dev] [PATCH] Gettext support in repo-remove
Add gettext support to repo-remove. Signed-off-by: Giovanni Scafora <linuxmania@gmail.com> diff --git a/scripts/repo-remove b/scripts/repo-remove index 37079d9..4f237f6 100755 --- a/scripts/repo-remove +++ b/scripts/repo-remove @@ -19,6 +19,14 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. +# gettext initialization" +source gettext.sh + +TEXTDOMAIN=repo-remove +export TEXTDOMAIN +TEXTDOMAINDIR='@localedir@' +export TEXTDOMAINDIR + myver='3.0.0' FORCE=0 @@ -27,16 +35,16 @@ TMP_DIR="" # print usage instructions usage() { - echo "repo-remove $myver" + echo "$(gettext "repo-remove %s")" $myver echo - echo "usage: repo-remove <path-to-db> <packagename> ..." + echo "$(gettext "usage: repo-remove <path-to-db> <packagename> ...")" echo - echo "repo-remove will update a package database by removing the package name" - echo "specified on the command line from the given repo database. Multiple" - echo "packages to remove can be specified on the command line." + echo "$(gettext "repo-remove will update a package database by removing the package name")" + echo "$(gettext "specified on the command line from the given repo database. Multiple")" + echo "$(gettext "packages to remove can be specified on the command line.")" echo - echo "Example:" - echo " repo-remove /path/to/repo.db.tar.gz kernel26" + echo "$(gettext "Example:")" + echo "$(gettext " repo-remove /path/to/repo.db.tar.gz kernel26")" echo } @@ -57,7 +65,7 @@ db_remove_entry() # remove any other package in the DB with same name for existing in *; do if [ "${existing%-*-*}" = "$1" ]; then - echo ":: removing existing package '$existing'" + echo "$(gettext ":: removing existing package '%s'")" $existing rm -rf $existing fi done @@ -81,7 +89,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 @@ -92,7 +100,7 @@ fi # main routine if [ $# -gt 1 ]; then gstmpdir=$(mktemp -d /tmp/gensync.XXXXXXXXXX) || (\ - echo "cannot create temp directory for database building"; \ + echo "$(gettext "cannot create temp directory for database building")"; \ exit 1) success=0 @@ -101,20 +109,20 @@ if [ $# -gt 1 ]; then if [ -z "$REPO_DB_FILE" ]; then REPO_DB_FILE="$(readlink -f $arg)" if ! test_repo_db_file; then - echo "error: repository file '$REPO_DB_FILE' is not a proper pacman db" + echo "$(gettext "error: repository file '%s' is not a proper pacman db")" $REPO_DB_FILE exit 1 elif [ -f "$REPO_DB_FILE" ]; then - echo ":: extracting database to a temporary location" + echo "$(gettext ":: extracting database to a temporary location")" tar xf "$REPO_DB_FILE" -C "$gstmpdir" fi else - echo ":: searching for package '$arg'" + echo "$(gettext ":: searching for package '%s'")" this_dir="$(pwd)" if db_remove_entry "$arg"; then success=1 else - echo "error: package matching '$arg' not found" + echo "$(gettext "error: package matching '%s' not found")" $arg fi cd $this_dir fi @@ -122,7 +130,7 @@ if [ $# -gt 1 ]; then # if all operations were a success, rezip database if [ "$success" = "1" ]; then - echo ":: creating updated database file ${REPO_DB_FILE}" + echo "$(gettext ":: creating updated database file %s")" ${REPO_DB_FILE} cd $gstmpdir if [ -n "$(ls)" ]; then [ -f "${REPO_DB_FILE}.old" ] && rm "${REPO_DB_FILE}.old" @@ -130,12 +138,12 @@ if [ $# -gt 1 ]; then case "$DB_COMPRESSION" in gz) tar c * | gzip -9 >$REPO_DB_FILE ;; bz2) tar c * | bzip2 -9 >$REPO_DB_FILE ;; - *) echo "warning: no compression set" + *) echo "$(gettext "warning: no compression set")" tar c * >$REPO_DB_FILE;; esac fi else - echo ":: no packages modified, nothing to do" + echo "$(gettext ":: no packages modified, nothing to do")" fi fi -- 1.5.0.6 -- Giovanni Scafora Arch Linux Trusted User (voidnull) http://www.archlinux.org linuxmania@gmail.com
participants (1)
-
Giovanni Scafora