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

David Shea dshea at redhat.com
Wed Oct 16 13:23:46 UTC 2013


On 10/16/2013 03:50 AM, Vratislav Podzimek wrote:
> 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.
Yes, I did this part in glade. Under the "Configure button content" 
choices, pick "Add custom button content", and then you can make a new 
widget for the label instead of specifiying it as part of the button.
>
>> 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.
>
I agree...but not for this string. Maybe. At least on the glade side of 
things, you can't specify both pango attributes and use-markup, and I 
think that might be true for the widgets themselves as well. We need 
markup in this string because of the <b></b> in the middle, which might 
mean that we need to include the font-desc in a span, unfortunately.

But we do have a lot of strings with markup that could be moved into 
attributes. I've been looking at some of those.


More information about the anaconda-patches mailing list