Merge lp:~dpm/ubuntu-calendar-app/desktop-file-i18n into lp:ubuntu-calendar-app

Proposed by David Planella
Status: Merged
Approved by: David Planella
Approved revision: 42
Merged at revision: 51
Proposed branch: lp:~dpm/ubuntu-calendar-app/desktop-file-i18n
Merge into: lp:ubuntu-calendar-app
Prerequisite: lp:~dpm/ubuntu-calendar-app/rename
Diff against target: 250 lines (+101/-73)
4 files modified
.bzrignore (+2/-0)
README (+20/-0)
po/calendar-app.pot (+45/-41)
po/po.pro (+34/-32)
To merge this branch: bzr merge lp:~dpm/ubuntu-calendar-app/desktop-file-i18n
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
David Planella Approve
Olivier Tilloy (community) Approve
Review via email: mp+169029@code.launchpad.net

Commit message

Added support for extracting translatable strings from the .desktop files

Description of the change

Added support for extracting translatable strings from the .desktop files

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
Olivier Tilloy (osomon) wrote :

Looks good to me. As agreed on IRC, please add an entry to the README file to explain how to generate an up-to-date translation template, and then feel free to top-approve.

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

Ok, updated README file as requested, and top-approving. Thanks!

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
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
David Planella (dpm) wrote :

