[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH 4/4] Use gettext.ldngettext when necessary (#467603)



Hi,

See comments.

On 06/02/2009 05:51 AM, David Cantrell wrote:

<snip>

diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 8215dc4..e75d6c6 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py

Missing definition of P_

@@ -1216,15 +1216,18 @@ class PartitionWindow(InstallWindow):
          maintable.set_col_spacings(5)
          row = 0

-	lbltxt = _("Software RAID allows you to combine "
-		   "several disks into a larger "
-		   "RAID device.  A RAID device can be configured to "
-		   "provide additional speed and "
-		   "reliability compared to using an individual drive.  "
-		   "For more information on using RAID devices "
-		   "please consult the %s documentation.\n\n"
-		   "You currently have %s software RAID "
-		   "partition(s) free to use.\n\n") % (productName, len(availraidparts))
+	numparts = P_("You currently have %d software RAID partition free to use.",
+		    "You currently have %d software RAID partitions free to use.",
+		    len(availraidparts))
+

Missing "% len(availraidparts)" at the end.

+	lbltxt = _("Software RAID allows you to combine several disks into "
+		    "a larger RAID device.  A RAID device can be configured "
+		    "to provide additional speed and reliability compared "
+		    "to using an individual drive.  For more information on "
+		    "using RAID devices please consult the %s "
+		    "documentation.") % (productName,)
+
+	lbltxt = lbltxt + "\n\n" + numparts + "\n\n"

          if len(availraidparts)<  2:
  	    lbltxt = lbltxt + _("To use RAID you must first "

<snip>

diff --git a/text.py b/text.py
index 70a5331..3d1c63d 100644
--- a/text.py
+++ b/text.py
@@ -40,6 +40,7 @@ import imputil

  import gettext
  _ = lambda x: gettext.ldgettext("anaconda", x)
+P_ = lambda x, y, z: gettext.ldngettext("anaconda", x, y, z)

  import logging
  log = logging.getLogger("anaconda")
@@ -369,8 +370,12 @@ class LuksPassphraseWindow:
                  if len(passphrase)<  self.minLength:
                      ButtonChoiceWindow(self.screen,
                                         _("Error with passphrase"),
-                                       _("The passphrase must be at least "
-                                         "%d characters long.") % (self.minLength,),
+                                       P_("The passphrase must be at least "
+                                          "%d character long.",
+                                          "The passphrase must be at least "
+                                          "%d characters long.",
+                                          self.minLength)
+                                         % (self.minLength,),
                                         buttons=[TEXT_OK_BUTTON])
                      passphraseentry.set("")
                      confirmentry.set("")


A+ for consistency, but are we ever going to have a minimum password
length of 1 character ?

diff --git a/vnc.py b/vnc.py
index 3e5d813..db119d0 100644
--- a/vnc.py
+++ b/vnc.py
@@ -32,6 +32,7 @@ import subprocess

  import gettext
  _ = lambda x: gettext.ldgettext("anaconda", x)
+P_ = lambda x, y, z: gettext.ldngettext("anaconda", x, y, z)

  import logging
  log = logging.getLogger("anaconda")
@@ -185,7 +186,9 @@ class VncServer:
              else:
                  log.critical(err)
                  sys.exit(1)
-        self.log.error(_("Giving up attempting to connect after %d tries!\n" % maxTries ))
+        self.log.error(P_("Giving up attempting to connect after %d try!\n",
+                          "Giving up attempting to connect after %d tries!\n",
+                          maxTries) % (maxTries,))
          return False

      def VNCListen(self):

Same here, are we ever going to have a maxTries of 1 ?

diff --git a/yuminstall.py b/yuminstall.py
index 0e7a4da..b39ecb9 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -51,6 +51,7 @@ import packages

  import gettext
  _ = lambda x: gettext.ldgettext("anaconda", x)
+P_ = lambda x, y, z: gettext.ldngettext("anaconda", x, y, z)

  import network

@@ -81,10 +82,7 @@ def size_string (size):
          size = size / 1024
          retval = _("%s KB") %(number_format(size),)
      else:
-        if size == 1:
-            retval = _("%s Byte") %(number_format(size),)
-        else:
-            retval = _("%s Bytes") %(number_format(size),)
+        retval = P_("%s Byte", "%s Bytes", size) % (number_format(size),)

      return to_unicode(retval)

@@ -209,8 +207,10 @@ class AnacondaCallback:
              self.doneFiles += len(hdr[rpm.RPMTAG_BASENAMES])

              if self.donepkgs<= self.numpkgs:
-                self.progress.set_text(_("%s of %s packages completed")
-                                       %(self.donepkgs, self.numpkgs))
+                self.progress.set_text(P_("Packages completed: %d of %d",
+                                          "Packages completed: %d of %d",
+                                          self.numpkgs)
+                                       % (self.donepkgs, self.numpkgs,))
              self.progress.set_fraction(float(self.doneSize / self.totalSize))
              self.progress.processEvents()


Here the singular form and the plural form of the string are the same, so this
hunk is not needed.

Regards,

Hans


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]