summaryrefslogtreecommitdiffstats
path: root/iw
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2009-05-27 17:00:49 -1000
committerDavid Cantrell <dcantrell@redhat.com>2009-06-03 09:28:49 -1000
commit777301cc123cb78631939caad3038ade24d724b6 (patch)
treecb66b823d6ebc53f0728e0e9bd3ab6593d97315e /iw
parent6104124defc97a4f65d31c1cc5c09e0716f6f3c1 (diff)
downloadanaconda-777301cc123cb78631939caad3038ade24d724b6.tar.gz
anaconda-777301cc123cb78631939caad3038ade24d724b6.tar.xz
anaconda-777301cc123cb78631939caad3038ade24d724b6.zip
Use gettext.ldngettext when necessary (#467603)
The i18n people have suggested using ngettext when we need to have singular and plural forms of strings, where the count will vary as to what we are reporting to the user. I've made the changes they have suggested. I created a new lambda function called P_() to use for the plural cases. P_() takes in three parameters: 1) The singular form of the string. 2) The plural form of the string. 3) A count. Here's an example: ....some loop runs doing stuff bytesWritten = 47 msg = P_("Wrote %d byte.", "Wrote %d bytes.", bytesWritten) % (bytesWritten,) print msg The % substitution is correct at the end because P_() returns a single string, so we only need the format string to account for that. Some strings have been changed slightly to make it easier for translations to other languages, particularly when choosing plural forms.
Diffstat (limited to 'iw')
-rw-r--r--iw/lvm_dialog_gui.py17
-rw-r--r--iw/partition_gui.py22
2 files changed, 24 insertions, 15 deletions
diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index 733b77602..18e140a8e 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -34,6 +34,7 @@ from storage.deviceaction import *
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")
@@ -764,12 +765,16 @@ class VolumeGroupEditor:
self.editLogicalVolume(lv)
def addLogicalVolumeCB(self, widget):
- if self.numAvailableLVSlots() < 1:
- self.intf.messageWindow(_("No free slots"),
- _("You cannot create more than %s logical "
- "volumes per volume group.") % (lvm.MAX_LV_SLOTS,), custom_icon="error")
- return
-
+ if self.numAvailableLVSlots() < 1:
+ self.intf.messageWindow(_("No free slots"),
+ P_("You cannot create more than %d logical volume "
+ "per volume group.",
+ "You cannot create more than %d logical volumes "
+ "per volume group.", lvm.MAX_LV_SLOTS)
+ % (lvm.MAX_LV_SLOTS,),
+ custom_icon="error")
+ return
+
(total, used, free) = self.computeSpaceValues()
if free <= 0:
self.intf.messageWindow(_("No free space"),
diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 8215dc45e..a08d07bf4 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -50,6 +50,7 @@ from storage.devices import devicePathToName, PartitionDevice
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")
@@ -1216,15 +1217,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)) % len(availraidparts,)
+
+ 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 "