more texts marked for translation
authorJan Kupec <jkupec@suse.cz>
Thu, 11 Jan 2007 15:22:39 +0000 (15:22 +0000)
committerJan Kupec <jkupec@suse.cz>
Thu, 11 Jan 2007 15:22:39 +0000 (15:22 +0000)
src/zmart-keyring-callbacks.h
src/zmart-misc.cc
src/zmart-sources.cc
src/zypper-callbacks.cc
src/zypper-getopt.cc
src/zypper-info.cc
src/zypper-search.cc
src/zypper.cc

index cd12acd..7608ccf 100644 (file)
@@ -33,7 +33,7 @@ namespace zypp {
     {
       virtual bool askUserToAcceptUnsignedFile( const std::string &file )
       {
-        cout << CLEARLN << file << " is unsigned, continue? [y/n]: " << flush;
+        cout << CLEARLN << file << _(" is unsigned, continue?") << " [y/n]: " << flush;
         return readBoolAnswer();
       }
       
@@ -43,7 +43,7 @@ namespace zypp {
         if ( geteuid() != 0 )
           return false;
         
-        cout << CLEARLN << "Import key " << key.id() << " in trusted keyring? [y/n]: " << flush;
+        cout << CLEARLN << _("Import key ") << key.id() << _(" to trusted keyring?") << "  [y/n]: " << flush;
         return readBoolAnswer();
       } 
 #endif
@@ -54,7 +54,7 @@ namespace zypp {
       virtual bool askUserToAcceptUnknownKey( const std::string &file, const std::string &id )
 #endif
       {
-        cout << CLEARLN << file << " is signed with an unknown key id: " << id << ", continue? [y/n]: " << flush;
+        cout << CLEARLN << file << _(" is signed with an unknown key id: ") << id << ", " << _("continue?") << " [y/n]: " << flush;
         return readBoolAnswer();
       }
 
@@ -65,7 +65,7 @@ namespace zypp {
        const std::string& keyid = key.id(), keyname = key.name(),
          fingerprint = key.fingerprint();
 #endif
-        cout  << CLEARLN << "Do you want to trust key id " << keyid << " " << keyname << " fingerprint:" << fingerprint << " ? [y/n]: "  << flush;
+        cout  << CLEARLN << _("Do you want to trust key id ") << keyid << " " << keyname << _(" fingerprint:") << fingerprint << " ? [y/n]: "  << flush;
         return readBoolAnswer();
       }
 
@@ -76,9 +76,9 @@ namespace zypp {
        const std::string& keyid = key.id(), keyname = key.name(),
          fingerprint = key.fingerprint();
 #endif
-        cout << file << "Signature verification for " << file
-            << " with public key id " << keyid << " " << keyname << " fingerprint:" << fingerprint << " failed, THIS IS RISKY!. continue? [y/n]: " << endl;
-        return readBoolAnswer();
+        cout << file << _("Signature verification for ") << file
+            << _(" with public key id ") << keyid << " " << keyname << _(" fingerprint:") << fingerprint << _(" failed, THIS IS RISKY!") << ". " << _("continue?") << " [y/n]: " << endl;
+        return readBoolAnswer(); // TODO do this with format()
       }
     };
 
@@ -87,21 +87,21 @@ namespace zypp {
     {
       virtual bool askUserToAcceptNoDigest( const zypp::Pathname &file )
       {
-       cout << CLEARLN << "No digest for " << file
-            << ", continue [y/n]" << flush;
+       cout << CLEARLN << _("No digest for ") << file
+            << ", " << _("continue?") << " [y/n]" << flush;
         return readBoolAnswer();
       }
       virtual bool askUserToAccepUnknownDigest( const Pathname &file, const std::string &name )
       {
-       cout << CLEARLN << "Unknown digest " << name << " for " << file
-            << ", continue [y/n]" << flush;
+       cout << CLEARLN << _("Unknown digest ") << name << _(" for ") << file
+            << ", " << _("continue?") << " [y/n]" << flush;
         return readBoolAnswer();
       }
       virtual bool askUserToAcceptWrongDigest( const Pathname &file, const std::string &requested, const std::string &found )
       {
-       cout << CLEARLN << "Digest verification failed for " << file
-            << ", expected " << requested << " found " << found
-            << ", continue [y/n]" << flush;
+       cout << CLEARLN << _("Digest verification failed for ") << file
+            << _(", expected ") << requested << _(" found ") << found
+            << ", " << _("continue?") << " [y/n]" << flush;
         return readBoolAnswer();
       }
     };
index 6aafb83..c290cc2 100644 (file)
@@ -23,10 +23,10 @@ void cond_init_target () {
   static bool done = false;
   if (!done) {
 #ifdef LIBZYPP_1xx
-    cerr_v << "Initializing Target (old way)" << endl;
+    cerr_v << _("Initializing Target") << _(" (old way)") << endl;
     God->initTarget("/", true);
 #else
-    cerr_v << "Initializing Target" << endl;
+    cerr_v << _("Initializing Target") << endl;
     God->initializeTarget("/");
 #endif
     done = true;
@@ -158,21 +158,20 @@ void mark_for_install( const ResObject::Kind &kind,
                );
   cerr_vv << "... done" << endl;
   if (!installer.item) {
-    cerr << kind << " '" << name << "' not found" << endl;
+    cerr << kind << " '" << name << "' " << _("not found") << endl;
     return; //error?
   }
 
   if (installer.installed_item &&
       installer.installed_item.resolvable()->edition() == installer.item.resolvable()->edition() &&
       installer.installed_item.resolvable()->arch() == installer.item.resolvable()->arch()) {
-    cout << "skipping " << kind.asString() << " '" << name << "' (already installed)" << endl;
+    cout << _("skipping ") << kind.asString() << " '" << name << "' " << _("(already installed)") << endl;
   }
   else {
     // TODO don't use setToBeInstalled for this purpose but higher level solver API
     bool result = installer.item.status().setToBeInstalled( zypp::ResStatus::USER );
     if (!result) {
-      cerr << "Failed to add '" << name <<
-        "' to the list of packages to be installed." << endl;
+      cerr << format(_("Failed to add '%s' to the list of packages to be installed.")) % name << endl;
     }
   }
 }
@@ -190,7 +189,7 @@ struct DeleteProcess
     cerr_vv << "Marking for deletion: " << provider << endl;
     bool result = provider.status().setToBeUninstalled( zypp::ResStatus::USER );
     if (!result) {
-      cerr << "Failed" << endl;
+      cerr << _("Failed") << endl;
     }
     return true;               // get all of them
   }
@@ -213,7 +212,7 @@ void mark_for_uninstall( const ResObject::Kind &kind,
                );
   cerr_vv << "... done" << endl;
   if (!deleter.found) {
-    cerr << "Not found" << endl;
+    cerr << _("Not found") << endl;
     return; //error?
   }
 }
@@ -227,10 +226,10 @@ void show_problems () {
     e = rproblems.end (),
     i;
   if (b != e) {
-    cerr << "Problems:" << endl;
+    cerr << _("Problems:") << endl;
   }
   for (i = b; i != e; ++i) {
-    stm << "PROB " << (*i)->description () << endl;
+    stm << _("PROB ") << (*i)->description () << endl;
     stm << ":    " << (*i)->details () << endl;
 
     ProblemSolutionList solutions = (*i)->solutions ();
@@ -239,7 +238,7 @@ void show_problems () {
       ee = solutions.end (),
       ii;
     for (ii = bb; ii != ee; ++ii) {
-      stm << " SOL  " << (*ii)->description () << endl;
+      stm << _(" SOL  ") << (*ii)->description () << endl;
       stm << " :    " << (*ii)->details () << endl;
     }
   }
@@ -255,7 +254,7 @@ int show_summary()
 {
   int retv = -1; // nothing to do;
 
-  cerr << "Summary:" << endl;
+  cerr << _("Summary:") << endl;
 
   MIL << "Pool contains " << God->pool().size() << " items." << std::endl;
   for ( ResPool::const_iterator it = God->pool().begin(); it != God->pool().end(); ++it )
@@ -278,14 +277,14 @@ int show_summary()
       }
 
       if ( it->status().isToBeInstalled() )
-        cerr << "<install>   ";
+        cerr << _("<install>   ");
       if ( it->status().isToBeUninstalled() )
-        cerr << "<uninstall> ";
+        cerr << _("<uninstall> ");
       cerr << *res << endl;
     }
   }
   if (retv == -1)
-    cerr << "Nothing to do." << endl;
+    cerr << _("Nothing to do.") << endl;
 
   return retv;
 }
@@ -341,9 +340,9 @@ void cond_load_resolvables ()
 
 void load_target()
 {
-  cerr << "Parsing RPM database..." << endl;
+  cerr << _("Parsing RPM database...") << endl;
   ResStore tgt_resolvables(God->target()->resolvables());
-  cerr_v << "   " <<  tgt_resolvables.size() << " resolvables." << endl;
+  cerr_v << "   " <<  tgt_resolvables.size() << _(" resolvables.") << endl;
   God->addResolvables(tgt_resolvables, true /*installed*/);
 }
 
@@ -354,16 +353,16 @@ void load_sources()
     if (! it->enabled())
       continue;                        // #217297
 
-    cerr << "Parsing metadata for " << it->alias() << "..." << endl;
+    cerr << _("Parsing metadata for ") << it->alias() << "..." << endl;
     ResStore src_resolvables(it->resolvables());
-    cerr_v << "   " <<  src_resolvables.size() << " resolvables." << endl;
+    cerr_v << "   " <<  src_resolvables.size() << _(" resolvables.") << endl;
     God->addResolvables(src_resolvables);
   }
 }
 
 void establish ()
 {
-  cerr_v << "Establishing status of aggregates" << endl;
+  cerr_v << _("Establishing status of aggregates") << endl;
   God->resolver()->establishPool();
   dump_pool ();
 }
