[Apt-listbugs-commits] [apt-listbugs] 01/02: enhance i18n of error and warning messages

Francesco Poli frx-guest at moszumanska.debian.org
Sun May 25 15:38:57 UTC 2014


This is an automated email from the git hooks/post-receive script.

frx-guest pushed a commit to branch master
in repository apt-listbugs.

commit 253ca464f932b0403002b98ffaf88257a73f3045
Author: Francesco Poli (wintermute) <invernomuto at paranoici.org>
Date:   Sun May 25 17:35:11 2014 +0200

    enhance i18n of error and warning messages
---
 apt-listbugs              | 19 ++++++++++---------
 debian/changelog          |  1 +
 lib/apt-listbugs/logic.rb | 21 +++++++++++----------
 3 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/apt-listbugs b/apt-listbugs
index 2720b85..90cd914 100755
--- a/apt-listbugs
+++ b/apt-listbugs
@@ -320,7 +320,8 @@ GetText::bindtextdomain("apt-listbugs")
 begin
   require 'debian'
 rescue LoadError
-  $stderr.puts "E: #{$!}"
+  # TRANSLATORS: "E: " is a label for error messages; you may translate it with a suitable abbreviation of the word "error"
+  $stderr.puts _("E: ") + "#{$!}"
   $stderr.puts _("This may be caused by a ruby-debian package lacking support for the ruby interpreter in use. Try to fix the situation with the following commands:")
   $stderr.puts "  # mv /etc/apt/apt.conf.d/10apt-listbugs /root/"
   $stderr.puts "  # aptitude update"
@@ -358,18 +359,18 @@ when "apt"
   puts if $DEBUG
   puts "Preparing to read info from file descriptor \"#{apt_hook_fd}\"" if $DEBUG
   if apt_hook_fd.nil?
-    $stderr.print _("E: APT_HOOK_INFO_FD is undefined.\n")
+    $stderr.print _("E: ") + _("APT_HOOK_INFO_FD is undefined.\n")
     exit 1
   end
   apt_hook_fd = apt_hook_fd.to_i
   if apt_hook_fd == 0
-    $stderr.print _("E: APT_HOOK_INFO_FD is not correctly defined.\n")
+    $stderr.print _("E: ") + _("APT_HOOK_INFO_FD is not correctly defined.\n")
     exit 1
   end
   begin
     apt_hook_stream = IO.open(apt_hook_fd, 'r')
   rescue Errno::ENOENT
-    $stderr.puts sprintf(_("E: Cannot read from file descriptor %d"), apt_hook_fd)
+    $stderr.puts _("E: ") + sprintf(_("Cannot read from file descriptor %d"), apt_hook_fd)
     exit 1
   end
   puts if $DEBUG
@@ -383,7 +384,7 @@ when "apt"
         puts "#{pkg}" if $DEBUG
         state=2
       else
-        $stderr.print _("E: APT Pre-Install-Pkgs is not giving me expected 'VERSION 3' string.\n")
+        $stderr.print _("E: ") + _("APT Pre-Install-Pkgs is not giving me expected 'VERSION 3' string.\n")
         exit 1
       end
     when 2
@@ -413,7 +414,7 @@ when "apt"
       when "**REMOVE**"
         # none
       when nil
-        $stderr.print _("E: APT Pre-Install-Pkgs is giving me fewer fields than expected.\n")
+        $stderr.print _("E: ") + _("APT Pre-Install-Pkgs is giving me fewer fields than expected.\n")
         exit 1
       else
         case direction
@@ -444,7 +445,7 @@ when "apt"
             end
           end
         else
-          $stderr.print _("E: APT Pre-Install-Pkgs is giving me an invalid direction of version change.\n")
+          $stderr.print _("E: ") + _("APT Pre-Install-Pkgs is giving me an invalid direction of version change.\n")
           exit 1
         end
       end
@@ -493,7 +494,7 @@ begin
     config.frontend.progress(msg, val) if config.quiet == false
   }
 rescue
-  config.frontend.puts " ... E: #{$!}"
+  config.frontend.puts _("E: ") + "#{$!}"
   exit 1
 end
 
@@ -506,7 +507,7 @@ begin
     config.frontend.progress(msg, val) if config.quiet == false
   }
 rescue
-  config.frontend.puts " ... E: #{$!}"
+  config.frontend.puts _("E: ") + "#{$!}"
   exit 1
 end
 
diff --git a/debian/changelog b/debian/changelog
index ef572e2..3bc069e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,7 @@ apt-listbugs (0.1.14) UNRELEASED; urgency=medium
   * made the --force-pin option the new fallback mode for all cases
     where standard output is not a tty (this implies that unattended
     installations/upgrades will automatically pin buggy packages!)
+  * enhanced internationalization of error and warning messages
 
  -- Francesco Poli (wintermute) <invernomuto at paranoici.org>  Sun, 11 May 2014 16:45:18 +0200
 
