Merge lp:~maclin.jun/ubiquity/fix_1304410 into lp:ubiquity

Proposed by Ma Jun
Status: Merged
Merged at revision: 6256
Proposed branch: lp:~maclin.jun/ubiquity/fix_1304410
Merge into: lp:ubiquity
Diff against target: 17 lines (+7/-0)
1 file modified
ubiquity/plugins/ubi-partman.py (+7/-0)
To merge this branch: bzr merge lp:~maclin.jun/ubiquity/fix_1304410
Reviewer Review Type Date Requested Status
Ubuntu Installer Team Pending
Colin Watson Pending
Review via email: mp+246064@code.launchpad.net

Description of the change

Add the translation process of the "edit" button in plugin ubi-partman.py.
There is a function "plugin_translate" to process "new" button and "delete" button. However no "edit" button translation in the function. This causes the bug#1304410.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

One quick comment, but otherwise it would be better for a more active member of the installer team to review this, since I've largely moved to Launchpad development. I've requested a review from ubuntu-installer instead.

lp:~maclin.jun/ubiquity/fix_1304410 updated
6248. By Ma Jun

instead the tab at beginning of the code with 8 space

Revision history for this message
Michael Vogt (mvo) wrote :

Hi Ma Jun, thanks a lot for your branch! It looks good, I would love to tweak it a little bit to avoid code duplication. Would something like:
"""
=== modified file 'ubiquity/plugins/ubi-partman.py'
--- ubiquity/plugins/ubi-partman.py 2014-10-29 12:33:49 +0000
+++ ubiquity/plugins/ubi-partman.py 2015-01-23 08:44:25 +0000
@@ -1135,15 +1135,24 @@
                 self.controller.dbfilter.edit_partition(devpart, **edits)

     def plugin_translate(self, lang):
- symbolic_widgets = ['partition_button_new', 'partition_button_delete']
- for widget_name in symbolic_widgets:
+ widgets = (
+ ('partition_button_new', "empty"),
+ ('partition_button_delete', "empty"),
+ ('partition_button_edit', "i18n"),
+ )
+ for widget_name, action in widgets:
             widget = getattr(self, widget_name)
- text = widget.get_label()
+ text = self.controller.get_string(widget_name, lang)
             if len(text) == 0:
                 continue
             a11y = widget.get_accessible()
             a11y.set_name(text)
- widget.set_label('')
+ if action == "empty":
+ widget.set_label('')
+ elif action == "i18n":
+ widget.set_label(text)
+ else:
+ raise ValueError("unknown action '%s'" % action)

     @plugin.only_this_page
     def on_partition_use_combo_changed(self, combobox):

"""
work? i.e. could you check if that also fixes the bug?

Thanks!
 Michael

Revision history for this message
Ma Jun (maclin.jun) wrote :

Hi, Michael, thanks a lot for your reply:)

I have checked your modified codes and they worked well to solve the bug.

Revision history for this message
Michael Vogt (mvo) wrote :

Hi, thanks for testing! I merged this with my tweaks and it will be part of the next upload :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubiquity/plugins/ubi-partman.py'
2--- ubiquity/plugins/ubi-partman.py 2014-10-29 12:33:49 +0000
3+++ ubiquity/plugins/ubi-partman.py 2015-01-12 01:28:01 +0000
4@@ -1144,6 +1144,13 @@
5 a11y = widget.get_accessible()
6 a11y.set_name(text)
7 widget.set_label('')
8+ widget_name_edit = 'partition_button_edit'
9+ widget_edit = getattr(self, widget_name_edit)
10+ text = self.controller.get_string(widget_name_edit,lang)
11+ if len(text) != 0:
12+ a11y = widget_edit.get_accessible()
13+ a11y.set_name(text)
14+ widget_edit.set_label(text)
15
16 @plugin.only_this_page
17 def on_partition_use_combo_changed(self, combobox):

Subscribers

People subscribed via source and target branches

to status/vote changes: