Merge lp:~dpm/ubuntu-clock-app/reboot-i18n into lp:ubuntu-clock-app

Proposed by David Planella
Status: Merged
Approved by: Nekhelesh Ramananthan
Approved revision: 55
Merged at revision: 55
Proposed branch: lp:~dpm/ubuntu-clock-app/reboot-i18n
Merge into: lp:ubuntu-clock-app
Diff against target: 341 lines (+257/-3)
7 files modified
CMakeLists.txt (+6/-0)
README.translations (+40/-0)
app/alarm/AlarmSettingsPage.qml (+1/-0)
app/worldclock/UserWorldCityDelegate.qml (+11/-3)
debian/changelog (+3/-0)
po/CMakeLists.txt (+25/-0)
po/com.ubuntu.clock.devel.pot (+171/-0)
To merge this branch: bzr merge lp:~dpm/ubuntu-clock-app/reboot-i18n
Reviewer Review Type Date Requested Status
Nekhelesh Ramananthan Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+230578@code.launchpad.net

Commit message

Added initial internationalization support in the build system.

Description of the change

Added initial internationalization support in the build system. Internationalization of the .desktop file coming in another merge proposal.

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: Needs Fixing (continuous-integration)
lp:~dpm/ubuntu-clock-app/reboot-i18n updated
52. By David Planella

Merged from trunk

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
Nekhelesh Ramananthan (nik90) wrote :

72 - i18n.tr("%1 minutes").arg(10),
73 - i18n.tr("%1 minutes").arg(20),
74 - i18n.tr("%1 minutes").arg(30),
75 - i18n.tr("%1 minutes").arg(60)
76 + i18n.tr("%1 minute", "%1 minutes", 10).arg(10),
77 + i18n.tr("%1 minute", "%1 minutes", 20).arg(20),
78 + i18n.tr("%1 minute", "%1 minutes", 30).arg(30),
79 + i18n.tr("%1 minute", "%1 minutes", 60).arg(60)

This is not required since the values shown in the brackets (10, 20, 30 ,60) are the only numbers that will be shown in the UI. Since they are all plural, we don't require %1 minute.

26 +Translations for the Music app happen in [Launchpad Translations][] and

This should be clock app.

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

