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
=== modified file 'app/alarm/AlarmUtils.qml'
--- app/alarm/AlarmUtils.qml 2014-10-09 19:14:40 +0000
+++ app/alarm/AlarmUtils.qml 2014-11-17 16:11:28 +0000
@@ -85,6 +85,7 @@
85 // TRANSLATORS: the first argument is the number of days,85 // TRANSLATORS: the first argument is the number of days,
86 // followed by hour and minute (eg. in 1d 20h 3m)86 // followed by hour and minute (eg. in 1d 20h 3m)
87 if(timeObject.days) {87 if(timeObject.days) {
88 //xgettext: no-c-format
88 alarmETA = i18n.tr("in %1d %2h %3m")89 alarmETA = i18n.tr("in %1d %2h %3m")
89 .arg(timeObject.days)90 .arg(timeObject.days)
90 .arg(timeObject.hours)91 .arg(timeObject.hours)
@@ -94,6 +95,7 @@
94 // TRANSLATORS: the first argument is the number of95 // TRANSLATORS: the first argument is the number of
95 // hours followed by the minutes (eg. in 4h 3m)96 // hours followed by the minutes (eg. in 4h 3m)
96 else if (timeObject.hours) {97 else if (timeObject.hours) {
98 //xgettext: no-c-format
97 alarmETA = i18n.tr("in %1h %2m")99 alarmETA = i18n.tr("in %1h %2m")
98 .arg(timeObject.hours)100 .arg(timeObject.hours)
99 .arg(timeObject.minutes)101 .arg(timeObject.minutes)
@@ -102,6 +104,7 @@
102 // TRANSLATORS: the argument is the number of104 // TRANSLATORS: the argument is the number of
103 // minutes to the alarm (eg. in 3m)105 // minutes to the alarm (eg. in 3m)
104 else {106 else {
107 //xgettext: no-c-format
105 alarmETA = i18n.tr("in %1m")108 alarmETA = i18n.tr("in %1m")
106 .arg(timeObject.minutes)109 .arg(timeObject.minutes)
107 }110 }
108111
=== modified file 'debian/changelog'
--- debian/changelog 2014-10-28 10:54:45 +0000
+++ debian/changelog 2014-11-17 16:11:28 +0000
@@ -27,6 +27,7 @@
27 now set to false to improve startup animation.27 now set to false to improve startup animation.
28 * Customised splash screen (white background) (LP: #1377638)28 * Customised splash screen (white background) (LP: #1377638)
29 * Added manual test to check disabling of alarms.29 * Added manual test to check disabling of alarms.
30 * Fixed alarm string not being translatable (LP: #1380248)
3031
31 [Akiva Shammai Avraham]32 [Akiva Shammai Avraham]
32 * Improved the analog clock performance by updating the clock hands every second33 * Improved the analog clock performance by updating the clock hands every second
3334
=== modified file 'po/com.ubuntu.clock.pot'
--- po/com.ubuntu.clock.pot 2014-11-04 15:58:05 +0000
+++ po/com.ubuntu.clock.pot 2014-11-17 16:11:28 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: \n"9"Project-Id-Version: \n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2014-11-04 16:55+0100\n"11"POT-Creation-Date: 2014-11-17 17:05+0100\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -127,18 +127,18 @@
127msgid "Alarm Passed"127msgid "Alarm Passed"
128msgstr ""128msgstr ""
129129
130#: ../app/alarm/AlarmUtils.qml:88130#: ../app/alarm/AlarmUtils.qml:89
131#, qt-format131#, no-c-format, qt-format
132msgid "in %1d %2h %3m"132msgid "in %1d %2h %3m"
133msgstr ""133msgstr ""
134134
135#: ../app/alarm/AlarmUtils.qml:97135#: ../app/alarm/AlarmUtils.qml:99
136#, qt-format136#, no-c-format, qt-format
137msgid "in %1h %2m"137msgid "in %1h %2m"
138msgstr ""138msgstr ""
139139
140#: ../app/alarm/AlarmUtils.qml:105140#: ../app/alarm/AlarmUtils.qml:108
141#, c-format, qt-format141#, no-c-format, qt-format
142msgid "in %1m"142msgid "in %1m"
143msgstr ""143msgstr ""
144144

Subscribers

People subscribed via source and target branches