[pacman-dev] [PATCH] Fix some easy to find double translations

Dan McGee dan at archlinux.org
Mon Feb 28 18:51:28 EST 2011


A lot of these were places that should have used the same message but
didn't, or were very easy to convert to using the same message and
letting some of the burden off of the translators.

Signed-off-by: Dan McGee <dan at archlinux.org>
---
 lib/libalpm/be_sync.c      |    2 +-
 lib/libalpm/po/libalpm.pot |   18 +--------------
 lib/libalpm/sync.c         |    2 +-
 lib/libalpm/util.c         |    7 +++--
 po/pacman.pot              |   52 +++++--------------------------------------
 scripts/makepkg.sh.in      |   12 +++++-----
 scripts/pkgdelta.sh.in     |    4 +-
 scripts/repo-add.sh.in     |    6 ++--
 src/pacman/query.c         |    6 ++--
 src/pacman/util.c          |   19 +++++++--------
 10 files changed, 36 insertions(+), 92 deletions(-)

diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 2191494..5faf0b8 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -223,7 +223,7 @@ static int sync_db_populate(pmdb_t *db)
 
 	if(archive_read_open_filename(archive, _alpm_db_path(db),
 				ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
-		_alpm_log(PM_LOG_ERROR, _("could not open %s: %s\n"), _alpm_db_path(db),
+		_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), _alpm_db_path(db),
 				archive_error_string(archive));
 		archive_read_finish(archive);
 		RET_ERR(PM_ERR_DB_OPEN, 1);
diff --git a/lib/libalpm/po/libalpm.pot b/lib/libalpm/po/libalpm.pot
index b3edb22..560b7bf 100644
--- a/lib/libalpm/po/libalpm.pot
+++ b/lib/libalpm/po/libalpm.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: pacman 3.4.3\n"
 "Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n"
-"POT-Creation-Date: 2011-02-28 11:09-0600\n"
+"POT-Creation-Date: 2011-02-28 17:48-0600\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -152,10 +152,6 @@ msgid "removing invalid file: %s\n"
 msgstr ""
 
 #, c-format
-msgid "could not open %s: %s\n"
-msgstr ""
-
-#, c-format
 msgid "database path is undefined\n"
 msgstr ""
 
@@ -484,10 +480,6 @@ msgid "failed to retrieve some files from %s\n"
 msgstr ""
 
 #, c-format
-msgid "not enough free disk space\n"
-msgstr ""
-
-#, c-format
 msgid "could not commit removal transaction\n"
 msgstr ""
 
@@ -516,10 +508,6 @@ msgid "could not remove tmpdir %s\n"
 msgstr ""
 
 #, c-format
-msgid "warning given while extracting %s (%s)\n"
-msgstr ""
-
-#, c-format
 msgid "could not create pipe (%s)\n"
 msgstr ""
 
@@ -532,10 +520,6 @@ msgid "could not change the root directory (%s)\n"
 msgstr ""
 
 #, c-format
-msgid "could not change directory to / (%s)\n"
-msgstr ""
-
-#, c-format
 msgid "call to execv failed (%s)\n"
 msgstr ""
 
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index fdd3760..2919780 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -900,7 +900,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
 
 		_alpm_log(PM_LOG_DEBUG, "checking available disk space\n");
 		if(_alpm_check_diskspace(trans, handle->db_local) == -1) {
-			_alpm_log(PM_LOG_ERROR, _("not enough free disk space\n"));
+			_alpm_log(PM_LOG_ERROR, "%s\n", _("not enough free disk space"));
 			goto error;
 		}
 
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 9281f0e..74e1405 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -262,7 +262,7 @@ int _alpm_unpack(const char *archive, const char *prefix, alpm_list_t *list, int
 
 	if(archive_read_open_filename(_archive, archive,
 				ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
-		_alpm_log(PM_LOG_ERROR, _("could not open %s: %s\n"), archive,
+		_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), archive,
 				archive_error_string(_archive));
 		RET_ERR(PM_ERR_PKG_OPEN, 1);
 	}
@@ -320,7 +320,7 @@ int _alpm_unpack(const char *archive, const char *prefix, alpm_list_t *list, int
 		int readret = archive_read_extract(_archive, entry, 0);
 		if(readret == ARCHIVE_WARN) {
 			/* operation succeeded but a non-critical error was encountered */
-			_alpm_log(PM_LOG_WARNING, _("warning given while extracting %s (%s)\n"),
+			_alpm_log(PM_LOG_WARNING, _("warning given when extracting %s (%s)\n"),
 					entryname, archive_error_string(_archive));
 		} else if(readret != ARCHIVE_OK) {
 			_alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)\n"),
@@ -474,7 +474,8 @@ int _alpm_run_chroot(const char *root, const char *path, char *const argv[])
 			exit(1);
 		}
 		if(chdir("/") != 0) {
-			fprintf(stderr, _("could not change directory to / (%s)\n"), strerror(errno));
+			fprintf(stderr, _("could not change directory to %s (%s)\n"),
+					"/", strerror(errno));
 			exit(1);
 		}
 		umask(0022);
diff --git a/po/pacman.pot b/po/pacman.pot
index 9dd2a53..19f4e07 100644
--- a/po/pacman.pot
+++ b/po/pacman.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: pacman 3.4.3\n"
 "Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n"
-"POT-Creation-Date: 2011-02-28 11:09-0600\n"
+"POT-Creation-Date: 2011-02-28 17:48-0600\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -685,7 +685,7 @@ msgid "cannot determine real path for '%s': %s\n"
 msgstr ""
 
 #, c-format
-msgid "Path too long: %s%s\n"
+msgid "path too long: %s%s\n"
 msgstr ""
 
 #, c-format
@@ -701,14 +701,6 @@ msgid "group \"%s\" was not found\n"
 msgstr ""
 
 #, c-format
-msgid "root path too long\n"
-msgstr ""
-
-#, c-format
-msgid "file path too long\n"
-msgstr ""
-
-#, c-format
 msgid "no usable package repositories configured.\n"
 msgstr ""
 
@@ -1017,10 +1009,6 @@ msgid "warning: %s"
 msgstr ""
 
 #, c-format
-msgid "function: %s"
-msgstr ""
-
-#, c-format
 msgid "error: "
 msgstr ""
 
@@ -1028,10 +1016,6 @@ msgstr ""
 msgid "warning: "
 msgstr ""
 
-#, c-format
-msgid "function: "
-msgstr ""
-
 msgid "WARNING:"
 msgstr ""
 
@@ -1260,22 +1244,7 @@ msgstr ""
 msgid "requested package %s is not provided in %s"
 msgstr ""
 
-msgid "Determining latest darcs revision..."
-msgstr ""
-
-msgid "Determining latest cvs revision..."
-msgstr ""
-
-msgid "Determining latest git revision..."
-msgstr ""
-
-msgid "Determining latest svn revision..."
-msgstr ""
-
-msgid "Determining latest bzr revision..."
-msgstr ""
-
-msgid "Determining latest hg revision..."
+msgid "Determining latest %s revision..."
 msgstr ""
 
 msgid "Version found: %s"
@@ -1628,7 +1597,7 @@ msgid "Usage: pkgdelta [-q] <package1> <package2>\\n"
 msgstr ""
 
 msgid ""
-"\tpkgdelta will create a delta file between two packages\\nThis delta file "
+"\tpkgdelta will create a delta file between two packages.\\nThis delta file "
 "can then be added to a database using repo-add.\\n\\n"
 msgstr ""
 
@@ -1641,7 +1610,7 @@ msgid ""
 "the extent permitted by law.\\n"
 msgstr ""
 
-msgid "Invalid package '%s'"
+msgid "Invalid package file '%s'."
 msgstr ""
 
 msgid "The package names don't match : '%s' and '%s'"
@@ -1722,24 +1691,15 @@ msgstr ""
 msgid "Removing existing entry '%s'..."
 msgstr ""
 
-msgid "Invalid package file '%s'."
-msgstr ""
-
 msgid "An entry for '%s' already existed"
 msgstr ""
 
-msgid "Creating 'desc' db entry..."
+msgid "Creating '%s' db entry..."
 msgstr ""
 
 msgid "Computing md5 checksums..."
 msgstr ""
 
-msgid "Creating 'depends' db entry..."
-msgstr ""
-
-msgid "Creating 'files' db entry..."
-msgstr ""
-
 msgid "Old package file not found: %s"
 msgstr ""
 
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 16dc0b8..23081fe 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1356,27 +1356,27 @@ devel_check() {
 		oldpkgver=$pkgver
 		if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then
 			type -p darcs >/dev/null || return 0
-			msg "$(gettext "Determining latest darcs revision...")"
+			msg "$(gettext "Determining latest %s revision...")" 'darcs'
 			newpkgver=$(date +%Y%m%d)
 		elif [[ -n ${_cvsroot} && -n ${_cvsmod} ]] ; then
 			type -p cvs >/dev/null || return 0
-			msg "$(gettext "Determining latest cvs revision...")"
+			msg "$(gettext "Determining latest %s revision...")" 'cvs'
 			newpkgver=$(date +%Y%m%d)
 		elif [[ -n ${_gitroot} && -n ${_gitname} ]] ; then
 			type -p git >/dev/null || return 0
-			msg "$(gettext "Determining latest git revision...")"
+			msg "$(gettext "Determining latest %s revision...")" 'git'
 			newpkgver=$(date +%Y%m%d)
 		elif [[ -n ${_svntrunk} && -n ${_svnmod} ]] ; then
 			type -p svn >/dev/null || return 0
-			msg "$(gettext "Determining latest svn revision...")"
+			msg "$(gettext "Determining latest %s revision...")" 'svn'
 			newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p')
 		elif [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] ; then
 			type -p bzr >/dev/null || return 0
-			msg "$(gettext "Determining latest bzr revision...")"
+			msg "$(gettext "Determining latest %s revision...")" 'bzr'
 			newpkgver=$(bzr revno ${_bzrtrunk})
 		elif [[ -n ${_hgroot} && -n ${_hgrepo} ]] ; then
 			type -p hg >/dev/null || return 0
-			msg "$(gettext "Determining latest hg revision...")"
+			msg "$(gettext "Determining latest %s revision...")" 'hg'
 			if [[ -d ./src/$_hgrepo ]] ; then
 				cd ./src/$_hgrepo
 				hg pull
diff --git a/scripts/pkgdelta.sh.in b/scripts/pkgdelta.sh.in
index 6bc3f5d..ecca427 100644
--- a/scripts/pkgdelta.sh.in
+++ b/scripts/pkgdelta.sh.in
@@ -55,7 +55,7 @@ usage() {
 	printf "pkgdelta (pacman) %s\n\n" "$myver"
 	printf "$(gettext "Usage: pkgdelta [-q] <package1> <package2>\n")"
 	printf "$(gettext "\
-	pkgdelta will create a delta file between two packages\n\
+	pkgdelta will create a delta file between two packages.\n\
 This delta file can then be added to a database using repo-add.\n\n")"
 	echo "$(gettext "Example:  pkgdelta pacman-3.0.0.pkg.tar.gz pacman-3.0.1.pkg.tar.gz")"
 }
@@ -85,7 +85,7 @@ read_pkginfo()
 		fi
 	done
 	IFS=$OLDIFS
-	error "$(gettext "Invalid package '%s'")" "$1"
+	error "$(gettext "Invalid package file '%s'.")" "$1"
 	return 1
 }
 
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index 9b79022..dfc9397 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -254,7 +254,7 @@ db_write_entry()
 	[[ -f ../$pkgname.deltas ]] && mv "../$pkgname.deltas" deltas
 
 	# create desc entry
-	msg2 "$(gettext "Creating 'desc' db entry...")"
+	msg2 "$(gettext "Creating '%s' db entry...")" 'desc'
 	echo -e "%FILENAME%\n$(basename "$1")\n" >>desc
 	echo -e "%NAME%\n$pkgname\n" >>desc
 	[[ -n $pkgbase ]] && echo -e "%BASE%\n$pkgbase\n" >>desc
@@ -276,7 +276,7 @@ db_write_entry()
 	write_list_entry "REPLACES" "$_replaces" "desc"
 
 	# create depends entry
-	msg2 "$(gettext "Creating 'depends' db entry...")"
+	msg2 "$(gettext "Creating '%s' db entry...")" 'depends'
 	# create the file even if it will remain empty
 	touch "depends"
 	write_list_entry "DEPENDS" "$_depends" "depends"
@@ -289,7 +289,7 @@ db_write_entry()
 
 	# create files file if wanted
 	if (( WITHFILES )); then
-		msg2 "$(gettext "Creating 'files' db entry...")"
+		msg2 "$(gettext "Creating '%s' db entry...")" 'files'
 		local files_path="$tmpdir/$pkgname-$pkgver/files"
 		echo "%FILES%" >$files_path
 		bsdtar --exclude='.*' -tf "$pkgfile" >>$files_path
diff --git a/src/pacman/query.c b/src/pacman/query.c
index 18c6992..bd23d46 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -184,7 +184,7 @@ static int query_fileowner(alpm_list_t *targets)
 				}
 
 				if(strlen(pkgfile) > max_length) {
-					pm_fprintf(stderr, PM_LOG_ERROR, _("Path too long: %s%s\n"), root, pkgfile);
+					pm_fprintf(stderr, PM_LOG_ERROR, _("path too long: %s%s\n"), root, pkgfile);
 				}
 				/* concatenate our file and the root path */
 				strcpy(append, pkgfile);
@@ -399,7 +399,7 @@ static int check(pmpkg_t *pkg)
 	rootlen = strlen(root);
 	if(rootlen + 1 > PATH_MAX) {
 		/* we are in trouble here */
-		pm_fprintf(stderr, PM_LOG_ERROR, _("root path too long\n"));
+		pm_fprintf(stderr, PM_LOG_ERROR, _("path too long: %s%s\n"), root, "");
 		return(1);
 	}
 	strcpy(f, root);
@@ -410,7 +410,7 @@ static int check(pmpkg_t *pkg)
 		const char *path = alpm_list_getdata(i);
 
 		if(rootlen + 1 + strlen(path) > PATH_MAX) {
-			pm_fprintf(stderr, PM_LOG_WARNING, _("file path too long\n"));
+			pm_fprintf(stderr, PM_LOG_WARNING, _("path too long: %s%s\n"), root, path);
 			continue;
 		}
 		strcpy(f + rootlen, path);
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 2d4ccf3..8336808 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -987,19 +987,20 @@ int pm_vasprintf(char **string, pmloglevel_t level, const char *format, va_list
 
 	/* print a prefix to the message */
 	switch(level) {
-		case PM_LOG_DEBUG:
-			pm_asprintf(string, "debug: %s", msg);
-			break;
 		case PM_LOG_ERROR:
 			pm_asprintf(string, _("error: %s"), msg);
 			break;
 		case PM_LOG_WARNING:
 			pm_asprintf(string, _("warning: %s"), msg);
 			break;
+		case PM_LOG_DEBUG:
+			pm_asprintf(string, "debug: %s", msg);
+			break;
 		case PM_LOG_FUNCTION:
-			pm_asprintf(string, _("function: %s"), msg);
+			pm_asprintf(string, "function: %s", msg);
 			break;
 		default:
+			pm_asprintf(string, "%s", msg);
 			break;
 	}
 	free(msg);
@@ -1034,19 +1035,17 @@ int pm_vfprintf(FILE *stream, pmloglevel_t level, const char *format, va_list ar
 
 	/* print a prefix to the message */
 	switch(level) {
-		case PM_LOG_DEBUG:
-			fprintf(stream, "debug: ");
-			break;
 		case PM_LOG_ERROR:
 			fprintf(stream, _("error: "));
 			break;
 		case PM_LOG_WARNING:
 			fprintf(stream, _("warning: "));
 			break;
+		case PM_LOG_DEBUG:
+			fprintf(stream, "debug: ");
+			break;
 		case PM_LOG_FUNCTION:
-		  /* TODO we should increase the indent level when this occurs so we can see
-			 * program flow easier.  It'll be fun */
-			fprintf(stream, _("function: "));
+			fprintf(stream, "function: ");
 			break;
 		default:
 			break;
-- 
1.7.4.1



More information about the pacman-dev mailing list