10 + app/**.qml backend/**.cpp backend/**.h)

I don't think we need to include the .cpp and .h files since they are mostly used for data processing and do not include any UI strings that need to be translated.

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

Also please append an entry to the 3.1 version in the debian/changelog pls.

lp:~dpm/ubuntu-clock-app/reboot-i18n updated
53. By David Planella

Refinements to the addition of translations build support

54. By David Planella

Updated .pot file

55. By David Planella

Fixed string arguments typo

Revision history for this message
David Planella (dpm) wrote :

Thanks for the review, I believe I've addressed all comments. The reason I used plural forms for the i18n.tr("%1 minutes").arg(10) strings was simply because some languages have different plural rules for different types of numbers. It might not be an issue and I was just playing it safe. I guess if we get it wrong translators will tell us :)

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
Nekhelesh Ramananthan (nik90) wrote :

lgtm! Thanks for this. Can you set up launchpad to do the automatic import for the reboot branch?

review: Approve
Revision history for this message
David Planella (dpm) wrote :

Awesome, thanks! Yes, I had already done so in preparation for this branch
to land. Translations are already visible at
https://translations.launchpad.net/ubuntu-clock-app/reboot

On Sat, Aug 16, 2014 at 10:31 AM, Nekhelesh Ramananthan <
<email address hidden>> wrote:

> Review: Approve
>
> lgtm! Thanks for this. Can you set up launchpad to do the automatic import
> for the reboot branch?
> --
> https://code.launchpad.net/~dpm/ubuntu-clock-app/reboot-i18n/+merge/230578
> You are the owner of lp:~dpm/ubuntu-clock-app/reboot-i18n.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-08-13 12:03:49 +0000
3+++ CMakeLists.txt 2014-08-16 07:40:18 +0000
4@@ -64,8 +64,14 @@
5 set(EXEC "qmlscene $@ -I ${MODULE_PATH} ${CMAKE_INSTALL_PREFIX}/${UBUNTU-CLOCK_APP_DIR}/${MAIN_QML}")
6 endif()
7
8+file(GLOB_RECURSE I18N_SRC_FILES
9+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po
10+ *.qml *.js)
11+list(SORT I18N_SRC_FILES)
12+
13 add_subdirectory(app)
14 add_subdirectory(backend)
15+add_subdirectory(po)
16 if(NOT CLICK_MODE)
17 add_subdirectory(tests)
18 endif(NOT CLICK_MODE)
19
20=== added file 'README.translations'
21--- README.translations 1970-01-01 00:00:00 +0000
22+++ README.translations 2014-08-16 07:40:18 +0000
23@@ -0,0 +1,40 @@
24+# Updating translations
25+
26+Translations for the Music app happen in [Launchpad Translations][] and
27+are automatically committed daily on the trunk branch in the po/ folder.
28+
29+They are then built and installed as part of the package build, so that
30+developers don't really need to worry about them.
31+
32+However, there is one task that needs to be taken care of: exposing new
33+translatable messages to translators. So whenever you add new translatable
34+messages in the code, make sure to follow these steps:
35+
36+ 1. Run click-buddy retaining the build directory:
37+ `click-buddy --dir . --no-clean`
38+ 2. Copy the .pot file from the <build dir> mentioned in the output to your
39+ original source:
40+ `cp <build dir>/po/*.pot po/`
41+ 3. Commit the generated .pot file:
42+ `bzr commit -m"Updated translation template"`
43+ 4. Push the branch and send a merge proposal as usual
44+
45+And that's it, once the branch lands Launchpad should take care of all the rest!
46+
47+# Behind the scenes
48+
49+Behind the scenes, whenever the po/*.pot file (also known as translations template)
50+is committed to trunk Launchpad reads it and updates the translatable strings
51+exposed in the web UI. This will enable translators to work on the new strings.
52+The translations template contains all translatable strings that have been
53+extracted from the source code files.
54+
55+Launchpad will then store translations in its database and will commit them daily
56+in the form of textual po/*.po files to trunk. The PO files are also usually
57+referred to as the translations files. You'll find a translation file for each
58+language the app has got at least a translated message available for.
59+
60+Translations for core apps follow the standard [gettext format].
61+
62+ [Launchpad Translations]: https://translations.launchpad.net/ubuntu-clock-app/reboot
63+ [gettext format]: https://www.gnu.org/software/gettext/
64
65=== modified file 'app/alarm/AlarmSettingsPage.qml'
66--- app/alarm/AlarmSettingsPage.qml 2014-08-07 22:01:05 +0000
67+++ app/alarm/AlarmSettingsPage.qml 2014-08-16 07:40:18 +0000
68@@ -64,6 +64,7 @@
69
70 function title(index) {
71 if (title["text"] === undefined) {
72+ // TRANSLATORS: this refers to either 10, 20, 30 or 60 minutes
73 title.text =
74 [
75 i18n.tr("%1 minutes").arg(10),
76
77=== modified file 'app/worldclock/UserWorldCityDelegate.qml'
78--- app/worldclock/UserWorldCityDelegate.qml 2014-08-07 13:17:02 +0000
79+++ app/worldclock/UserWorldCityDelegate.qml 2014-08-16 07:40:18 +0000
80@@ -144,6 +144,8 @@
81 day = i18n.tr("Yesterday")
82 }
83
84+ // TRANSLATORS: this indicates if the time in a world clock
85+ // is behind or ahead of the time at the current location
86 var isBehind = model.timeTo > 0 ? i18n.tr("behind")
87 : i18n.tr("ahead")
88
89@@ -152,7 +154,9 @@
90 var hour = timediff[0]
91
92 if(hour > 0 && minute > 0) {
93- return ("%1\n%2hr%3min %4")
94+ // TRANSLATORS: the first argument is a day, followed by hour, minute and the
95+ // translation for either 'behind' or 'ahead'
96+ return (i18n.tr("%1\n%2 h %3 m %4"))
97 .arg(day)
98 .arg(hour)
99 .arg(minute)
100@@ -160,14 +164,18 @@
101 }
102
103 else if(hour > 0 && minute === 0) {
104- return ("%1\n%2hr %3")
105+ // TRANSLATORS: the first argument is a day, followed by hour and the
106+ // translation for either 'behind' or 'ahead'
107+ return (i18n.tr("%1\n%2 h %3"))
108 .arg(day)
109 .arg(hour)
110 .arg(isBehind)
111 }
112
113 else if(hour === 0 && minute > 0) {
114- return ("%1\n%2min %3")
115+ // TRANSLATORS: the first argument is a day, followed by minute and the
116+ // translation for either 'behind' or 'ahead'
117+ return ("%1\n%2 m %3")
118 .arg(day)
119 .arg(minute)
120 .arg(isBehind)
121
122=== modified file 'debian/changelog'
123--- debian/changelog 2014-08-13 17:45:35 +0000
124+++ debian/changelog 2014-08-16 07:40:18 +0000
125@@ -6,6 +6,9 @@
126 * Synced the fast scroll component with upstream changes
127 * Updated inner clock texture as requested by design
128
129+ [David Planella]
130+ * Added internationalization support (LP: #1354522)
131+
132 -- Nekhelesh Ramananthan <krnekhelesh@gmail.com> Wed, 13 Aug 2014 15:46:12 +0200
133
134 ubuntu-clock-app (3.0-0ubuntu1) utopic; urgency=medium
135
136=== added directory 'po'
137=== added file 'po/CMakeLists.txt'
138--- po/CMakeLists.txt 1970-01-01 00:00:00 +0000
139+++ po/CMakeLists.txt 2014-08-16 07:40:18 +0000
140@@ -0,0 +1,25 @@
141+include(FindGettext)
142+find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext)
143+
144+set(DOMAIN ${PROJECT_NAME})
145+set(POT_FILE ${DOMAIN}.pot)
146+file(GLOB PO_FILES *.po)
147+
148+add_custom_target(${POT_FILE} ALL
149+ COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} -o ${POT_FILE}
150+ -D ${CMAKE_CURRENT_SOURCE_DIR}
151+ --from-code=UTF-8
152+ --c++ --qt --add-comments=TRANSLATORS
153+ --keyword=tr --keyword=tr:1,2
154+ --package-name='${PROJECT}'
155+ --copyright-holder='Canonical Ltd.'
156+ ${I18N_SRC_FILES})
157+
158+foreach(PO_FILE ${PO_FILES})
159+ get_filename_component(LANG ${PO_FILE} NAME_WE)
160+ gettext_process_po_files(${LANG} ALL PO_FILES ${PO_FILE})
161+ set(INSTALL_DIR ${CMAKE_INSTALL_LOCALEDIR}/${LANG}/LC_MESSAGES)
162+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG}.gmo
163+ DESTINATION ${INSTALL_DIR}
164+ RENAME ${DOMAIN}.mo)
165+endforeach(PO_FILE)
166
167=== added file 'po/com.ubuntu.clock.devel.pot'
168--- po/com.ubuntu.clock.devel.pot 1970-01-01 00:00:00 +0000
169+++ po/com.ubuntu.clock.devel.pot 2014-08-16 07:40:18 +0000
170@@ -0,0 +1,171 @@
171+# SOME DESCRIPTIVE TITLE.
172+# Copyright (C) YEAR Canonical Ltd.
173+# This file is distributed under the same license as the PACKAGE package.
174+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
175+#
176+#, fuzzy
177+msgid ""
178+msgstr ""
179+"Project-Id-Version: \n"
180+"Report-Msgid-Bugs-To: \n"
181+"POT-Creation-Date: 2014-08-16 09:36+0200\n"
182+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
183+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
184+"Language-Team: LANGUAGE <LL@li.org>\n"
185+"Language: \n"
186+"MIME-Version: 1.0\n"
187+"Content-Type: text/plain; charset=CHARSET\n"
188+"Content-Transfer-Encoding: 8bit\n"
189+
190+#: ../app/alarm/AlarmLabel.qml:27 ../app/alarm/AlarmLabel.qml:43
191+#: ../app/alarm/EditAlarmPage.qml:220
192+msgid "Label"
193+msgstr ""
194+
195+#: ../app/alarm/AlarmList.qml:81 ../app/alarm/AlarmPage.qml:78
196+#: ../app/worldclock/UserWorldCityList.qml:103
197+msgid "Delete"
198+msgstr ""
199+
200+#: ../app/alarm/AlarmPage.qml:26
201+msgid "Alarms"
202+msgstr ""
203+
204+#: ../app/alarm/AlarmPage.qml:42 ../app/alarm/EditAlarmPage.qml:53
205+msgid "Alarm"
206+msgstr ""
207+
208+#: ../app/alarm/AlarmPage.qml:55
209+msgid "Cancel selection"
210+msgstr ""
211+
212+#: ../app/alarm/AlarmPage.qml:64
213+msgid "Select All"
214+msgstr ""
215+
216+#: ../app/alarm/AlarmRepeat.qml:28 ../app/alarm/EditAlarmPage.qml:210
217+msgid "Repeat"
218+msgstr ""
219+
220+#: ../app/alarm/AlarmSettingsPage.qml:29
221+msgid "Settings"
222+msgstr ""
223+
224+#: ../app/alarm/AlarmSettingsPage.qml:70 ../app/alarm/AlarmSettingsPage.qml:71
225+#: ../app/alarm/AlarmSettingsPage.qml:72 ../app/alarm/AlarmSettingsPage.qml:73
226+#: ../app/alarm/AlarmSettingsPage.qml:136
227+#, qt-format
228+msgid "%1 minutes"
229+msgstr ""
230+
231+#: ../app/alarm/AlarmSettingsPage.qml:93
232+msgid "Alarm volume"
233+msgstr ""
234+
235+#: ../app/alarm/AlarmSettingsPage.qml:135
236+msgid "Silence after"
237+msgstr ""
238+
239+#: ../app/alarm/AlarmSettingsPage.qml:177
240+msgid "Vibration"
241+msgstr ""
242+
243+#: ../app/alarm/AlarmSettingsPage.qml:206
244+msgid "Change time and date"
245+msgstr ""
246+
247+#: ../app/alarm/AlarmSound.qml:27
248+msgid "Sound"
249+msgstr ""
250+
251+#: ../app/alarm/AlarmUtils.qml:33
252+msgid "Weekdays"
253+msgstr ""
254+
255+#: ../app/alarm/AlarmUtils.qml:37
256+msgid "Weekends"
257+msgstr ""
258+
259+#: ../app/alarm/AlarmUtils.qml:41
260+msgid "Daily"
261+msgstr ""
262+
263+#: ../app/alarm/EditAlarmPage.qml:39
264+msgid "New alarm"
265+msgstr ""
266+
267+#: ../app/alarm/EditAlarmPage.qml:39
268+msgid "Edit alarm"
269+msgstr ""
270+
271+#: ../app/alarm/EditAlarmPage.qml:233
272+msgid "Sound (disabled)"
273+msgstr ""
274+
275+#: ../app/alarm/EditAlarmPage.qml:255
276+msgid "Delete alarm"
277+msgstr ""
278+
279+#: ../app/clock/ClockPage.qml:64
280+msgid "Add"
281+msgstr ""
282+
283+#: ../app/clock/ClockPage.qml:65 ../app/worldclock/WorldCityList.qml:50
284+msgid "City"
285+msgstr ""
286+
287+#: ../app/ubuntu-clock-app.qml:102
288+msgid "Next Alarm in .."
289+msgstr ""
290+
291+#: ../app/worldclock/UserWorldCityDelegate.qml:136
292+msgid "Today"
293+msgstr ""
294+
295+#: ../app/worldclock/UserWorldCityDelegate.qml:140
296+msgid "Tomorrow"
297+msgstr ""
298+
299+#: ../app/worldclock/UserWorldCityDelegate.qml:144
300+msgid "Yesterday"
301+msgstr ""
302+
303+#. TRANSLATORS: this indicates if the time in a world clock
304+#. is behind or ahead of the time at the current location
305+#: ../app/worldclock/UserWorldCityDelegate.qml:149
306+msgid "behind"
307+msgstr ""
308+
309+#: ../app/worldclock/UserWorldCityDelegate.qml:150
310+msgid "ahead"
311+msgstr ""
312+
313+#. TRANSLATORS: the first argument is a day, followed by hour, minute and the
314+#. translation for either 'behind' or 'ahead'
315+#: ../app/worldclock/UserWorldCityDelegate.qml:159
316+#, qt-format
317+msgid ""
318+"%1\n"
319+"%2 h %3 m %4"
320+msgstr ""
321+
322+#. TRANSLATORS: the first argument is a day, followed by hour and the
323+#. translation for either 'behind' or 'ahead'
324+#: ../app/worldclock/UserWorldCityDelegate.qml:169
325+#, qt-format
326+msgid ""
327+"%1\n"
328+"%2 h %3"
329+msgstr ""
330+
331+#: ../app/worldclock/UserWorldCityDelegate.qml:185
332+msgid "No Time Difference"
333+msgstr ""
334+
335+#: ../app/worldclock/WorldCityList.qml:38
336+msgid "Select a city"
337+msgstr ""
338+
339+#: ../app/worldclock/WorldCityList.qml:64
340+msgid "Back"
341+msgstr ""

Subscribers

People subscribed via source and target branches