@@ -371,7 +370,7 @@ void establish ()
 void resolve()
 {
   establish ();
-  cerr_v << "Resolving dependencies ..." << endl;
+  cerr_v << _("Resolving dependencies...") << endl;
   God->resolver()->resolvePool();
 }
 
@@ -397,22 +396,22 @@ void patch_check ()
     }
   }
 
-  cout << gData.patches_count << " patches needed. ( " << gData.security_patches_count << " security patches )"  << std::endl;
+  cout << gData.patches_count << _(" patches needed") << ". ( " << gData.security_patches_count << _(" security patches") << " )"  << std::endl;
 }
 
 string string_status (const ResStatus& rs)
 {
   bool i = rs.isInstalled ();
   if (rs.isUndetermined ())
-    return i? "Installed": "Uninstalled";
+    return i? _("Installed"): _("Uninstalled");
   else if (rs.isEstablishedUneeded ())
-    return i? "No Longer Applicable": "Not Applicable";
+    return i? _("No Longer Applicable"): _("Not Applicable");
   else if (rs.isEstablishedSatisfied ())
-    return i? "Applied": "Not Needed";
+    return i? _("Applied"): _("Not Needed");
   else if (rs.isEstablishedIncomplete ())
-    return i? "Broken": "Needed";
+    return i? _("Broken"): _("Needed");
   // if ResStatus interface changes
-  return "error";
+  return _("error");
 }
 
 void dump_pool ()
