Merge lp:~mvo/software-center/lp967036-2 into lp:software-center/5.2

Proposed by Michael Vogt on 2012-06-05
Status: Merged
Merged at revision: 3046
Proposed branch: lp:~mvo/software-center/lp967036-2
Merge into: lp:software-center/5.2
Diff against target: 21 lines (+4/-1)
1 file modified
softwarecenter/ui/gtk3/widgets/labels.py (+4/-1)
To merge this branch: bzr merge lp:~mvo/software-center/lp967036-2
Reviewer Review Type Date Requested Status
Gary Lasker (community) 2012-06-05 Approve on 2012-06-06
Review via email: mp+108707@code.launchpad.net

Description of the change

This fixes the crash #967036 for people running with the LANGUAGE=zh_CN.UTF-8 or zh_TW.UTF-8

To reproduce:
1. install chinese support via gnome-language-selector
2. run LANGUAGE=zh_CN.UTF-8 software-center ryzom
3. verify the crash (and that the UI looks chinese)

4. use this branch and run
5. LANGUAGE=zh_CN.UTF-8 software-center ryzom
6. verify that it works (and that all UI looks chinese)

To post a comment you must log in.
Gary Lasker (gary-lasker) wrote :

Sweet fix, does the trick! Many thanks, mvo.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/ui/gtk3/widgets/labels.py'
2--- softwarecenter/ui/gtk3/widgets/labels.py 2012-04-12 08:10:15 +0000
3+++ softwarecenter/ui/gtk3/widgets/labels.py 2012-06-05 09:21:20 +0000
4@@ -70,13 +70,16 @@
5 else:
6 label_text = self.LABEL
7 short_descr = get_hw_short_description(self.tag)
8- return _(label_text) % {
9+ # this needs to be unicode as the translation for zh_CN contains
10+ # special chars for the "," (LP: #967036)
11+ label_text = unicode(_(label_text), "utf8", "ignore") % {
12 "sym": sym,
13 # we need unicode() here instead of utf8 or str because
14 # the %s in "label_text" will cause str() to be called on the
15 # encoded string, but it will not know what encoding to use
16 "hardware": unicode(short_descr, "utf8", "ignore")
17 }
18+ return label_text
19
20 def set_hardware_requirement(self, tag, result):
21 self.tag = tag

Subscribers

People subscribed via source and target branches