[Patch] Remaining battery time cannot be translated due to bug in i18n

Bug #306254 reported by Krzysztof Lichota
2
Affects Status Importance Assigned to Milestone
guidance-power-manager (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: kde-guidance

The KDE power manager tooltip shows untranslated message "hh:mm remaining" and "hh:mm to charge" although the message is in .po file and translated properly.

I have found the problem - the i18n call in source is used improperly - i18n is applied to message _after_ substitution, not before, so message is searched in message catalog with "hh:mm" filled in (and not found).

The following change fixes it:
--- guidance-power-manager.py.orig 2008-12-08 16:17:37.000000000 +0100
+++ guidance-power-manager.py 2008-12-08 16:15:14.000000000 +0100
@@ -682,9 +682,9 @@
             if self.batt_state == "charged":
                 blabel += i18n(" fully charged")
             elif self.batt_state == "charging":
- blabel += i18n(" %i:%02ih to charge" % (remain_h,remain_m))
+ blabel += unicode(i18n(" %i:%02ih to charge")) % (remain_h,remain_m)
             elif self.batt_state == "discharging":
- blabel += i18n(" %i:%02ih remaining" % (remain_h,remain_m))
+ blabel += unicode(i18n(" %i:%02ih remaining")) % (remain_h,remain_m)
             self.BattMainLabel.setText(blabel)

             # update tray icon if needed

I attach diff which fixes all similar broken i18n calls in powermanager.py.

I have tested the change to "time remaining" and "time to charge". I cannot test the other 2 calls as I do not have 2 cores not 2 batteries.

Revision history for this message
Krzysztof Lichota (krzysiek-launchpad-ubuntu-com) wrote :
Revision history for this message
goto (gotolaunchpad) wrote :

Are the fixes upstream already?

Revision history for this message
Krzysztof Lichota (krzysiek-launchpad-ubuntu-com) wrote : Re: [Bug 306254] Re: [Patch] Remaining battery time cannot be translated due to bug in i18n

2008/12/8 goto <email address hidden>:
> Are the fixes upstream already?

I wasn't able to locate upstream. If you can point me to mailing list
or bug tracker for Guidance, I will submit it there.

Revision history for this message
Sebastian Kügler (sebasje) wrote :

For correct translation, you should use KGlobal here, rather than this hacky way:

KGlobal::locale()->prettyFormatDuration(msecs)

Powermanager is in KDE's extragear, http://websvn.kde.org/trunk/extragear/utils/guidance-power-manager/
I think Jonathan Riddell maintains it.

Revision history for this message
Jonathan Thomas (echidnaman) wrote :
Changed in guidance-power-manager (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.