@@ -441,7 +440,7 @@ void show_patches()
 
   Table tbl;
   TableHeader th;
-  th << "Catalog" << "Name" << "Version" << "Category" << "Status";
+  th << _("Catalog") << _("Name") << _("Version") << _("Category") << _("Status");
   tbl << th;
 
   ResPool::byKind_iterator
@@ -475,7 +474,7 @@ void list_patch_updates ()
   TableHeader th;
   unsigned cols;
 
-  th << "Catalog" << "Name" << "Version" << "Category" << "Status";
+  th << _("Catalog") << _("Name") << _("Version") << _("Category") << _("Status");
   cols = 5;
   tbl << th;
   pm_tbl << th;
@@ -598,12 +597,12 @@ void list_updates( const ResObject::Kind &kind )
     Table tbl;
     TableHeader th;
     unsigned cols = 5;
-    th << "S" << "Catalog";
+    th << _("S") << _("Catalog"); // for translators: S stands for Status
     if (gSettings.is_rug_compatible) {
       th << "Bundle";
       ++cols;
     }
-    th << "Name" << "Version" << "Arch";
+    th << _("Name") << _("Version") << _("Arch");
     tbl << th;
 
     Candidates candidates;
@@ -705,12 +704,12 @@ int solve_and_commit (bool non_interactive) {
   int retv = show_summary();
 
   if (retv >= 0) { // there are resolvables to install/uninstall
-    cerr << "Continue? [y/n] " << (non_interactive ? "y\n" : "");
+    cerr << _("Continue?") << " [y/n] " << (non_interactive ? "y\n" : "");
     if (non_interactive || readBoolAnswer()) {
 
       if (!confirm_licenses(non_interactive)) return ZYPPER_EXIT_OK;
 
-      cerr_v << "committing" << endl;
+      cerr_v << _("committing") << endl;
       
       try {
         ZYppCommitResult result = God->commit( ZYppCommitPolicy() );
index 379df19..675f795 100644 (file)
@@ -28,7 +28,7 @@ void cond_init_system_sources ()
     return;
 
   if ( geteuid() != 0 ) {
-    cerr << "Sorry, you need root privileges to use system sources, disabling them..." << endl;
+    cerr << _("Sorry, you need root privileges to use system sources, disabling them...") << endl;
     gSettings.disable_system_sources = true;
     MIL << "system sources disabled" << endl;
   }
@@ -45,7 +45,7 @@ void init_system_sources()
   manager = SourceManager::sourceManager();
   try
   {
-    cerr << "Restoring system sources..." << endl;
+    cerr << _("Restoring system sources...") << endl;
     manager->restore("/");
   }
 //  catch (const SourcesAlreadyRestoredException& excpt) {
@@ -54,7 +54,7 @@ void init_system_sources()
   {
     ZYPP_CAUGHT (excpt_r);
     ERR << "Couldn't restore sources" << endl;
-    cerr << "Failed to restore sources" << endl;
+    cerr << _("Failed to restore sources") << endl;
     exit(-1);
   }
     
@@ -77,7 +77,7 @@ void include_source_by_url( const Url &url )
   }
   catch( const Exception & excpt_r )
   {
-    cerr << "Can't access repository" << endl;
+    cerr << _("Can't access repository") << endl;
     ZYPP_CAUGHT( excpt_r );
     exit(-1);
   }
@@ -95,9 +95,9 @@ static void print_source_list(const std::list<SourceInfo> &sources )
   Table tbl;
   TableHeader th;
   th << "#";
-  if (gSettings.is_rug_compatible) th << "Status";
-  else th << "Enabled" << "Refresh";
-  th << "Type" << "Name" << "URI";
+  if (gSettings.is_rug_compatible) th << _("Status");
+  else th << _("Enabled") << _("Refresh");
+  th << _("Type") << _("Name") << "URI";
   tbl << th;
 
   int i = 1;
@@ -113,20 +113,20 @@ static void print_source_list(const std::list<SourceInfo> &sources )
     if (gSettings.is_rug_compatible)
     {
 #ifdef LIBZYPP_1xx
-      tr << "Active";
+      tr << _("Active");
 #else
-      tr << (source.enabled() ? "Active" : "Disabled");
+      tr << (source.enabled() ? _("Active") : _("Disabled"));
 #endif
     }
     // zypper status (enabled, autorefresh)
     else
     {
 #ifdef LIBZYPP_1xx
-      tr << "Yes";
-      tr << (source.autorefresh ? "Yes" : "No");
+      tr << _("Yes");
+      tr << (source.autorefresh ? _("Yes") : _("No"));
 #else
-      tr << (source.enabled() ? "Yes" : "No");
-      tr << (source.autorefresh() ? "Yes" : "No");
+      tr << (source.enabled() ? _("Yes") : _("No"));
+      tr << (source.autorefresh() ? _("Yes") : _("No"));
 #endif
     }
 
@@ -160,7 +160,7 @@ void list_system_sources()
   }
   catch ( const Exception &e )
   {
-    cout << "Error reading system sources: " << e.msg() << std::endl;
+    cout << _("Error reading system sources: ") << e.msg() << std::endl;
     exit(-1); 
   }
   
@@ -187,7 +187,7 @@ bool parse_repo_file (const string& file, string& url, string& alias)
     else if (regex_search (line, match, r_type)) {
       string type = match[1];
       if (type != "rpm-md" && type != "yast2") {
-       cerr << "Unknown repository type " << type << endl;
+       cerr << _("Unknown repository type ") << type << endl;
        return false;
       }
     }
@@ -199,10 +199,10 @@ bool parse_repo_file (const string& file, string& url, string& alias)
   repo.close ();
 
   if (!have_alias) {
-    cerr << "Name not found" << endl;
+    cerr << _("Name not found") << endl;
   }  
   if (!have_url) {
-    cerr << "baseurl not found" << endl;
+    cerr << _("baseurl not found") << endl;
   }  
   cerr_vv << "Name: " << alias << endl;
   cerr_vv << "URL: " << url << endl;
@@ -327,20 +327,20 @@ void remove_source( const std::string& anystring )
     // we want to delete anyway
     ZYPP_CAUGHT (ex);
     cerr << ex.asUserString () << endl
-        << "Continuing anyway" << endl;
+        << _("Continuing anyway") << endl;
   }
 
   SourceManager::SourceId sid = 0;
   safe_lexical_cast (anystring, sid);
   if (sid > 0) {
-    cerr_v << "removing source " << sid << endl;
+    cerr_v << _("removing source ") << sid << endl;
     try {
       manager->findSource (sid);
     }
     catch (const Exception & ex) {
       ZYPP_CAUGHT (ex);
       // boost::format: %s is fine regardless of the actual type :-)
-      cerr << format ("Source %s not found.") % sid << endl;
+      cerr << format (_("Source %s not found.")) % sid << endl;
     }
     manager->removeSource (sid);
   }
@@ -356,7 +356,7 @@ void remove_source( const std::string& anystring )
        }
        catch ( const Exception & excpt_r ) {
          ZYPP_CAUGHT( excpt_r );
-         cerr << "URL is invalid: " << excpt_r.asUserString() << endl;
+         cerr << _("URL is invalid: ") << excpt_r.asUserString() << endl;
        }
        if (url.isValid ()) {
          try {
@@ -364,7 +364,7 @@ void remove_source( const std::string& anystring )
          }
          catch (const Exception & ex) {
            ZYPP_CAUGHT (ex);
-           cerr << format ("Source %s not found.") % url.asString() << endl;
+           cerr << format (_("Source %s not found.")) % url.asString() << endl;
          }
          manager->removeSourceByUrl (url);
        }
