Merge lp:~nik90/ubuntu-clock-app/fix-translation-string into lp:ubuntu-clock-app

Proposed by Nekhelesh Ramananthan
Status: Merged
Approved by: Nekhelesh Ramananthan
Approved revision: 174
Merged at revision: 174
Proposed branch: lp:~nik90/ubuntu-clock-app/fix-translation-string
Merge into: lp:ubuntu-clock-app
Diff against target: 76 lines (+11/-7)
3 files modified
app/alarm/AlarmUtils.qml (+3/-0)
debian/changelog (+1/-0)
po/com.ubuntu.clock.pot (+7/-7)
To merge this branch: bzr merge lp:~nik90/ubuntu-clock-app/fix-translation-string
Reviewer Review Type Date Requested Status
Nekhelesh Ramananthan Approve
Albert Astals Cid (community) Approve
David Planella Needs Information
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+241980@code.launchpad.net

Commit message

Fixes the "h", "d" and "m" strings not being translatable in "Next Alarm in 3d 2h 4m".

Description of the change

Fixes the "h", "d" and "m" strings not being translatable in "Next Alarm in 3d 2h 4m".

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
David Planella (dpm) wrote :

Thanks! See inline comments.

review: Needs Fixing
Revision history for this message
Albert Astals Cid (aacid) wrote :

I'd suggest adding
   //xgettext: no-c-format
as comment just over the tr call to instruct gettext it doesn't have to treat those strings as printf-like strings https://www.gnu.org/software/gettext/manual/html_node/c_002dformat-Flag.html

174. By Nekhelesh Ramananthan

Reverted ugly string break up and hopefully fixed the issue using a c-string header comment

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
David Planella (dpm) wrote :

Albert, but will that not disable error checking for those strings?

I.e. if we've got this situation:

msgid "in %1h %2m"
msgtr "en %1h"

Gettext will flag it as an error. As Launchpad uses gettext for format error checking, it won't allow submitting the incorrect translation.

However, if we add the no-c-format flag, no error checking will be performed, thus letting incorrect translations through. I'm not sure how the code would behave when loading that example translation from the .mo file.

Do I understand this correctly?

review: Needs Information
Revision history for this message
Albert Astals Cid (aacid) wrote :

No, that flag doesn't disable error checking, it disables c-format error checking.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Let's give it a try i'd say.

review: Approve
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

I am merging this to test the translation fix. If anything goes bad, it should be simple enough to revert.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/alarm/AlarmUtils.qml'
2--- app/alarm/AlarmUtils.qml 2014-10-09 19:14:40 +0000
3+++ app/alarm/AlarmUtils.qml 2014-11-17 16:11:28 +0000
4@@ -85,6 +85,7 @@
5 // TRANSLATORS: the first argument is the number of days,
6 // followed by hour and minute (eg. in 1d 20h 3m)
7 if(timeObject.days) {
8+ //xgettext: no-c-format
9 alarmETA = i18n.tr("in %1d %2h %3m")
10 .arg(timeObject.days)
11 .arg(timeObject.hours)
12@@ -94,6 +95,7 @@
13 // TRANSLATORS: the first argument is the number of
14 // hours followed by the minutes (eg. in 4h 3m)
15 else if (timeObject.hours) {
16+ //xgettext: no-c-format
17 alarmETA = i18n.tr("in %1h %2m")
18 .arg(timeObject.hours)
19 .arg(timeObject.minutes)
20@@ -102,6 +104,7 @@
21 // TRANSLATORS: the argument is the number of
22 // minutes to the alarm (eg. in 3m)
23 else {
24+ //xgettext: no-c-format
25 alarmETA = i18n.tr("in %1m")
26 .arg(timeObject.minutes)
27 }
28
29=== modified file 'debian/changelog'
30--- debian/changelog 2014-10-28 10:54:45 +0000
31+++ debian/changelog 2014-11-17 16:11:28 +0000
32@@ -27,6 +27,7 @@
33 now set to false to improve startup animation.
34 * Customised splash screen (white background) (LP: #1377638)
35 * Added manual test to check disabling of alarms.
36+ * Fixed alarm string not being translatable (LP: #1380248)
37
38 [Akiva Shammai Avraham]
39 * Improved the analog clock performance by updating the clock hands every second
40
41=== modified file 'po/com.ubuntu.clock.pot'
42--- po/com.ubuntu.clock.pot 2014-11-04 15:58:05 +0000
43+++ po/com.ubuntu.clock.pot 2014-11-17 16:11:28 +0000
44@@ -8,7 +8,7 @@
45 msgstr ""
46 "Project-Id-Version: \n"
47 "Report-Msgid-Bugs-To: \n"
48-"POT-Creation-Date: 2014-11-04 16:55+0100\n"
49+"POT-Creation-Date: 2014-11-17 17:05+0100\n"
50 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
51 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
52 "Language-Team: LANGUAGE <LL@li.org>\n"
53@@ -127,18 +127,18 @@
54 msgid "Alarm Passed"
55 msgstr ""
56
57-#: ../app/alarm/AlarmUtils.qml:88
58-#, qt-format
59+#: ../app/alarm/AlarmUtils.qml:89
60+#, no-c-format, qt-format
61 msgid "in %1d %2h %3m"
62 msgstr ""
63
64-#: ../app/alarm/AlarmUtils.qml:97
65-#, qt-format
66+#: ../app/alarm/AlarmUtils.qml:99
67+#, no-c-format, qt-format
68 msgid "in %1h %2m"
69 msgstr ""
70
71-#: ../app/alarm/AlarmUtils.qml:105
72-#, c-format, qt-format
73+#: ../app/alarm/AlarmUtils.qml:108
74+#, no-c-format, qt-format
75 msgid "in %1m"
76 msgstr ""
77

Subscribers

People subscribed via source and target branches