[PATCH 5/7] Replace placeholders with the strings from python

Vratislav Podzimek vpodzime at redhat.com
Wed Oct 16 07:50:49 UTC 2013


On Tue, 2013-10-15 at 14:16 -0400, David Shea wrote:
> For strings that had keyboard accelerators defined in python but not in
> glade, replace the glade placeholder with a non-translatable version of
> the python string.
> 
> Split the labels on buttons and radio buttons into explicit children in
> order to set the necessary markup attributes on the label. This also
> cleans up some of that get_children mess we have with builder objects.
> ---
>  pyanaconda/ui/gui/spokes/custom.glade  | 10 ++++++++-
>  pyanaconda/ui/gui/spokes/custom.py     |  8 +++----
>  pyanaconda/ui/gui/spokes/filter.glade  | 10 ++++++++-
>  pyanaconda/ui/gui/spokes/filter.py     |  3 +--
>  pyanaconda/ui/gui/spokes/storage.glade | 39 ++++++++++++++++++++++++++++------
>  pyanaconda/ui/gui/spokes/storage.py    | 15 ++++++-------
>  6 files changed, 61 insertions(+), 24 deletions(-)
> 
> diff --git a/pyanaconda/ui/gui/spokes/custom.glade b/pyanaconda/ui/gui/spokes/custom.glade
> index fbf416c..f8004c2 100644
> --- a/pyanaconda/ui/gui/spokes/custom.glade
> +++ b/pyanaconda/ui/gui/spokes/custom.glade
> @@ -1846,7 +1846,6 @@ until you click on the main menu's 'Begin Installation' button.</property>
>                      </child>
>                      <child>
>                        <object class="GtkButton" id="summary_button">
> -                        <property name="label" translatable="yes">summary</property>
>                          <property name="visible">True</property>
>                          <property name="can_focus">True</property>
>                          <property name="receives_default">True</property>
> @@ -1856,6 +1855,15 @@ until you click on the main menu's 'Begin Installation' button.</property>
>                          <property name="focus_on_click">False</property>
>                          <property name="xalign">0</property>
>                          <signal name="clicked" handler="on_summary_clicked" swapped="no"/>
> +                        <child>
> +                          <object class="GtkLabel" id="summary_label">
> +                            <property name="visible">True</property>
> +                            <property name="can_focus">False</property>
> +                            <property name="label">%d _storage devices selected</property>
> +                            <property name="use_markup">True</property>
> +                            <property name="use_underline">True</property>
> +                          </object>
> +                        </child>
Will those changes survive editing file with Glade and saving it? I'd
really hate ending up editing those XML files manually.

> diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
> index 43b1bf6..31f6b1f 100644
> --- a/pyanaconda/ui/gui/spokes/storage.py
> +++ b/pyanaconda/ui/gui/spokes/storage.py
> @@ -123,34 +123,33 @@ class InstallOptions1Dialog(GUIObject):
>  
>          options_label = self.builder.get_object("options1_label")
>  
> -        options_text = _("You have <b>%(freeSpace)s</b> of free space, which is "
> -                         "enough to install %(productName)s.  What would you "
> -                         "like to do?") % {"freeSpace": disk_free, "productName": productName}
> +        options_text = _("<span font-desc=\"Cantarell 11\">You have <b>%(freeSpace)s</b> "
> +                         "of free space, which is enough to install %(productName)s.  "
> +                         "What would you like to do?</span>") %\
> +                         {"freeSpace": disk_free, "productName": productName}
I think we should set attributes properly, not by placing tags in
translatable strings that are translated. This would break translations
now and every time we change the markup. But maybe that should go in a
separate patch fixing it in a lot more places.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list