@@ -376,7 +376,7 @@ void remove_source( const std::string& anystring )
       }
       catch (const Exception & ex) {
        ZYPP_CAUGHT (ex);
-       cerr << format ("Source %s not found.") % anystring << endl;
+       cerr << format (_("Source %s not found.")) % anystring << endl;
       }
       manager->removeSource (anystring);       // by alias
     }
@@ -409,7 +409,7 @@ void rename_source( const std::string& anystring, const std::string& newalias )
     catch (const Exception & ex) {
       ZYPP_CAUGHT (ex);
       // boost::format: %s is fine regardless of the actual type :-)
-      cerr << format ("Source %s not found.") % sid << endl;
+      cerr << format (_("Source %s not found.")) % sid << endl;
     }
   }
   else {
@@ -424,7 +424,7 @@ void rename_source( const std::string& anystring, const std::string& newalias )
        }
        catch ( const Exception & excpt_r ) {
          ZYPP_CAUGHT( excpt_r );
-         cerr << "URL is invalid: " << excpt_r.asUserString() << endl;
+         cerr << _("URL is invalid: ") << excpt_r.asUserString() << endl;
        }
        if (url.isValid ()) {
          try {
@@ -432,7 +432,7 @@ void rename_source( const std::string& anystring, const std::string& newalias )
          }
          catch (const Exception & ex) {
            ZYPP_CAUGHT (ex);
-           cerr << format ("Source %s not found.") % url.asString() << endl;
+           cerr << format (_("Source %s not found.")) % url.asString() << endl;
          }
        }
     }
@@ -443,7 +443,7 @@ void rename_source( const std::string& anystring, const std::string& newalias )
       }
       catch (const Exception & ex) {
        ZYPP_CAUGHT (ex);
-       cerr << format ("Source %s not found.") % anystring << endl;
+       cerr << format (_("Source %s not found.")) % anystring << endl;
       }
     }
   }
@@ -461,7 +461,7 @@ void rename_source( const std::string& anystring, const std::string& newalias )
 void refresh_sources()
 {
 #ifdef LIBZYPP_1xx
-  cerr << "Sorry, not implemented yet for libzypp-1.x.x" << endl;
+  cerr << _("Sorry, not implemented yet for libzypp-1.x.x") << endl;
 #else
   zypp::storage::PersistentStorage store;
   std::list<SourceInfo> sources;
@@ -489,7 +489,7 @@ void refresh_sources()
         false, // base source
         true); // autorefresh
 //      src.refresh();