diff --git a/lib/apt-listbugs/logic.rb b/lib/apt-listbugs/logic.rb
index 8426892..6f3f7c5 100644
--- a/lib/apt-listbugs/logic.rb
+++ b/lib/apt-listbugs/logic.rb
@@ -219,14 +219,15 @@ class AppConfig
 
     # warn the user about unknown (possibly misspelled) severities
     (@severity - all_severities).each { |unrec|
-      $stderr.puts sprintf(_("W: Unrecognized severity '%s' will be ignored by the Debian BTS."), unrec)
+      # TRANSLATORS: "W: " is a label for warnings; you may translate it with a suitable abbreviation of the word "warning"
+      $stderr.puts _("W: ") + sprintf(_("Unrecognized severity '%s' will be ignored by the Debian BTS."), unrec)
     }
 
     @title = "Debian Bugs (#{@severity.join(', ')})" if ! @title
 
     # http_proxy sanity check
     if ENV["HTTP_PROXY"] != nil && ENV["http_proxy"] == nil
-      $stderr.puts _("W: sanity check failed: environment variable http_proxy is unset and HTTP_PROXY is set.")
+      $stderr.puts _("W: ") + _("sanity check failed: environment variable http_proxy is unset and HTTP_PROXY is set.")
     end
 
     # enable proxy for SOAP
@@ -262,7 +263,7 @@ class AppConfig
     command = ARGV.shift
     case command
     when nil
-      STDERR.puts _("E: You need to specify a command.")
+      STDERR.puts _("E: ") + _("You need to specify a command.")
       usage
       exit 1
     when "list"
@@ -272,7 +273,7 @@ class AppConfig
     when "rss"
       @command = "rss"
     else
-      STDERR.puts _("E: Unknown command ") +  "'#{command}'."
+      STDERR.puts _("E: ") + _("Unknown command ") +  "'#{command}'."
       usage
       exit 1
     end
@@ -332,7 +333,7 @@ class IgnoreBugs < Array
       rescue Errno::EACCES
         # read-access is not possible, warn the user that the
         # file won't be taken into account
-        $stderr.puts sprintf(_("W: Cannot read from %s"), @path)
+        $stderr.puts _("W: ") + sprintf(_("Cannot read from %s"), @path)
       end
     end
 
@@ -350,7 +351,7 @@ class IgnoreBugs < Array
           # write-access is not possible, warn the user that the
           # file won't be updated
           if @gavewritewarning.nil?
-            $stderr.puts sprintf(_("W: Cannot write to %s"), @path)
+            $stderr.puts _("W: ") + sprintf(_("Cannot write to %s"), @path)
             @gavewritewarning = true
           end
         end
@@ -703,7 +704,7 @@ class Viewer
       if system(browsercommandline)
         puts "successfully invoked browser" if $DEBUG
       else
-        $stderr.puts _("W: Failed to invoke browser.")
+        $stderr.puts _("W: ") + _("Failed to invoke browser.")
         $stderr.puts " #{browsercommandline}"
       end
       clear_stdin
@@ -837,7 +838,7 @@ module Factory
       rescue SOAP::HTTPStreamError => exception
         config.frontend.puts _(" Fail")
         config.frontend.puts " Exception: " + exception.class.to_s if $DEBUG
-        $stderr.puts _(" E: HTTP GET failed")
+        $stderr.puts _("E: ") + _("HTTP GET failed")
         retrycount -= 1
         if config.frontend.yes_or_no?(_("Retry downloading bug information?")) && retrycount > 0
           config.parsestep = 1 if config.parsestep != 1 && config.frontend.yes_or_no?(_("One bug report at a time?"))
@@ -848,7 +849,7 @@ module Factory
       rescue SOAP::EmptyResponseError => exception
         config.frontend.puts _(" Fail")
         config.frontend.puts " Exception: " + exception.class.to_s if $DEBUG
-        $stderr.puts _(" E: Empty stream from SOAP")
+        $stderr.puts _("E: ") + _("Empty stream from SOAP")
         retrycount -= 1
         if config.frontend.yes_or_no?(_("Retry downloading bug information?")) && retrycount > 0
           config.parsestep = 1 if config.parsestep != 1 && config.frontend.yes_or_no?(_("One bug report at a time?"))
@@ -860,7 +861,7 @@ module Factory
         config.frontend.puts _(" Fail")
         config.frontend.puts " Exception: " + exception.class.to_s if $DEBUG
         config.frontend.puts _("Error retrieving bug reports from the server with the following error message:")
-        config.frontend.puts " W: #{$!}"
+        config.frontend.puts _("E: ") + "#{$!}"
         if exception.kind_of? SocketError
           config.frontend.puts _("It appears that your network connection is down. Check network configuration and try again")
         else

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/apt-listbugs/apt-listbugs.git



More information about the Apt-listbugs-commits mailing list