Approved to make Jenkins happy

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2013-06-12 18:12:18 +0000
3+++ .bzrignore 2013-06-17 17:32:28 +0000
4@@ -4,3 +4,5 @@
5 debian/app-template/
6 debian/*.debhelper.log
7 debian/*.substvars
8+.build
9+po/Makefile
10
11=== modified file 'README'
12--- README 2013-03-14 11:38:17 +0000
13+++ README 2013-06-17 17:32:28 +0000
14@@ -7,3 +7,23 @@
15 $ qmlscene calendar.qml
16
17 To test the application on the device check out the "testrun.sh" script.
18+
19+# Updating translations
20+
21+Translations for the Calendar app happen in [Launchpad Translations][] and
22+are automatically committed daily on the trunk branch in the po/ folder.
23+
24+They are then built and installed as part of the package build, so that
25+developers don't really need to worry about them.
26+
27+However, there is one task that needs to be taken care of: exposing new
28+translatable messages to translators. So whenever you add new translatable
29+messages in the code, make sure to follow these steps:
30+
31+ 1. Change directory to the po/ folder: `cd po`
32+ 2. Update the translations template: `qmake && make pot`
33+ 3. Commit the generated .pot file: `bzr commit -m"Updated translation template"`
34+
35+And that's it, Launchpad should take care of all the rest
36+
37+ [Launchpad Translations]: https://translations.launchpad.net/ubuntu-calendar-app
38
39=== modified file 'po/calendar-app.pot'
40--- po/calendar-app.pot 2013-06-12 18:12:18 +0000
41+++ po/calendar-app.pot 2013-06-17 17:32:28 +0000
42@@ -1,14 +1,14 @@
43 # SOME DESCRIPTIVE TITLE.
44-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
45+# Copyright (C) YEAR Canonical Ltd.
46 # This file is distributed under the same license as the PACKAGE package.
47 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
48 #
49 #, fuzzy
50 msgid ""
51 msgstr ""
52-"Project-Id-Version: ubuntu-calendar-app\n"
53+"Project-Id-Version: calendar-app\n"
54 "Report-Msgid-Bugs-To: \n"
55-"POT-Creation-Date: 2013-05-23 23:02+0900\n"
56+"POT-Creation-Date: 2013-06-12 17:24+0200\n"
57 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
58 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
59 "Language-Team: LANGUAGE <LL@li.org>\n"
60@@ -17,64 +17,68 @@
61 "Content-Type: text/plain; charset=CHARSET\n"
62 "Content-Transfer-Encoding: 8bit\n"
63
64-#: DiaryView.qml:54
65+#: ../DiaryView.qml:54
66 msgid "(+) New Event"
67 msgstr ""
68
69-#: NewEvent.qml:104
70-msgid "Add Location"
71-msgstr ""
72-
73-#: NewEvent.qml:25
74-msgid "Add event name"
75-msgstr ""
76-
77-#: EventDetails.qml:69
78+#: ../EventDetails.qml:69
79 msgid "Add invite"
80 msgstr ""
81
82-#: NewEvent.qml:20
83+#: ../EventDetails.qml:75
84+msgid "Edit"
85+msgstr ""
86+
87+#: ../EventDetails.qml:150 ../NewEvent.qml:112
88+msgid "People"
89+msgstr ""
90+
91+#: ../NewEvent.qml:20
92 msgid "Create event"
93 msgstr ""
94
95-#: calendar.qml:45
96-msgid "Diary"
97-msgstr ""
98-
99-#: EventDetails.qml:75
100-msgid "Edit"
101+#: ../NewEvent.qml:25
102+msgid "Add event name"
103+msgstr ""
104+
105+#: ../NewEvent.qml:99
106+msgid "Location"
107+msgstr ""
108+
109+#: ../NewEvent.qml:104
110+msgid "Add Location"
111+msgstr ""
112+
113+#: ../NewEvent.qml:117
114+msgid "Invite People"
115+msgstr ""
116+
117+#: ../NewEvent.qml:128
118+msgid "Save"
119 msgstr ""
120
121 #. TRANSLATORS: this is a time formatting string,
122 #. see http://qt-project.org/doc/qt-5.0/qtqml/qml-qtquick2-date.html#details for valid expressions
123-#: TimeLineView.qml:147
124+#: ../TimeLineView.qml:147
125 msgid "HH:mm"
126 msgstr ""
127
128-#: NewEvent.qml:117
129-msgid "Invite People"
130-msgstr ""
131-
132-#: NewEvent.qml:99
133-msgid "Location"
134-msgstr ""
135-
136-#: calendar.qml:36
137+#: ../calendar.qml:31
138+msgid "To-do"
139+msgstr ""
140+
141+#: ../calendar.qml:36
142 msgid "New Event"
143 msgstr ""
144
145-#: EventDetails.qml:150 NewEvent.qml:112
146-msgid "People"
147-msgstr ""
148-
149-#: NewEvent.qml:128
150-msgid "Save"
151-msgstr ""
152-
153-#: calendar.qml:41 calendar.qml:48
154+#: ../calendar.qml:41 ../calendar.qml:48
155 msgid "Timeline"
156 msgstr ""
157
158-#: calendar.qml:31
159-msgid "To-do"
160+#: ../calendar.qml:45
161+msgid "Diary"
162+msgstr ""
163+
164+#: ../.build/calendar-app.desktop.js:1
165+msgid "Calendar"
166 msgstr ""
167
168=== modified file 'po/po.pro'
169--- po/po.pro 2013-06-12 18:12:18 +0000
170+++ po/po.pro 2013-06-17 17:32:28 +0000
171@@ -3,46 +3,48 @@
172 PROJECTNAME = $$system(basename ../*.qmlproject)
173 PROJECTNAME = $$replace(PROJECTNAME,.qmlproject,)
174
175-SOURCECODE = ../*.qml
176+DESKTOPFILE = ../$${PROJECTNAME}.desktop
177+
178+SOURCECODE = ../*.qml \
179+ ../*.js
180+
181+BUILDDIR = ../.build
182+DESKTOPFILETEMP = $${BUILDDIR}/$${PROJECTNAME}.desktop.js
183
184 message("")
185 message(" Project Name: $$PROJECTNAME ")
186 message(" Source Code: $$SOURCECODE ")
187 message("")
188-message(" run 'make pot' to generate the pot file from source code. ")
189-message(" run 'make translate' to create a new translation (po) based on pot. ")
190-message(" run 'make mo' to generate the mo files from po files. ")
191-message(" run 'qmake; make install' to install the mo files. ")
192+message(" Run 'make pot' to generate the pot file from source code. ")
193 message("")
194
195-## generate pot file 'make pot'
196+## Generate pot file 'make pot'
197 potfile.target = pot
198-potfile.commands = xgettext -o $${PROJECTNAME}.pot --package-name $${PROJECTNAME} --qt --c++ --add-comments=TRANSLATORS --keyword=tr $${SOURCECODE}
199+potfile.commands = xgettext \
200+ -o $${PROJECTNAME}.pot \
201+ --copyright=\"Canonical Ltd.\" \
202+ --package-name $${PROJECTNAME} \
203+ --qt --c++ --add-comments=TRANSLATORS \
204+ --keyword=tr --keyword=tr:1,2 \
205+ $${SOURCECODE} $${DESKTOPFILETEMP}
206+potfile.depends = desktopfile
207 QMAKE_EXTRA_TARGETS += potfile
208
209-## poedit target for new translations 'make translate'
210-poedit.target = translate
211-poedit.commands = cp messages.pot new_language.po; poedit new_language.po
212-QMAKE_EXTRA_TARGETS += poedit
213-
214-## generate mo files 'make mo'
215-mofiles.target = mo
216-mofiles.commands = msgfmt *.po
217-QMAKE_EXTRA_TARGETS += mofiles
218-
219-## Installation steps for mo files. 'make install'
220-MO_FILES = $$system(ls *.mo)
221-
222-install_mo_commands =
223-for(mo_file, MO_FILES) {
224- mo_name = $$replace(mo_file,.mo,)
225- mo_targetpath = $(INSTALL_ROOT)/usr/share/locale/$${mo_name}/LC_MESSAGES
226- mo_target = $${mo_targetpath}/$${PROJECTNAME}.mo
227- !isEmpty(install_mo_commands): install_mo_commands += &&
228- install_mo_commands += test -d $$mo_targetpath || mkdir -p $$mo_targetpath
229- install_mo_commands += && cp $$mo_file $$mo_target
230-}
231-
232-install.commands = $$install_mo_commands
233-QMAKE_EXTRA_TARGETS += install
234+## Do not use this rule directly. It's a dependency rule to
235+## generate an intermediate .h file to extract translatable
236+## strings from the .desktop file
237+desktopfile.target = desktopfile
238+desktopfile.commands = awk \'BEGIN { FS=\"=\" }; /Name/ {print \"var s = i18n.tr(\42\" \$$2 \"\42);\"}\' $${DESKTOPFILE} > $${DESKTOPFILETEMP}
239+desktopfile.depends = makebuilddir
240+QMAKE_EXTRA_TARGETS += desktopfile
241+
242+## Dependency rule to create the temporary build dir
243+makebuilddir.target = makebuilddir
244+makebuilddir.commands = mkdir -p $${BUILDDIR}
245+QMAKE_EXTRA_TARGETS += makebuilddir
246+
247+## Rule to clean the products of the build
248+clean.target = clean
249+clean.commands = rm -Rf $${BUILDDIR}
250+QMAKE_EXTRA_TARGETS += clean
251

Subscribers

People subscribed via source and target branches

to status/vote changes: