[PATCH rhel7-branch 2/7] Change strings per stylistic advice from ECS (#1035898)

Chris Lumens clumens at redhat.com
Wed Jun 3 13:55:39 UTC 2015


From: David Shea <dshea at redhat.com>

Searched and replaced as follows:
  bootloader -> boot loader
  filesystem -> file system
  username -> user name
  [Vv]lan -> VLAN
  hostname -> host name
  ZFCP -> zFCP
  BTRFS -> Btrfs
  can not -> cannot
  mountpoint -> mount point

Also made the capitalization in the iSCSI dialog more consistent and
changed an iSCSI discovery string from past tense to some kind of
perfect tense.

Add a test for disadvised words.

(cherry picked from commit d3f67b6810e66a7125a25178419ac5207e33f01b)
---
 pyanaconda/bootloader.py                        |  44 +++++-----
 pyanaconda/errors.py                            |   2 +-
 pyanaconda/exception.py                         |   2 +-
 pyanaconda/install.py                           |   2 +-
 pyanaconda/network.py                           |   8 +-
 pyanaconda/ui/gui/spokes/advstorage/fcoe.glade  |   2 +-
 pyanaconda/ui/gui/spokes/advstorage/iscsi.glade |  16 ++--
 pyanaconda/ui/gui/spokes/custom.py              |   2 +-
 pyanaconda/ui/gui/spokes/datetime_spoke.glade   |   2 +-
 pyanaconda/ui/gui/spokes/filter.glade           |   2 +-
 pyanaconda/ui/gui/spokes/lib/cart.py            |   6 +-
 pyanaconda/ui/gui/spokes/lib/dasdfmt.glade      |   2 +-
 pyanaconda/ui/gui/spokes/lib/resize.glade       |   2 +-
 pyanaconda/ui/gui/spokes/lib/resize.py          |  10 +--
 pyanaconda/ui/gui/spokes/lib/summary.glade      |   2 +-
 pyanaconda/ui/gui/spokes/network.glade          |  14 ++--
 pyanaconda/ui/gui/spokes/network.py             |   8 +-
 pyanaconda/ui/gui/spokes/source.glade           |   8 +-
 pyanaconda/ui/gui/spokes/storage.glade          |   2 +-
 pyanaconda/ui/gui/spokes/storage.py             |   2 +-
 pyanaconda/ui/gui/spokes/user.glade             |   4 +-
 pyanaconda/ui/lib/space.py                      |   4 +-
 pyanaconda/ui/tui/spokes/network.py             |   8 +-
 pyanaconda/ui/tui/spokes/storage.py             |   2 +-
 tests/Makefile.am                               |   2 +
 tests/gettext/style_guide.py                    | 102 ++++++++++++++++++++++++
 26 files changed, 182 insertions(+), 78 deletions(-)
 create mode 100755 tests/gettext/style_guide.py

diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 8c4d206..186880c 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -244,7 +244,7 @@ class BootLoader(object):
     stage2_mountpoints = ["/boot", "/"]
     stage2_bootable = False
     stage2_must_be_primary = True
-    stage2_description = N_("/boot filesystem")
+    stage2_description = N_("/boot file system")
     stage2_max_end = Size("2 TiB")
 
     @property
@@ -781,7 +781,7 @@ class BootLoader(object):
     @update_only.setter
     def update_only(self, value):
         if value and not self.can_update:
-            raise ValueError("this bootloader does not support updates")
+            raise ValueError("this boot loader does not support updates")
         elif self.can_update:
             self._update_only = value
 
@@ -938,7 +938,7 @@ class BootLoader(object):
     def write_config(self):
         """ Write the bootloader configuration. """
         if not self.config_file:
-            raise BootLoaderError("no config file defined for this bootloader")
+            raise BootLoaderError("no config file defined for this boot loader")
 
         config_path = os.path.normpath(iutil.getSysroot() + self.config_file)
         if os.access(config_path, os.R_OK):
@@ -1301,7 +1301,7 @@ class GRUB(BootLoader):
     def install(self, args=None):
         rc = iutil.execInSysroot("grub-install", ["--just-copy"])
         if rc:
-            raise BootLoaderError("bootloader install failed")
+            raise BootLoaderError("boot loader install failed")
 
         for (stage1dev, stage2dev) in self.install_targets:
             cmd = ("root %(stage2dev)s\n"
@@ -1322,7 +1322,7 @@ class GRUB(BootLoader):
             rc = iutil.execInSysroot("grub", args, stdin=pread)
             iutil.eintr_retry_call(os.close, pread)
             if rc:
-                raise BootLoaderError("bootloader install failed")
+                raise BootLoaderError("boot loader install failed")
 
     def update(self):
         self.install()
@@ -1353,14 +1353,14 @@ class GRUB(BootLoader):
                 self.stage2_device.level == raid.RAID1 and \
                 self.stage1_device.type != "mdarray":
             if not self.stage1_device.isDisk:
-                msg = _("bootloader stage2 device %(stage2dev)s is on a multi-disk array, but bootloader stage1 device %(stage1dev)s is not. " \
+                msg = _("boot loader stage2 device %(stage2dev)s is on a multi-disk array, but boot loader stage1 device %(stage1dev)s is not. " \
                         "A drive failure in %(stage2dev)s could render the system unbootable.") % \
                         {"stage1dev" : self.stage1_device.name,
                          "stage2dev" : self.stage2_device.name}
                 self.warnings.append(msg)
             elif not self.stage2_device.dependsOn(self.stage1_device):
-                msg = _("bootloader stage2 device %(stage2dev)s is on a multi-disk array, but bootloader stage1 device %(stage1dev)s is not part of this array. " \
-                        "The stage1 bootloader will only be installed to a single drive.") % \
+                msg = _("boot loader stage2 device %(stage2dev)s is on a multi-disk array, but boot loader stage1 device %(stage1dev)s is not part of this array. " \
+                        "The stage1 boot loader will only be installed to a single drive.") % \
                         {"stage1dev" : self.stage1_device.name,
                          "stage2dev" : self.stage2_device.name}
                 self.warnings.append(msg)
@@ -1384,7 +1384,7 @@ class GRUB2(GRUB):
 
         - BIOS boot partition (GPT)
             - parted /dev/sda set <partition_number> bios_grub on
-            - can't contain a filesystem
+            - can't contain a file system
             - 31KiB min, 1MiB recommended
 
     """
@@ -1518,7 +1518,7 @@ class GRUB2(GRUB):
         iutil.eintr_retry_call(os.close, pread)
         self.encrypted_password = buf.split()[-1].strip()
         if not self.encrypted_password.startswith("grub.pbkdf2."):
-            raise BootLoaderError("failed to encrypt bootloader password")
+            raise BootLoaderError("failed to encrypt boot loader password")
 
     def write_password_config(self):
         if not self.password and not self.encrypted_password:
@@ -1551,7 +1551,7 @@ class GRUB2(GRUB):
         try:
             self.write_password_config()
         except (BootLoaderError, OSError, RuntimeError) as e:
-            log.error("bootloader password setup failed: %s", e)
+            log.error("boot loader password setup failed: %s", e)
 
         # make sure the default entry is the OS we are installing
         if self.default is not None:
@@ -1565,7 +1565,7 @@ class GRUB2(GRUB):
         rc = iutil.execInSysroot("grub2-mkconfig",
                                  ["-o", self.config_file])
         if rc:
-            raise BootLoaderError("failed to write bootloader configuration")
+            raise BootLoaderError("failed to write boot loader configuration")
 
     #
     # installation
@@ -1593,7 +1593,7 @@ class GRUB2(GRUB):
                                         root=iutil.getSysroot(),
                                         env_prune=['MALLOC_PERTURB_'])
             if rc:
-                raise BootLoaderError("bootloader install failed")
+                raise BootLoaderError("boot loader install failed")
 
     def write(self):
         """ Write the bootloader configuration and install the bootloader. """
@@ -1785,7 +1785,7 @@ class MacEFIGRUB(EFIGRUB):
         if os.path.exists(iutil.getSysroot() + "/usr/libexec/mactel-boot-setup"):
             rc = iutil.execInSysroot("/usr/libexec/mactel-boot-setup", [])
             if rc:
-                log.error("failed to configure Mac bootloader")
+                log.error("failed to configure Mac boot loader")
 
     def install(self, args=None):
         super(MacEFIGRUB, self).install()
@@ -1934,7 +1934,7 @@ class Yaboot(YabootBase):
         args = ["-f", "-C", self.config_file]
         rc = iutil.execInSysroot(self.prog, args)
         if rc:
-            raise BootLoaderError("bootloader installation failed")
+            raise BootLoaderError("boot loader installation failed")
 
 
 class IPSeriesYaboot(Yaboot):
@@ -2275,7 +2275,7 @@ class EXTLINUX(BootLoader):
         rc = iutil.execInSysroot("extlinux", args)
 
         if rc:
-            raise BootLoaderError("bootloader install failed")
+            raise BootLoaderError("boot loader install failed")
 
 
 # every platform that wants a bootloader needs to be in this dict
@@ -2296,7 +2296,7 @@ def get_bootloader():
         cls = EXTLINUX
     else:
         cls = bootloader_by_platform.get(platform.platform.__class__, BootLoader)
-    log.info("bootloader %s on %s platform", cls.__name__, platform_name)
+    log.info("boot loader %s on %s platform", cls.__name__, platform_name)
     return cls()
 
 
@@ -2368,9 +2368,9 @@ def writeBootLoader(storage, payload, instClass, ksdata):
     """
     if not storage.bootloader.skip_bootloader:
         stage1_device = storage.bootloader.stage1_device
-        log.info("bootloader stage1 target device is %s", stage1_device.name)
+        log.info("boot loader stage1 target device is %s", stage1_device.name)
         stage2_device = storage.bootloader.stage2_device
-        log.info("bootloader stage2 target device is %s", stage2_device.name)
+        log.info("boot loader stage2 target device is %s", stage2_device.name)
 
     # Bridge storage EFI configuration to bootloader
     if hasattr(storage.bootloader, 'efi_dir'):
@@ -2378,7 +2378,7 @@ def writeBootLoader(storage, payload, instClass, ksdata):
 
     if isinstance(payload, RPMOSTreePayload):
         if storage.bootloader.skip_bootloader:
-            log.info("skipping bootloader install per user request")
+            log.info("skipping boot loader install per user request")
             return
         writeBootLoaderFinal(storage, payload, instClass, ksdata)
         return
@@ -2386,7 +2386,7 @@ def writeBootLoader(storage, payload, instClass, ksdata):
     # get a list of installed kernel packages
     kernel_versions = payload.kernelVersionList + payload.rescueKernelList
     if not kernel_versions:
-        log.warning("no kernel was installed -- bootloader config unchanged")
+        log.warning("no kernel was installed -- boot loader config unchanged")
         return
 
     # all the linux images' labels are based on the default image's
@@ -2407,7 +2407,7 @@ def writeBootLoader(storage, payload, instClass, ksdata):
     writeSysconfigKernel(storage, version, instClass)
 
     if storage.bootloader.skip_bootloader:
-        log.info("skipping bootloader install per user request")
+        log.info("skipping boot loader install per user request")
         return
 
     # now add an image for each of the other kernels
diff --git a/pyanaconda/errors.py b/pyanaconda/errors.py
index 02704f9..50581dc 100644
--- a/pyanaconda/errors.py
+++ b/pyanaconda/errors.py
@@ -135,7 +135,7 @@ class ErrorHandler(object):
         # FIXME: include the two types in the message instead of including
         #        the raw exception text
         message = _("There is an entry in your /etc/fstab file that contains "
-                    "an invalid or incorrect filesystem type:\n\n")
+                    "an invalid or incorrect file system type:\n\n")
         message += " " + str(exn)
         self.ui.showError(message)
 
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
index c217612..df97404 100644
--- a/pyanaconda/exception.py
+++ b/pyanaconda/exception.py
@@ -134,7 +134,7 @@ class AnacondaExceptionHandler(ExceptionHandler):
                         cmdline_error_msg = _("\nThe installation was stopped due to "
                                               "incomplete spokes detected while running "
                                               "in non-interactive cmdline mode. Since there "
-                                              "can not be any questions in cmdline mode, "
+                                              "cannot be any questions in cmdline mode, "
                                               "edit your kickstart file and retry "
                                               "installation.\nThe exact error message is: "
                                               "\n\n%s.\n\nThe installer will now terminate.") % str(value)
diff --git a/pyanaconda/install.py b/pyanaconda/install.py
index 090b0a7..9a4c5d8 100644
--- a/pyanaconda/install.py
+++ b/pyanaconda/install.py
@@ -248,7 +248,7 @@ def doInstall(storage, payload, ksdata, instClass):
 
     # Do bootloader.
     if willInstallBootloader:
-        with progress_report(_("Installing bootloader")):
+        with progress_report(_("Installing boot loader")):
             writeBootLoader(storage, payload, instClass, ksdata)
 
     with progress_report(_("Performing post-installation setup tasks")):
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index fb6f3dd..22e8b2f 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -100,13 +100,13 @@ def sanityCheckHostname(hostname):
     """
 
     if not hostname:
-        return (False, _("Hostname cannot be None or an empty string."))
+        return (False, _("Host name cannot be None or an empty string."))
 
     if len(hostname) > 255:
-        return (False, _("Hostname must be 255 or fewer characters in length."))
+        return (False, _("Host name must be 255 or fewer characters in length."))
 
     if not (re.match('^' + HOSTNAME_PATTERN_WITHOUT_ANCHORS + '$', hostname)):
-        return (False, _("Hostnames can only contain the characters 'a-z', "
+        return (False, _("Host names can only contain the characters 'a-z', "
                          "'A-Z', '0-9', '-', or '.', parts between periods "
                          "must contain something and cannot start or end with "
                          "'-'."))
@@ -1368,7 +1368,7 @@ def status_message():
                 elif nm.nm_device_type_is_vlan(devname):
                     parent = nm.nm_device_setting_value(devname, "vlan", "parent")
                     vlanid = nm.nm_device_setting_value(devname, "vlan", "id")
-                    msg = _("Vlan %(interface_name)s (%(parent_device)s, ID %(vlanid)s) connected") \
+                    msg = _("VLAN %(interface_name)s (%(parent_device)s, ID %(vlanid)s) connected") \
                           % {"interface_name": devname, "parent_device": parent, "vlanid": vlanid}
             elif len(nonslaves) > 1:
                 devlist = []
diff --git a/pyanaconda/ui/gui/spokes/advstorage/fcoe.glade b/pyanaconda/ui/gui/spokes/advstorage/fcoe.glade
index 90221ab..cec4717 100644
--- a/pyanaconda/ui/gui/spokes/advstorage/fcoe.glade
+++ b/pyanaconda/ui/gui/spokes/advstorage/fcoe.glade
@@ -105,7 +105,7 @@
             </child>
             <child>
               <object class="GtkCheckButton" id="autoCheckbox">
-                <property name="label" translatable="yes" context="GUI|Advanced Storage|FCoE">Use auto _vlan</property>
+                <property name="label" translatable="yes" context="GUI|Advanced Storage|FCoE">Use auto _VLAN</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
diff --git a/pyanaconda/ui/gui/spokes/advstorage/iscsi.glade b/pyanaconda/ui/gui/spokes/advstorage/iscsi.glade
index ec25ff1..bbb540f 100644
--- a/pyanaconda/ui/gui/spokes/advstorage/iscsi.glade
+++ b/pyanaconda/ui/gui/spokes/advstorage/iscsi.glade
@@ -261,7 +261,7 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
-                                <property name="label" translatable="yes" context="GUI|Advanced Storage|iSCSI|Configure|CHAP">CHAP _Username:</property>
+                                <property name="label" translatable="yes" context="GUI|Advanced Storage|iSCSI|Configure|CHAP">CHAP _User name:</property>
                                 <property name="use_underline">True</property>
                                 <property name="mnemonic_widget">chapUsernameEntry</property>
                               </object>
@@ -384,7 +384,7 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
-                                <property name="label" translatable="yes" context="GUI|Advanced Storage|iSCSI|Configure|Reverse CHAP">CHAP _Username:</property>
+                                <property name="label" translatable="yes" context="GUI|Advanced Storage|iSCSI|Configure|Reverse CHAP">CHAP _User name:</property>
                                 <property name="use_underline">True</property>
                                 <property name="mnemonic_widget">rchapUsernameEntry</property>
                               </object>
@@ -412,7 +412,7 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
-                                <property name="label" translatable="yes" context="GUI|Advanced Storage|iSCSI|Configure|Reverse CHAP">Reverse CHAP User_name:</property>
+                                <property name="label" translatable="yes" context="GUI|Advanced Storage|iSCSI|Configure|Reverse CHAP">Reverse CHAP User _name:</property>
                                 <property name="use_underline">True</property>
                                 <property name="mnemonic_widget">rchapReverseUsername</property>
                               </object>
@@ -648,7 +648,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="xalign">0</property>
-                        <property name="label">The following nodes were discovered using the iSCSI initiator &lt;b&gt;%(initiatorName)s&lt;/b&gt; using the target IP address &lt;b&gt;%(targetAddress)s&lt;/b&gt;.  Please select which nodes you wish to log into:</property>
+                        <property name="label" translatable="yes">The following nodes have been discovered using the iSCSI initiator &lt;b&gt;%(initiatorName)s&lt;/b&gt; using the target IP address &lt;b&gt;%(targetAddress)s&lt;/b&gt;.  Please select which nodes you wish to log into:</property>
                         <property name="use_markup">True</property>
                         <property name="wrap">True</property>
                       </object>
@@ -728,7 +728,7 @@
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="xalign">0</property>
-                            <property name="label" translatable="yes" context="GUI|Advanced Storage|iSCSI|Login">_Node login authentication type:</property>
+                            <property name="label" translatable="yes" context="GUI|Advanced Storage|iSCSI|Login">_Node Login Authentication Type:</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">loginAuthTypeCombo</property>
                           </object>
@@ -780,7 +780,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes" context="GUI|Advanced Storage|iSCSI|Login|CHAP">CHAP _Username:</property>
+                                    <property name="label" translatable="yes" context="GUI|Advanced Storage|iSCSI|Login|CHAP">CHAP _User name:</property>
                                     <property name="use_underline">True</property>
                                     <property name="mnemonic_widget">loginChapUsernameEntry</property>
                                   </object>
@@ -903,7 +903,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes" context="GUI|Advanced Storage|iSCSI|Login|Reverse CHAP">CHAP _Username:</property>
+                                    <property name="label" translatable="yes" context="GUI|Advanced Storage|iSCSI|Login|Reverse CHAP">CHAP _User name:</property>
                                     <property name="use_underline">True</property>
                                     <property name="mnemonic_widget">loginRchapUsernameEntry</property>
                                   </object>
@@ -931,7 +931,7 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes" context="GUI|Advanced Storage|iSCSI|Login|Reverse CHAP">_Reverse CHAP Username:</property>
+                                    <property name="label" translatable="yes" context="GUI|Advanced Storage|iSCSI|Login|Reverse CHAP">_Reverse CHAP User name:</property>
                                     <property name="use_underline">True</property>
                                     <property name="mnemonic_widget">loginRchapReverseUsername</property>
                                   </object>
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 5319c7c..2053739 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -1439,7 +1439,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         if self._sizeEntry.get_sensitive():
             self._sizeEntry.props.has_tooltip = False
         elif device.format.type == "btrfs":
-            self._sizeEntry.set_tooltip_text(_("The space available to this mountpoint can be changed by modifying the volume below."))
+            self._sizeEntry.set_tooltip_text(_("The space available to this mount point can be changed by modifying the volume below."))
         else:
             self._sizeEntry.set_tooltip_text(_("This file system may not be resized."))
 
diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.glade b/pyanaconda/ui/gui/spokes/datetime_spoke.glade
index 236433b..1030e93 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.glade
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.glade
@@ -222,7 +222,7 @@
                 </child>
                 <child>
                   <object class="GtkTreeViewColumn" id="hostnameColumn">
-                    <property name="title" translatable="yes">Hostname</property>
+                    <property name="title" translatable="yes">Host name</property>
                     <property name="expand">True</property>
                     <child>
                       <object class="GtkCellRendererText" id="hostnameRenderer">
diff --git a/pyanaconda/ui/gui/spokes/filter.glade b/pyanaconda/ui/gui/spokes/filter.glade
index b73f2ac..09c1d3f 100644
--- a/pyanaconda/ui/gui/spokes/filter.glade
+++ b/pyanaconda/ui/gui/spokes/filter.glade
@@ -1570,7 +1570,7 @@
                     <property name="layout_style">end</property>
                     <child>
                       <object class="GtkButton" id="addZFCPButton">
-                        <property name="label" translatable="yes" context="GUI|Installation Destination|Filter">_Add ZFCP LUN...</property>
+                        <property name="label" translatable="yes" context="GUI|Installation Destination|Filter">_Add zFCP LUN...</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
diff --git a/pyanaconda/ui/gui/spokes/lib/cart.py b/pyanaconda/ui/gui/spokes/lib/cart.py
index fe0499d..6c70db7 100644
--- a/pyanaconda/ui/gui/spokes/lib/cart.py
+++ b/pyanaconda/ui/gui/spokes/lib/cart.py
@@ -129,9 +129,9 @@ class SelectedDisksDialog(GUIObject):
 
         # pylint: disable=unescaped-markup
         text = P_("<b>%(count)d disk; %(size)s capacity; %(free)s free space</b> "
-                   "(unpartitioned and in filesystems)",
+                   "(unpartitioned and in file systems)",
                   "<b>%(count)d disks; %(size)s capacity; %(free)s free space</b> "
-                   "(unpartitioned and in filesystems)",
+                   "(unpartitioned and in file systems)",
                    count) % {"count" : count,
                              "size" : escape_markup(size),
                              "free" : escape_markup(free)}
@@ -187,7 +187,7 @@ class SelectedDisksDialog(GUIObject):
     def _toggle_button_text(self, row):
         if row[IS_BOOT_COL]:
             self._set_button.set_label(C_("GUI|Selected Disks Dialog",
-                "_Do not install bootloader"))
+                "_Do not install boot loader"))
         else:
             self._set_button.set_label(C_("GUI|Selected Disks Dialog",
                 "_Set as Boot Device"))
diff --git a/pyanaconda/ui/gui/spokes/lib/dasdfmt.glade b/pyanaconda/ui/gui/spokes/lib/dasdfmt.glade
index d5280c3..06b0edf 100644
--- a/pyanaconda/ui/gui/spokes/lib/dasdfmt.glade
+++ b/pyanaconda/ui/gui/spokes/lib/dasdfmt.glade
@@ -67,7 +67,7 @@
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="valign">start</property>
-                <property name="label" translatable="yes">The following unformatted DASDs have been detected on your system. You can choose to format them now with dasdfmt or cancel to leave them unformatted. Unformatted DASDs can not be used during installation.</property>
+                <property name="label" translatable="yes">The following unformatted DASDs have been detected on your system. You can choose to format them now with dasdfmt or cancel to leave them unformatted. Unformatted DASDs cannot be used during installation.</property>
                 <property name="wrap">True</property>
                 <attributes>
                   <attribute name="font-desc" value="Cantarell 12"/>
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.glade b/pyanaconda/ui/gui/spokes/lib/resize.glade
index 147f22e..f87202f 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.glade
+++ b/pyanaconda/ui/gui/spokes/lib/resize.glade
@@ -171,7 +171,7 @@
                     </child>
                     <child>
                       <object class="GtkTreeViewColumn" id="fsColumn">
-                        <property name="title" translatable="yes">Filesystem</property>
+                        <property name="title" translatable="yes">File System</property>
                         <child>
                           <object class="GtkCellRendererText" id="fsRenderer"/>
                           <attributes>
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.py b/pyanaconda/ui/gui/spokes/lib/resize.py
index e71ee92..02d0f46 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.py
+++ b/pyanaconda/ui/gui/spokes/lib/resize.py
@@ -210,13 +210,13 @@ class ResizeDialog(GUIObject):
 
         self._update_labels(totalDisks, totalReclaimableSpace, 0)
 
-        description = _("You can remove existing filesystems you no longer need to free up space "
-                        "for this installation.  Removing a filesystem will permanently delete all "
+        description = _("You can remove existing file systems you no longer need to free up space "
+                        "for this installation.  Removing a file system will permanently delete all "
                         "of the data it contains.")
 
         if canShrinkSomething:
             description += "\n\n"
-            description += _("There is also free space available in pre-existing filesystems.  "
+            description += _("There is also free space available in pre-existing file systems.  "
                              "While it's risky and we recommend you back up your data first, you "
                              "can recover that free disk space and make it available for this "
                              "installation below.")
@@ -226,8 +226,8 @@ class ResizeDialog(GUIObject):
 
     def _update_labels(self, nDisks=None, totalReclaimable=None, selectedReclaimable=None):
         if nDisks is not None and totalReclaimable is not None:
-            text = P_("<b>%(count)s disk; %(size)s reclaimable space</b> (in filesystems)",
-                      "<b>%(count)s disks; %(size)s reclaimable space</b> (in filesystems)",
+            text = P_("<b>%(count)s disk; %(size)s reclaimable space</b> (in file systems)",
+                      "<b>%(count)s disks; %(size)s reclaimable space</b> (in file systems)",
                       nDisks) % {"count" : escape_markup(str(nDisks)),
                                  "size" : escape_markup(totalReclaimable)}
             self._reclaimable_label.set_markup(text)
diff --git a/pyanaconda/ui/gui/spokes/lib/summary.glade b/pyanaconda/ui/gui/spokes/lib/summary.glade
index e1584f6..88c3123 100644
--- a/pyanaconda/ui/gui/spokes/lib/summary.glade
+++ b/pyanaconda/ui/gui/spokes/lib/summary.glade
@@ -171,7 +171,7 @@
                     </child>
                     <child>
                       <object class="GtkTreeViewColumn" id="mountpointColumn">
-                        <property name="title" translatable="yes">Mountpoint</property>
+                        <property name="title" translatable="yes">Mount point</property>
                         <child>
                           <object class="GtkCellRendererText" id="mountpointRenderer"/>
                           <attributes>
diff --git a/pyanaconda/ui/gui/spokes/network.glade b/pyanaconda/ui/gui/spokes/network.glade
index 1508902..2a9e029 100644
--- a/pyanaconda/ui/gui/spokes/network.glade
+++ b/pyanaconda/ui/gui/spokes/network.glade
@@ -24,7 +24,7 @@
         <col id="1" translatable="yes">team</col>
       </row>
       <row>
-        <col id="0" translatable="yes">Vlan</col>
+        <col id="0" translatable="yes">VLAN</col>
         <col id="1" translatable="yes">vlan</col>
       </row>
     </data>
@@ -162,7 +162,7 @@
   </object>
   <object class="AnacondaSpokeWindow" id="networkWindow">
     <property name="can_focus">False</property>
-    <property name="window_name" translatable="yes">NETWORK &amp; HOSTNAME</property>
+    <property name="window_name" translatable="yes">NETWORK &amp; HOST NAME</property>
     <signal name="button-clicked" handler="on_back_clicked" swapped="no"/>
     <child internal-child="main_box">
       <object class="GtkBox" id="AnacondaSpokeWindow-main_box1">
@@ -201,7 +201,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="halign">start</property>
-                    <property name="label" translatable="yes">Please use the live desktop environment's tools for customizing your network configuration.  You can set the hostname here.</property>
+                    <property name="label" translatable="yes">Please use the live desktop environment's tools for customizing your network configuration.  You can set the host name here.</property>
                     <property name="ellipsize">start</property>
                   </object>
                   <packing>
@@ -621,7 +621,7 @@
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
                                             <property name="xalign">1</property>
-                                            <property name="label" translatable="yes">Vlan ID</property>
+                                            <property name="label" translatable="yes">VLAN ID</property>
                                           </object>
                                           <packing>
                                             <property name="left_attach">0</property>
@@ -1627,7 +1627,7 @@
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
                                             <property name="xalign">1</property>
-                                            <property name="label" translatable="yes">Username</property>
+                                            <property name="label" translatable="yes">User name</property>
                                           </object>
                                           <packing>
                                             <property name="left_attach">0</property>
@@ -2219,7 +2219,7 @@
                           <object class="GtkLabel" id="label_hostname">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="label" translatable="yes" context="GUI|Network">_Hostname:</property>
+                            <property name="label" translatable="yes" context="GUI|Network">_Host name:</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">entry_hostname</property>
                           </object>
@@ -2237,7 +2237,7 @@
                             <property name="width_chars">35</property>
                             <child internal-child="accessible">
                               <object class="AtkObject" id="entry_hostname-atkobject">
-                                <property name="AtkObject::accessible-name" translatable="yes">Hostname</property>
+                                <property name="AtkObject::accessible-name" translatable="yes">Host name</property>
                               </object>
                             </child>
                           </object>
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index 0b1fc62..18ee01e 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -301,7 +301,7 @@ class NetworkControlBox(GObject.GObject):
         NetworkManager.DeviceType.ETHERNET: N_("Ethernet"),
         NetworkManager.DeviceType.WIFI: N_("Wireless"),
         NetworkManager.DeviceType.BOND: N_("Bond"),
-        NetworkManager.DeviceType.VLAN: N_("Vlan"),
+        NetworkManager.DeviceType.VLAN: N_("VLAN"),
         NetworkManager.DeviceType.TEAM: N_("Team"),
         NetworkManager.DeviceType.BRIDGE: N_("Bridge"),
     }
@@ -1381,7 +1381,7 @@ class NetworkSpoke(FirstbootSpokeMixIn, NormalSpoke):
     uiFile = "spokes/network.glade"
     helpFile = "NetworkSpoke.xml"
 
-    title = CN_("GUI|Spoke", "_NETWORK & HOSTNAME")
+    title = CN_("GUI|Spoke", "_NETWORK & HOST NAME")
     icon = "network-transmit-receive-symbolic"
 
     category = SystemCategory
@@ -1461,7 +1461,7 @@ class NetworkSpoke(FirstbootSpokeMixIn, NormalSpoke):
         (valid, error) = network.sanityCheckHostname(hostname)
         if not valid:
             self.clear_info()
-            msg = _("Hostname is not valid: %s") % error
+            msg = _("Host name is not valid: %s") % error
             self.set_warning(msg)
             self.network_control_box.entry_hostname.grab_focus()
             self.window.show_all()
@@ -1531,7 +1531,7 @@ class NetworkStandaloneSpoke(StandaloneSpoke):
         (valid, error) = network.sanityCheckHostname(hostname)
         if not valid:
             self.clear_info()
-            msg = _("Hostname is not valid: %s") % error
+            msg = _("Host name is not valid: %s") % error
             self.set_warning(msg)
             self.network_control_box.entry_hostname.grab_focus()
             self.window.show_all()
diff --git a/pyanaconda/ui/gui/spokes/source.glade b/pyanaconda/ui/gui/spokes/source.glade
index a3969ea..9419b09 100644
--- a/pyanaconda/ui/gui/spokes/source.glade
+++ b/pyanaconda/ui/gui/spokes/source.glade
@@ -373,7 +373,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="xalign">0</property>
-                        <property name="label" translatable="yes" context="GUI|Software Source|Proxy Dialog">User_name</property>
+                        <property name="label" translatable="yes" context="GUI|Software Source|Proxy Dialog">User _name</property>
                         <property name="use_underline">True</property>
                         <property name="mnemonic_widget">proxyUsernameEntry</property>
                         <attributes>
@@ -1117,8 +1117,8 @@
                                       <object class="GtkEntry" id="repoProxyUsernameEntry">
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
-                                        <property name="tooltip_markup" translatable="yes">Optional proxy username.</property>
-                                        <property name="tooltip_text" translatable="yes">Optional proxy username.</property>
+                                        <property name="tooltip_markup" translatable="yes">Optional proxy user name.</property>
+                                        <property name="tooltip_text" translatable="yes">Optional proxy user name.</property>
                                         <property name="invisible_char">●</property>
                                         <signal name="changed" handler="on_repoProxy_changed" swapped="no"/>
                                       </object>
@@ -1218,7 +1218,7 @@
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
                                         <property name="xalign">0</property>
-                                        <property name="label" translatable="yes" context="GUI|Software Source">U_sername:</property>
+                                        <property name="label" translatable="yes" context="GUI|Software Source">U_ser name:</property>
                                         <property name="use_underline">True</property>
                                         <property name="mnemonic_widget">repoProxyUsernameEntry</property>
                                         <attributes>
diff --git a/pyanaconda/ui/gui/spokes/storage.glade b/pyanaconda/ui/gui/spokes/storage.glade
index 6074750..37dfa44 100644
--- a/pyanaconda/ui/gui/spokes/storage.glade
+++ b/pyanaconda/ui/gui/spokes/storage.glade
@@ -987,7 +987,7 @@
                               <object class="GtkLabel" id="label5">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="label" translatable="yes" context="GUI|Storage">_Full disk summary and bootloader...</property>
+                                <property name="label" translatable="yes" context="GUI|Storage">_Full disk summary and boot loader...</property>
                                 <property name="use_underline">True</property>
                                 <attributes>
                                   <attribute name="underline" value="True"/>
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index bbd993c..467b44b 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -680,7 +680,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         self.data.bootloader.seen = True
 
         if self.data.bootloader.location == "none":
-            self.set_warning(_("You have chosen to skip bootloader installation.  Your system may not be bootable."))
+            self.set_warning(_("You have chosen to skip boot loader installation.  Your system may not be bootable."))
             self.window.show_all()
         else:
             self.clear_info()
diff --git a/pyanaconda/ui/gui/spokes/user.glade b/pyanaconda/ui/gui/spokes/user.glade
index cecbdd1..64dc2e2 100644
--- a/pyanaconda/ui/gui/spokes/user.glade
+++ b/pyanaconda/ui/gui/spokes/user.glade
@@ -77,7 +77,7 @@
                         <property name="can_focus">False</property>
                         <property name="xalign">1</property>
                         <property name="xpad">10</property>
-                        <property name="label" translatable="yes" context="GUI|User">_Username</property>
+                        <property name="label" translatable="yes" context="GUI|User">_User name</property>
                         <property name="use_underline">True</property>
                         <property name="mnemonic_widget">t_username</property>
                         <attributes>
@@ -200,7 +200,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="xalign">0</property>
-                        <property name="label" translatable="yes">&lt;b&gt;Tip:&lt;/b&gt; Keep your username shorter than 32 characters and do not use spaces.</property>
+                        <property name="label" translatable="yes">&lt;b&gt;Tip:&lt;/b&gt; Keep your user name shorter than 32 characters and do not use spaces.</property>
                         <property name="use_markup">True</property>
                       </object>
                       <packing>
diff --git a/pyanaconda/ui/lib/space.py b/pyanaconda/ui/lib/space.py
index e556492..a133c8b 100644
--- a/pyanaconda/ui/lib/space.py
+++ b/pyanaconda/ui/lib/space.py
@@ -29,12 +29,12 @@ log = logging.getLogger("anaconda")
 
 class FileSystemSpaceChecker(object):
     """This object provides for a way to verify that enough space is available
-       on configured filesystems to support the current software selections.
+       on configured file systems to support the current software selections.
        It is run as part of completeness checking every time a spoke changes,
        therefore moving this step up out of both the storage and software
        spokes.
     """
-    error_template = N_("Not enough space in filesystems for the current "
+    error_template = N_("Not enough space in file systems for the current "
                         "software selection. An additional %s is needed.")
 
     def __init__(self, storage, payload):
diff --git a/pyanaconda/ui/tui/spokes/network.py b/pyanaconda/ui/tui/spokes/network.py
index 9bd47b9..3c64f33 100644
--- a/pyanaconda/ui/tui/spokes/network.py
+++ b/pyanaconda/ui/tui/spokes/network.py
@@ -137,7 +137,7 @@ class NetworkSpoke(EditTUISpoke):
 
         summary = self._summary_text()
         self._window += [TextWidget(summary), ""]
-        hostname = _("Hostname: %s\n") % self.data.network.hostname
+        hostname = _("Host name: %s\n") % self.data.network.hostname
         self._window += [TextWidget(hostname), ""]
 
         # if we have any errors, display them
@@ -149,7 +149,7 @@ class NetworkSpoke(EditTUISpoke):
             number = TextWidget("%2d)" % (i + 1))
             return ColumnWidget([(4, [number]), (None, [w])], 1)
 
-        _opts = [_("Set hostname")]
+        _opts = [_("Set host name")]
         for devname in self.supported_devices:
             _opts.append(_("Configure device %s") % devname)
         text = [TextWidget(o) for o in _opts]
@@ -170,7 +170,7 @@ class NetworkSpoke(EditTUISpoke):
 
         if num == 1:
             # set hostname
-            self.app.switch_screen_modal(self.hostname_dialog, Entry(_("Hostname"),
+            self.app.switch_screen_modal(self.hostname_dialog, Entry(_("Host name"),
                                 "hostname", re.compile(".*$"), True))
             self.apply()
             return INPUT_PROCESSED
@@ -231,7 +231,7 @@ class NetworkSpoke(EditTUISpoke):
         if valid:
             hostname = self.hostname_dialog.value
         else:
-            self.errors.append(_("Hostname is not valid: %s") % error)
+            self.errors.append(_("Host name is not valid: %s") % error)
             self.hostname_dialog.value = hostname
         network.update_hostname_data(self.data, hostname)
 
diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py
index 2df64ed..8222efa 100644
--- a/pyanaconda/ui/tui/spokes/storage.py
+++ b/pyanaconda/ui/tui/spokes/storage.py
@@ -302,7 +302,7 @@ class StorageSpoke(NormalTUISpoke):
         # ask user to verify they want to format if zerombr not in ks file
         if not self.data.zerombr.zerombr:
             # prepare our msg strings; copied directly from dasdfmt.glade
-            summary = _("The following unformatted DASDs have been detected on your system. You can choose to format them now with dasdfmt or cancel to leave them unformatted. Unformatted DASDs can not be used during installation.\n\n")
+            summary = _("The following unformatted DASDs have been detected on your system. You can choose to format them now with dasdfmt or cancel to leave them unformatted. Unformatted DASDs cannot be used during installation.\n\n")
 
             warntext = _("Warning: All storage changes made using the installer will be lost when you choose to format.\n\nProceed to run dasdfmt?\n")
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dac5d92..7da8e51 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -48,6 +48,7 @@ dist_check_SCRIPTS = $(srcdir)/glade/*/*.py \
 		     testenv.sh \
 		     gettext/gettext_warnings.sh \
 		     gettext/gettext_potfiles.py \
+		     gettext/style_guide.py \
 		     storage/run_storage_tests.py \
 		     ostree/run_ostree_tests.sh \
 		     $(srcdir)/storage/cases/*.py \
@@ -58,6 +59,7 @@ TESTS = nosetests.sh \
 	cppcheck/runcppcheck.sh \
 	gettext/gettext_warnings.sh \
 	gettext/gettext_potfiles.py \
+	gettext/style_guide.py \
 	storage/run_storage_tests.py \
 	glade/run_glade_tests.sh \
 	ostree/run_ostree_tests.sh
diff --git a/tests/gettext/style_guide.py b/tests/gettext/style_guide.py
new file mode 100755
index 0000000..7aeff08
--- /dev/null
+++ b/tests/gettext/style_guide.py
@@ -0,0 +1,102 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2014  Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: David Shea <dshea at redhat.com>
+
+import os, re, sys
+
+# {'bad re': 'suggestion'}
+# (?i) makes the re case-insensitive
+bad_strings = {'(?i)bootloader': 'boot loader',
+               '(?i)filesystem': 'file system',
+               '(?i)username':   'user name',
+               '[Vv]lan':        'VLAN',
+               '(?i)hostname':   'hostname',
+               'ZFCP':           'zFCP',
+               'zfcp':           'zFCP',
+               'BTRFS':          'Btrfs',
+               'btrfs':          'Btrfs',
+               '[Cc]an not':     'cannot',
+               '(?i)mountpoint': 'mount point'}
+
+# Sometimes we need to use a bad string, or it's just too much of a pain to
+# write a more specific regex. List occurrences here.
+# {'filename': {'matched string', occurrences}}
+expected_badness = {'pyanaconda/bootloader.py': {'mountpoint': 1},  # format string specifier
+                    'pyanaconda/network.py':    {'vlan': 1}}        # format string specifier
+
+# Use polib to parse anaconda.pot
+try:
+    import polib
+except ImportError:
+    print("You need to install the python-polib package to read anaconda.pot")
+    # This return code tells the automake test driver that the test setup failed
+    sys.exit(99)
+
+if "top_srcdir" not in os.environ:
+    sys.stderr.write("$top_srcdir must be defined in the test environment\n")
+    sys.exit(99)
+
+if "top_builddir" not in os.environ:
+    sys.stderr.write("$top_srcdir must be defined in the test environment\n")
+    sys.exit(99)
+
+# Update the .pot file with the latest strings
+if os.system('make -C %s anaconda.pot-update' % (os.environ['top_builddir'] + "/po")) != 0:
+    sys.stderr.write("Unable to update anaconda.pot")
+    sys.exit(1)
+
+# Parse anaconda.pot and rearrange the POFile object into a dict of {msgid: POEntry}
+pofile = polib.pofile(os.environ['top_srcdir'] + "/po/anaconda.pot")
+msgs = {e.msgid: e for e in pofile}
+
+# Look for each of the bad regexes
+success = True
+for badre in bad_strings.keys():
+    regex = re.compile(badre)
+    for msg in msgs.keys():
+        # Remove underscores to avoid trouble with underline-based accelerators
+        match = re.search(regex, msg.replace('_', ''))
+        if match:
+            # If this is something expected, decrement the occurrence count in expected_badness
+            badstr = match.group(0)
+            remainder = []
+            for occur in msgs[msg].occurrences:
+                if occur[0] in expected_badness and badstr in expected_badness[occur[0]]:
+                    expected_badness[occur[0]][badstr] -= 1
+                    if expected_badness[occur[0]][badstr] == 0:
+                        del expected_badness[occur[0]][badstr]
+                    if not expected_badness[occur[0]]:
+                        del expected_badness[occur[0]]
+                else:
+                    remainder.append(occur)
+
+            if remainder:
+                print("Bad string %(bad)s found at %(occurrences)s. Try %(suggestion)s instead." %
+                        {"bad": badstr,
+                         "occurrences": " ".join(("%s:%s" % (o[0], o[1]) for o in remainder)),
+                         "suggestion": bad_strings[badre]})
+                success = False
+
+if expected_badness:
+    for filename in expected_badness.keys():
+        for badstr in expected_badness[filename].keys():
+            print("Did not find %d occurrences of %s in %s" %
+                    (expected_badness[filename][badstr], badstr, filename))
+    success = False
+
+sys.exit(0 if success else 1)
-- 
2.2.2



More information about the anaconda-patches mailing list