-      cout << "DONE" << endl << endl;
+      cout << _("DONE") << endl << endl;
     }
     catch ( const zypp::Exception & ex )
     {
@@ -519,7 +519,7 @@ MediaWrapper::MediaWrapper (const string& filename_or_url) {
   catch (const Exception & ex) {
     ZYPP_CAUGHT (ex);
     if (looks_like_url (filename_or_url)) {
-    cerr << "Error while fetching " << filename_or_url << " : "
+    cerr << _("Error while fetching ") << filename_or_url << " : "
         << ex << endl;
 //      ex.dumpOn (cerr);              // this suxxz
     }
@@ -535,9 +535,9 @@ MediaWrapper::~MediaWrapper () {
 // #217028
 void warn_if_zmd () {
   if (system ("pgrep -lx zmd") == 0) { // list name, exact match
-    cerr << "ZENworks Management Daemon is running." << endl
-        << "WARNING: this command will not synchronize changes." << endl
-        << "Use rug or yast2 for that." << endl;
+    cerr << _("ZENworks Management Daemon is running.") << endl
+        << _("WARNING: this command will not synchronize changes.") << endl
+        << _("Use rug or yast2 for that.") << endl;
   }
 }
 
index aabdd04..763c4a7 100644 (file)
@@ -22,7 +22,7 @@ void display_done () {
 int read_action_ari () {
   // TODO: respect --yes (abort)
   while (true) {
-    cerr << "(A)bort, (R)etry, (I)gnore?" << endl;
+    cerr << _("(A)bort, (R)etry, (I)gnore?") << endl; // don't translate letters in parentheses!!
     char c;
     cin >> c;
     c = tolower (c);
index 32b4df5..b5114c2 100644 (file)
@@ -1,6 +1,8 @@
 #include "zypper-getopt.h"
+#include "zmart.h"
 #include <iostream>
 #include <zypp/base/String.h>
+
 using namespace std;
 
 string longopts2optstring (const struct option *longopts) {
@@ -51,10 +53,10 @@ parsed_opts parse_options (int argc, char **argv,
     switch (optc) {
     case '?':
       result["_unknown"].push_back("");
-      cerr << "Unknown option " << argv[optind - 1] << endl;
+      cerr << _("Unknown option ") << argv[optind - 1] << endl;
       break;
     case ':':
-      cerr << "Missing argument for " << argv[optind - 1] << endl;
+      cerr << _("Missing argument for ") << argv[optind - 1] << endl;
       break;
     default:
       const char *mapidx = optc? short2long[optc] : longopts[option_index].name;
index 5c03bf8..3060d4c 100644 (file)
@@ -45,11 +45,11 @@ void printInfo(const string & command, const vector<string> & arguments) {
       );
 
     if (!installer.item) {
-      cout << "\n" << kind.asString() << " " << *nameit << " not found." << endl;
+      cout << "\n" << kind.asString() << " " << *nameit << _(" not found.") << endl;
     }
     else {
       // print info
-      cout << "\nInformation for " << kind.asString() << " " << *nameit << ":\n\n";
+      cout << endl << _("Information for ") << kind.asString() << " " << *nameit << ":\n\n";
 
       if (command == "info" || command == "if")
         printPkgInfo(installer.item,installed);
@@ -81,26 +81,26 @@ Copy and modify /usr/share/vim/current/gvimrc to ~/.gvimrc if needed.
  */
 void printPkgInfo(const PoolItem & pool_item, const PoolItem & ins_pool_item) {
 
-  cout << "Catalog: " << pool_item.resolvable()->source().alias() << endl;
-  cout << "Name: " << pool_item.resolvable()->name() << endl;
-  cout << "Version: " << pool_item.resolvable()->edition().asString() << endl;
-  cout << "Arch: " << pool_item.resolvable()->arch().asString() << endl;
-  cout << "Installed: " << (!ins_pool_item ? "No" : "Yes") << endl;
+  cout << _("Catalog: ") << pool_item.resolvable()->source().alias() << endl;
+  cout << _("Name: ") << pool_item.resolvable()->name() << endl;
+  cout << _("Version: ") << pool_item.resolvable()->edition().asString() << endl;
+  cout << _("Arch: ") << pool_item.resolvable()->arch().asString() << endl;
+  cout << _("Installed: ") << (!ins_pool_item ? "No" : "Yes") << endl;
 
-  cout << "Status: ";
+  cout << _("Status: ");
   if (ins_pool_item &&
       ins_pool_item.resolvable()->edition() >= pool_item.resolvable()->edition())
-    cout << "up-to-date" << endl;
+    cout << _("up-to-date") << endl;
   else if (ins_pool_item) {
-    cout << "out-of-date (version " << ins_pool_item.resolvable()->edition()
-      << " installed) " << endl;
+    cout << _("out-of-date (version ") << ins_pool_item.resolvable()->edition()
+      << _(" installed) ") << endl; // TODO use sformat for this for proper translation
   }
   else
-    cout << "not installed" << endl;
+    cout << _("not installed") << endl;
 
-  cout << "Installed Size: " << pool_item.resolvable()->size().asString() << endl;
-  cout << "Summary: " << pool_item.resolvable()->summary() << endl;
-  cout << "Description: " << endl;
+  cout << _("Installed Size: ") << pool_item.resolvable()->size().asString() << endl;
+  cout << _("Summary: ") << pool_item.resolvable()->summary() << endl;
+  cout << _("Description: ") << endl;
 
   cout << pool_item.resolvable()->description() << endl;
 }
index 224a713..1b72456 100644 (file)
@@ -42,8 +42,8 @@ ZyppSearch::ZyppSearch (
 
   // no sources warning
   if (gData.sources.empty()) {
-    cerr << "No sources. Zypper currently searches within installation"
-        "sources only." << endl;
+    cerr << _("No sources. Zypper currently searches within installation"
+        "sources only.") << endl;
     exit(2); // TODO #define zypper error codes?
   }
 
@@ -104,7 +104,7 @@ void ZyppSearch::cacheInstalled() {
   if (_options.kind() != Resolvable::Kind())
     _icache.setIncludeKindInKey(false);
 
-  cout_v << "Pre-caching installed resolvables matching given search criteria... " << endl;
+  cout_v << _("Pre-caching installed resolvables matching given search criteria... ") << endl;
 
   ResStore tgt_resolvables(_zypp->target()->resolvables());
 
@@ -113,8 +113,8 @@ void ZyppSearch::cacheInstalled() {
   invokeOnEachSearched(Match(_reg,_options.searchDescriptions()),
     functorRef<bool,const zypp::PoolItem &>(_icache));
 
-  cout_v << _icache.size() << " out of (" <<  tgt_resolvables.size() << ")"  
-    "cached." << endl;
+  cout_v << _icache.size() << _(" out of (") <<  tgt_resolvables.size() << ")"  
+    << _("cached.") << endl;
 }
 
 /**
@@ -213,9 +213,9 @@ void ZyppSearch::setupRegexp() {
   }
   catch (regex_error & e) {
     cerr << "ZyppSearch::setupRegexp(): " << regstr
-      << " is not a valid regular expression: \""
+      << _(" is not a valid regular expression: \"")
       << e.what() << "\"" << endl;
-    cerr << "This is a bug, please file a bug report against zypper." << endl;
+    cerr << _("This is a bug, please file a bug report against zypper.") << endl;
     exit(1);
   }
 }
index 09807b9..59e8391 100644 (file)
@@ -66,7 +66,7 @@ Url make_url (const string & url_s) {
   }
   catch ( const Exception & excpt_r ) {
     ZYPP_CAUGHT( excpt_r );
-    cerr << "URL is invalid." << endl;
+    cerr << _("URL is invalid.") << endl;
     cerr << excpt_r.asUserString() << endl;
     
   }
@@ -117,18 +117,18 @@ string process_globals(int argc, char **argv)
   if (gopts.count("help"))
     ghelp = true;
 
-  string help_global_options = "  Options:\n"
+  string help_global_options = _("  Options:\n"
     "\t--help, -h\t\tHelp\n"
     "\t--version, -V\t\tOutput the version number\n"
     "\t--verbose, -v\t\tIncrease verbosity\n"
     "\t--terse, -t\t\tTerse output for machine consumption\n"
     "\t--table-style, -s\tTable style (integer)\n"
-    "\t--rug-compatible, -r\tTurn on rug compatibility\n"
+    "\t--rug-compatible, -r\tTurn on rug compatibility\n");
     ;
 
   if (gopts.count("verbose")) {
     gSettings.verbose += gopts["verbose"].size();
-    cerr << "verbosity " << gSettings.verbose << endl;
+    cerr << _("verbosity ") << gSettings.verbose << endl;
   }
 
   if (gopts.count("table-style")) {
@@ -137,7 +137,7 @@ string process_globals(int argc, char **argv)
     if (s < _End)
       Table::defaultStyle = (TableStyle) s;
     else
-      cerr << "Invalid table style " << s << endl;
+      cerr << _("Invalid table style ") << s << endl;
   }
   // testing option
   if (gopts.count("opt")) {
@@ -174,7 +174,7 @@ string process_globals(int argc, char **argv)
       cerr << endl;
     }
     else {
-      cerr << "Try -h for help" << endl;
+      cerr << _("Try -h for help") << endl;
     }
   }
 
@@ -191,14 +191,15 @@ int one_command(const string& command, int argc, char **argv)
   struct option *specific_options = &no_options;
   string specific_help;
 
-  string help_global_source_options = "  Source options:\n"
+  string help_global_source_options = _(
+      "  Source options:\n"
       "\t--disable-system-sources, -D\t\tDon't read the system sources\n"
       "\t--source, -S\t\tRead additional source\n"
-      ;
+      );
 
-  string help_global_target_options = "  Target options:\n"
+  string help_global_target_options = _("  Target options:\n"
       "\t--disable-system-resolvables, -T\t\tDon't read system installed resolvables\n"
-      ;
+      );
 
   if (command == "install" || command == "in") {
     static struct option install_options[] = {
@@ -209,11 +210,12 @@ int one_command(const string& command, int argc, char **argv)
       {0, 0, 0, 0}
     };
     specific_options = install_options;
-    specific_help = "  Command options:\n"
+    specific_help = _(
+      "  Command options:\n"
       "\t--catalog,-c\t\tOnly from this catalog (FIXME)\n"
       "\t--type,-t\t\tType of resolvable (default: package)\n"
       "\t--no-confirm,-y\tDon't require user confirmation\n"
-      ;
+      );
   }
   else if (command == "remove" || command == "rm") {
     static struct option remove_options[] = {
@@ -223,10 +225,11 @@ int one_command(const string& command, int argc, char **argv)
       {0, 0, 0, 0}
     };
     specific_options = remove_options;
-    specific_help = "  Command options:\n"
+    specific_help = _(
+      "  Command options:\n"
       "\t--type,-t\t\tType of resolvable (default: package)\n"
       "\t--no-confirm,-y\tDon't require user confirmation\n"
-      ;
+      );
   }
   else if (command == "service-add" || command == "sa") {
     static struct option service_add_options[] = {
@@ -238,7 +241,8 @@ int one_command(const string& command, int argc, char **argv)
       {0, 0, 0, 0}
     };
     specific_options = service_add_options;
-    specific_help = "service-add [options] URI [alias]\n"
+    specific_help = _(
+      "service-add [options] URI [alias]\n"
       "\n"
       "Add a service (installation source) to the system."
       "\n"
@@ -248,7 +252,7 @@ int one_command(const string& command, int argc, char **argv)
       "\t--type,-t <TYPE>\tType of repository (YaST, YUM, or Plaindir)\n"
       "\t--disabled,-d\t\tAdd the service as disabled\n"
       "\t--no-refresh,-n\t\tDo not automatically refresh the metadata\n"
-      ;
+      );
   }
   else if (command == "service-list" || command == "sl") {
     static struct option service_list_options[] = {
@@ -256,12 +260,13 @@ int one_command(const string& command, int argc, char **argv)
       {0, 0, 0, 0}
     };
     specific_options = service_list_options;
-    specific_help = "service-list\n"
+    specific_help = _(
+      "service-list\n"
       "\n"
       "List all defined system services (installation sources)."
       "\n"
       "This command has no options.\n"
-      ;
+      );
   }
   else if (command == "service-delete" || command == "sd") {
     static struct option service_delete_options[] = {
@@ -269,12 +274,13 @@ int one_command(const string& command, int argc, char **argv)
       {0, 0, 0, 0}
     };
     specific_options = service_delete_options;
-    specific_help = "service-delete [options] <URI|alias>\n"
+    specific_help = _(
+      "service-delete [options] <URI|alias>\n"
       "\n"
       "Remove service (installation source) from the system."
       "\n"
       "This command has no options.\n"
-      ;
+      );
   }
   else if (command == "service-rename" || command == "sr") {
     static struct option service_rename_options[] = {
@@ -282,12 +288,13 @@ int one_command(const string& command, int argc, char **argv)
       {0, 0, 0, 0}
     };
     specific_options = service_rename_options;
-    specific_help = "service-rename [options] <URI|alias> <new-alias>\n"
+    specific_help = _(
+      "service-rename [options] <URI|alias> <new-alias>\n"
       "\n"
       "Assign new alias to the service specified by URI or current alias."
       "\n"
       "This command has no options.\n"
-      ;
+      );
   }
   else if (command == "refresh" || command == "ref") {
     static struct option refresh_options[] = {
@@ -295,10 +302,11 @@ int one_command(const string& command, int argc, char **argv)
       {0, 0, 0, 0}
     };
     specific_options = refresh_options;
-    specific_help = _("zypper refresh\n"
+    specific_help = _(
+      "zypper refresh\n"
       "\n"
-      "Refresh all installation sources found in system.\n")
-      ;
+      "Refresh all installation sources found in system.\n"
+      );
   }
   else if (command == "list-updates" || command == "lu") {
     static struct option list_updates_options[] = {
@@ -307,13 +315,14 @@ int one_command(const string& command, int argc, char **argv)
       {0, 0, 0, 0}
     };
     specific_options = list_updates_options;
-    specific_help = "list-updates [options]\n"
+    specific_help = _(
+      "list-updates [options]\n"
       "\n"
       "List all available updates\n"
       "\n"
       "  Command options:\n"
       "\t--type,-t\t\tType of resolvable (default: patch!)\n"
-      ;
+      );
   }
   else if (command == "update" || command == "up") {
     static struct option update_options[] = {
@@ -324,11 +333,12 @@ int one_command(const string& command, int argc, char **argv)
       {0, 0, 0, 0}
     };
     specific_options = update_options;
-    specific_help = "  Command options:\n"
+    specific_help = _(
+      "  Command options:\n"
       "\t--type,-t\t\tType of resolvable (default: patch!)\n"
       "\t--no-confirm,-y\t\tDon't require user confirmation\n"
       "\t--skip-interactive\t\tSkip interactive updates\n"
-      ;
+      );
   }
   else if (command == "search" || command == "se") {
     static struct option search_options[] = {
@@ -348,7 +358,7 @@ int one_command(const string& command, int argc, char **argv)
       {0, 0, 0, 0}
     };
     specific_options = search_options;
-    specific_help =
+    specific_help = _(
       "zypper [global-options] search [options] [querystring...]\n"
       "\n"
       "'search' - Search for packages matching given search strings\n"
@@ -368,7 +378,7 @@ int one_command(const string& command, int argc, char **argv)
       "    --sort-by-catalog      Sort packages by catalog.\n" // ??? catalog/source?
       "\n"
       "* and ? wildcards can also be used within search strings.\n"
-      ;
+      );
   }
   else if (command == "patch-check" || command == "pchk") {
     static struct option patch_check_options[] = {
@@ -376,12 +386,13 @@ int one_command(const string& command, int argc, char **argv)
       {0, 0, 0, 0}
     };
     specific_options = patch_check_options;
-    specific_help = "patch-check\n"
+    specific_help = _(
+      "patch-check\n"
       "\n"
       "Check for available patches\n"
       "\n"
       "This command has no options.\n"
-      ;
+      );
   }
   else if (command == "patches" || command == "pch") {
     static struct option patches_options[] = {
@@ -389,12 +400,13 @@ int one_command(const string& command, int argc, char **argv)
       {0, 0, 0, 0}
     };
     specific_options = patches_options;
-    specific_help = "patches\n"
+    specific_help = _(
+      "patches\n"
       "\n"
       "List all available patches\n"
       "\n"
       "This command has no options.\n"
-      ;
+      );
   }
   else if (command == "info" || command == "if") {
     static struct option info_options[] = {
@@ -402,11 +414,11 @@ int one_command(const string& command, int argc, char **argv)
       {0, 0, 0, 0}
     };
     specific_options = info_options;
-    specific_help =
+    specific_help = _(
       "zypper [global-options] info [name...]\n"
       "\n"
       "'info' - Show full information for packages\n"
-      ;
+      );
   }
   else if (command == "patch-info") {
     static struct option patch_info_options[] = {
@@ -414,11 +426,11 @@ int one_command(const string& command, int argc, char **argv)
       {0, 0, 0, 0}
     };
     specific_options = patch_info_options;
-    specific_help =
+    specific_help = _(
       "zypper [global-options] patch-info [patchname...]\n"
       "\n"
       "'patch-info' - Show detailed information for patches\n"
-      ;
+      );
   }
   else if (command == "moo") {
     static struct option moo_options[] = {
@@ -426,14 +438,14 @@ int one_command(const string& command, int argc, char **argv)
       {0, 0, 0, 0}
     };
     specific_options = moo_options;
-    specific_help =
+    specific_help = _(
       "zypper [global-options] moo\n"
       "\n"
       "'moo' - Show an animal\n"
-      ;
+      );
   }
   else if (!command.empty()) { // empty command is treated earlier
-    cerr << "Unknown command '" << command << "'." << endl << endl;
+    cerr << _("Unknown command") << " '" << command << "'." << endl << endl;
     cerr << help_commands;
     return ZYPPER_EXIT_ERR_SYNTAX;
   }
@@ -448,7 +460,7 @@ int one_command(const string& command, int argc, char **argv)
 
   vector<string> arguments;
   if (optind < argc) {
-    cerr_v << "non-option ARGV-elements: ";
+    cerr_v << _("non-option ARGV-elements: ");
     while (optind < argc) {
       string argument = argv[optind++];
       cerr_v << argument << ' ';
@@ -460,26 +472,26 @@ int one_command(const string& command, int argc, char **argv)
   // === process options ===
 
   if (gopts.count("terse")) {
-      cerr_v << "FAKE Terse" << endl;
+      cerr_v << _("FAKE terse") << endl;
   }
 
   if (gopts.count("disable-system-sources"))
   {
-    MIL << "system sources disabled" << endl;
+    MIL << _("system sources disabled") << endl;
     gSettings.disable_system_sources = true;
   }
   else
   {
-    MIL << "system sources enabled" << endl;
+    MIL << _("system sources enabled") << endl;
   }
 
   if (gopts.count("disable-system-resolvables"))
   {
-    MIL << "system resolvables disabled" << endl;
-    cerr << "Ignoring installed resolvables..." << endl;
+    MIL << _("system resolvables disabled") << endl;
+    cerr << _("Ignoring installed resolvables...") << endl;
     gSettings.disable_system_resolvables = true;
   }
-  
+
   if (gopts.count("source")) {
     list<string> sources = gopts["source"];
     for (list<string>::const_iterator it = sources.begin(); it != sources.end(); ++it )
@@ -498,8 +510,8 @@ int one_command(const string& command, int argc, char **argv)
   }
   catch (Exception & excpt_r) {
     ZYPP_CAUGHT (excpt_r);
-    ERR  << "a ZYpp transaction is already in progress." << endl;
-    cerr << "a ZYpp transaction is already in progress." << endl;
+    ERR  << _("a ZYpp transaction is already in progress.") << endl;
+    cerr << _("a ZYpp transaction is already in progress.") << endl;
     return ZYPPER_EXIT_ERR_ZYPP;
   }
 
@@ -526,7 +538,7 @@ int one_command(const string& command, int argc, char **argv)
 
     if ( geteuid() != 0 )
     {
-      cerr << "Sorry, you need root privileges to view system sources." << endl;
+      cerr << _("Sorry, you need root privileges to view system sources.") << endl;
       return ZYPPER_EXIT_ERR_PRIVILEGES;
     }
     
@@ -544,7 +556,7 @@ int one_command(const string& command, int argc, char **argv)
 
     string type = copts.count("type")?  copts["type"].front() : "";
     if (type != "" && type != "YaST" && type != "YUM" && type != "Plaindir") {
-      cerr << "Warning, unknown metadata type " << type << endl;
+      cerr << _("Warning, unknown metadata type ") << type << endl;
     }
 
     string repoalias, repourl;
@@ -681,7 +693,7 @@ int one_command(const string& command, int argc, char **argv)
     string skind = copts.count("type")?  copts["type"].front() : "package";
     kind = string_to_kind (skind);
     if (kind == ResObject::Kind ()) {
-      cerr << "Unknown resolvable type " << skind << endl;
+      cerr << _("Unknown resolvable type ") << skind << endl;
       return ZYPPER_EXIT_ERR_INVALID_ARGS;
     }
 
@@ -694,7 +706,7 @@ int one_command(const string& command, int argc, char **argv)
   
     if ( gData.sources.empty() )
       {
-       cerr << "Warning! No sources. Operating only over the installed resolvables. You will not be able to install stuff" << endl;
+       cerr << _("Warning! No sources. Operating only over the installed resolvables. You will not be able to install stuff.") << endl;
       } 
 
     cond_init_target ();
@@ -739,7 +751,7 @@ int one_command(const string& command, int argc, char **argv)
       string skind = copts["type"].front();
       kind = string_to_kind (skind);
       if (kind == ResObject::Kind ()) {
-        cerr << "Unknown resolvable type " << skind << endl;
+        cerr << _("Unknown resolvable type ") << skind << endl;
         return ZYPPER_EXIT_ERR_INVALID_ARGS;
       }
       options.setKind(kind);
@@ -825,7 +837,7 @@ int one_command(const string& command, int argc, char **argv)
       gSettings.is_rug_compatible? "package" : "patch";
     kind = string_to_kind (skind);
     if (kind == ResObject::Kind ()) {
-       cerr << "Unknown resolvable type " << skind << endl;
+       cerr << _("Unknown resolvable type ") << skind << endl;
        return ZYPPER_EXIT_ERR_INVALID_ARGS;
     }
 
@@ -853,7 +865,7 @@ int one_command(const string& command, int argc, char **argv)
       gSettings.is_rug_compatible? "package" : "patch";
     kind = string_to_kind (skind);
     if (kind == ResObject::Kind ()) {
-       cerr << "Unknown resolvable type " << skind << endl;
+       cerr << _("Unknown resolvable type ") << skind << endl;
        return ZYPPER_EXIT_ERR_INVALID_ARGS;
     }