Author: jreidinger
Date: Fri Mar 14 10:14:56 2008
New Revision: 9146
URL: http://svn.opensuse.org/viewcvs/zypp?rev=9146&view=rev
Log:
make strings from RpmDb and Keyring exceptions translatable
Modified:
trunk/libzypp/zypp/KeyRing.cc
trunk/libzypp/zypp/target/rpm/RpmDb.cc
Modified: trunk/libzypp/zypp/KeyRing.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/KeyRing.cc?rev=9146&r1=9145&r2=9146&view=diff
==============================================================================
--- trunk/libzypp/zypp/KeyRing.cc (original)
+++ trunk/libzypp/zypp/KeyRing.cc Fri Mar 14 10:14:56 2008
@@ -15,6 +15,8 @@
#include <cstdio>
#include
+#include
+
#include "zypp/TmpPath.h"
#include "zypp/ZYppFactory.h"
#include "zypp/ZYpp.h"
@@ -23,6 +25,7 @@
#include "zypp/base/IOStream.h"
#include "zypp/base/String.h"
#include "zypp/base/Regex.h"
+#include "zypp/base/Gettext.h"
#include "zypp/PathInfo.h"
#include "zypp/KeyRing.h"
#include "zypp/ExternalProgram.h"
@@ -267,7 +270,11 @@
catch (BadKeyException &e)
{
ERR << "Cannot create public key " << id << " from " << keyring << " keyring to file " << e.keyFile() << endl;
- ZYPP_THROW(Exception("Cannot create public key " + id + " from " + keyring.asString() + " keyring to file " + e.keyFile().asString() ) );
+ // TranslatorExplanation first %s is key name, second is keyring name
+ // and third is keyfile name
+ ZYPP_THROW(Exception(boost::str(boost::format(
+ _("Cannot create public key %s from %s keyring to file %s"))
+ % id % keyring.asString() % e.keyFile().asString())));
}
catch (exception &e)
{
@@ -495,7 +502,10 @@
void KeyRing::Impl::importKey( const Pathname &keyfile, const Pathname &keyring)
{
if ( ! PathInfo(keyfile).isExist() )
- ZYPP_THROW(KeyRingException("Tried to import not existant key " + keyfile.asString() + " into keyring " + keyring.asString()));
+ // TranslatorExplanation first %s is key name, second is keyring name
+ ZYPP_THROW(KeyRingException(boost::str(boost::format(
+ _("Tried to import not existant key %s into keyring %s"))
+ % keyfile.asString() % keyring.asString())));
const char* argv[] =
{
@@ -545,7 +555,7 @@
int code = prog.close();
if ( code )
- ZYPP_THROW(Exception("Failed to delete key."));
+ ZYPP_THROW(Exception(_("Failed to delete key.")));
else
MIL << "Deleted key " << id << " from keyring " << keyring << endl;
}
@@ -554,7 +564,8 @@
string KeyRing::Impl::readSignatureKeyId(const Pathname &signature )
{
if ( ! PathInfo(signature).isFile() )
- ZYPP_THROW(Exception("Signature file " + signature.asString() + " not found"));
+ ZYPP_THROW(Exception(boost::str(boost::format(
+ _("Signature file %s not found"))% signature.asString())));
MIL << "Determining key id if signature " << signature << endl;
// HACK create a tmp keyring with no keys
Modified: trunk/libzypp/zypp/target/rpm/RpmDb.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/rpm/RpmDb.cc?rev=9146&r1=9145&r2=9146&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/rpm/RpmDb.cc (original)
+++ trunk/libzypp/zypp/target/rpm/RpmDb.cc Fri Mar 14 10:14:56 2008
@@ -24,9 +24,12 @@
#include <vector>
#include <algorithm>
+#include
+
#include "zypp/base/Logger.h"
#include "zypp/base/String.h"
#include "zypp/base/Regex.h"
+#include "zypp/base/Gettext.h"
#include "zypp/Date.h"
#include "zypp/Pathname.h"
@@ -43,10 +46,6 @@
#include "zypp/KeyRing.h"
#include "zypp/ZYppFactory.h"
-#ifndef _
-#define _(X) X
-#endif
-
using namespace std;
using namespace zypp::filesystem;
@@ -887,8 +886,9 @@
if ( rpm_status != 0 )
{
- ZYPP_THROW(RpmSubprocessException(string("RPM failed: ") +
- (errmsg.empty() ? error_message: errmsg)));
+ //TranslatorExplanation after semicolon is error message
+ ZYPP_THROW(RpmSubprocessException(string(_("RPM failed: ") +
+ (errmsg.empty() ? error_message: errmsg))));
}
else
{
@@ -1042,8 +1042,10 @@
if ( rpm_status != 0 )
{
- ZYPP_THROW(RpmSubprocessException(string("Failed to import public key from file ") +
- pubkey_r.asString() + ":" + error_message));
+ //TranslatorExplanation first %s is file name, second is error message
+ ZYPP_THROW(RpmSubprocessException(boost::str(boost::format(
+ _("Failed to import public key from file %s: %s"))
+ % pubkey_r.asString() % error_message)));
}
else
{
@@ -1117,8 +1119,10 @@
if ( rpm_status != 0 )
{
- ZYPP_THROW(RpmSubprocessException(string("Failed to remove public key ") +
- pubkey_r.asString() + ":" + error_message));
+ //TranslatorExplanation first %s is key name, second is error message
+ ZYPP_THROW(RpmSubprocessException(boost::str(boost::format(
+ _("Failed to remove public key %s: %s")) % pubkey_r.asString()
+ % error_message)));
}
else
{
@@ -2051,7 +2055,8 @@
// %s = filename of rpm package
progresslog(/*timestamp*/true) << str::form(_("%s install failed"), Pathname::basename(filename).c_str()) << endl;
progresslog() << _("rpm output:") << endl << rpmmsg << endl;
- ZYPP_THROW(RpmSubprocessException(string("RPM failed: ") +
+ //TranslatorExplanation after semicolon is error message
+ ZYPP_THROW(RpmSubprocessException(string(_("RPM failed: ")) +
(rpmmsg.empty() ? error_message : rpmmsg)));
}
else
@@ -2170,7 +2175,8 @@
// %s = name of rpm package
progresslog(/*timestamp*/true) << str::form(_("%s remove failed"), name_r.c_str()) << endl;
progresslog() << _("rpm output:") << endl << rpmmsg << endl;
- ZYPP_THROW(RpmSubprocessException(string("RPM failed: ") +
+ //TranslatorExplanation after semicolon is error message
+ ZYPP_THROW(RpmSubprocessException(string(_("RPM failed: ")) +
(rpmmsg.empty() ? error_message: rpmmsg)));
}
else
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org