Merge lp:~dpm/click-update-manager/enable-translations into lp:click-update-manager

Proposed by David Planella
Status: Rejected
Rejected by: Adam Collard
Proposed branch: lp:~dpm/click-update-manager/enable-translations
Merge into: lp:click-update-manager
Diff against target: 292 lines (+197/-2)
8 files modified
.bzrignore (+2/-0)
Components/PageUpdate.qml (+8/-2)
README.translations (+36/-0)
click-update-manager.desktop (+1/-0)
debian/rules (+13/-0)
po/po.pro (+58/-0)
po/updatemanager.pot (+68/-0)
updatemanager.qmlproject (+11/-0)
To merge this branch: bzr merge lp:~dpm/click-update-manager/enable-translations
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Ubuntu One hackers Pending
Review via email: mp+188519@code.launchpad.net

Commit message

Enable translation extraction, exposing them to Launchpad and shipping them in the package

Description of the change

Enable translation extraction, exposing them to Launchpad and shipping them in the package.

This branch:

- Extracts translatable messages and generates a .pot file containing them
- Adds the po/updatemanager.pot file to version control, so that the translatable messages are exposed to translators in Launchpad
- Builds and ships the translations in the Debian package, from the po/*.po textual files into the *.mo files in the standard per-language locale system folders

Notes:

- Once this is merged, I'd recommend setting automatic translation exports in Launchpad. This way if there are new translations, they will be committed daily as po/$LANGCODE.po in the branch. This is the same setup we use for core apps.
- Since we're past string freeze, I'll upload the .pot file manually into Launchpad, so that translators can start doing their work without having to wait for this MP to be reviewed.

See the README.translations file for more info

To post a comment you must log in.
31. By David Planella

Updated project file to show translations-related files

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

31. By David Planella

Updated project file to show translations-related files

30. By David Planella

Added support for building and installing translations in the Debian package

29. By David Planella

Internationalization improvements to ease translation

28. By David Planella

Added gettext domain for .desktop file

27. By David Planella

Added basic i18n infrastructure, created .pot file for translators

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.bzrignore'
2--- .bzrignore 1970-01-01 00:00:00 +0000
3+++ .bzrignore 2013-10-01 07:00:58 +0000
4@@ -0,0 +1,2 @@
5+.build
6+po/Makefile
7
8=== modified file 'Components/PageUpdate.qml'
9--- Components/PageUpdate.qml 2013-09-27 18:30:17 +0000
10+++ Components/PageUpdate.qml 2013-10-01 07:00:58 +0000
11@@ -63,6 +63,7 @@
12 Button {
13 id: retryButton
14 objectName: "retryButton"
15+ // TRANSLATORS: this is shown in a button to re-check for updates. Please keep it short.
16 text: i18n.tr("Check again")
17 anchors {
18 left: parent.left
19@@ -84,7 +85,7 @@
20 Button {
21 id: installAllButton
22 objectName: "installAllButton"
23- text: i18n.tr("Install %1 Updates").arg(root.updates)
24+ text: i18n.tr("Install %1 Update", "Install %1 Updates", root.updates).arg(root.updates)
25 anchors {
26 left: parent.left
27 right: parent.right
28@@ -137,6 +138,7 @@
29 onMessageChanged: {
30 if(message.length > 0) {
31 labelVersion.text = message;
32+ // TRANSLATORS: this is shown in a button to retry updates. Please keep it short.
33 buttonAppUpdate.text = i18n.tr("Retry");
34 modelData.updateState = false;
35 }
36@@ -151,6 +153,7 @@
37
38 Button {
39 id: buttonAppUpdate
40+ // TRANSLATORS: this is shown in a button to apply updates. Please keep it short.
41 text: i18n.tr("Update")
42 height: textArea.height / 2
43
44@@ -194,7 +197,8 @@
45 left: parent.left
46 right: parent.right
47 }
48- text: modelData.remoteVersion ? i18n.tr("Version: ") + modelData.remoteVersion : ""
49+ // TRANSLATORS: this is a label that shows the version of the app
50+ text: modelData.remoteVersion ? i18n.tr("Version:") + " " + modelData.remoteVersion : ""
51 color: "white"
52 visible: !modelData.updateState
53 elide: Text.ElideRight
54@@ -230,6 +234,8 @@
55 onFinished: {
56 progress.visible = false;
57 buttonAppUpdate.visible = false;
58+ // TRANSLATORS: this is a message to indicate success after the installation
59+ // process has finished
60 textArea.message = i18n.tr("Installed");
61 root.updates -= 1;
62 }
63
64=== added file 'README.translations'
65--- README.translations 1970-01-01 00:00:00 +0000
66+++ README.translations 2013-10-01 07:00:58 +0000
67@@ -0,0 +1,36 @@
68+# Updating translations
69+
70+Translations for the Click Update Managerhappen in [Launchpad Translations][]
71+and are automatically committed daily on the trunk branch in the po/ folder.
72+
73+They are then built and installed as part of the package build, so that
74+developers don't really need to worry about them.
75+
76+However, there is one task that needs to be taken care of: exposing new
77+translatable messages to translators. So whenever you add new translatable
78+messages in the code, make sure to follow these steps:
79+
80+ 1. Change directory to the po/ folder: `cd po`
81+ 2. Update the translations template: `qmake && make pot`
82+ 3. Commit the generated .pot file: `bzr commit -m"Updated translation template"`
83+ 4. Push the branch and send a merge proposal as usual
84+
85+And that's it, once the branch lands Launchpad should take care of all the rest!
86+
87+# Behind the scenes
88+
89+Behind the scenes, whenever the po/*.pot file (also known as translations template)
90+is committed to trunk Launchpad reads it and updates the translatable strings
91+exposed in the web UI. This will enable translators to work on the new strings.
92+The translations template contains all translatable strings that have been
93+extracted from the source code files.
94+
95+Launchpad will then store translations in its database and will commit them daily
96+in the form of textual po/*.po files to trunk. The PO files are also usually
97+referred to as the translations files. You'll find a translation file for each
98+language the app has got at least a translated message available for.
99+
100+Translations for core apps follow the standard [gettext format].
101+
102+ [Launchpad Translations]: https://translations.launchpad.net/click-update-manager
103+ [gettext format]: https://www.gnu.org/software/gettext/
104
105=== modified file 'click-update-manager.desktop'
106--- click-update-manager.desktop 2013-09-26 19:14:00 +0000
107+++ click-update-manager.desktop 2013-10-01 07:00:58 +0000
108@@ -6,3 +6,4 @@
109 Terminal=false
110 Type=Application
111 X-Ubuntu-Touch=true
112+X-Ubuntu-Gettext-Domain=updatemanager
113
114=== modified file 'debian/rules'
115--- debian/rules 2013-09-26 21:07:17 +0000
116+++ debian/rules 2013-10-01 07:00:58 +0000
117@@ -11,3 +11,16 @@
118
119 override_dh_auto_test:
120 dh_auto_build -- check
121+
122+override_dh_install:
123+ tests/autopilot/install_autopilot.sh $(CURDIR)
124+ dh_install --fail-missing
125+ appname=updatemanager; \
126+ for pofile in $(shell find ./po -name "*.po"); do \
127+ pofilename="$${pofile##*/}"; \
128+ langcode="$${pofilename%.*}"; \
129+ localedir="debian/$$appname/usr/share/locale/$$langcode/LC_MESSAGES"; \
130+ mkdir -p $$localedir; \
131+ mofile="$$localedir/$$appname.mo"; \
132+ msgfmt -o $$mofile $$pofile; \
133+ done
134
135=== added directory 'po'
136=== added file 'po/po.pro'
137--- po/po.pro 1970-01-01 00:00:00 +0000
138+++ po/po.pro 2013-10-01 07:00:58 +0000
139@@ -0,0 +1,58 @@
140+## This .pro file is used to create a Makefile with the necessary rules
141+## to create an initial translations template and to update it whenever
142+## there are new translatable strings in the project that are ready to be
143+## exposed to translators
144+##
145+## See the ../README.translations file for more information
146+
147+TEMPLATE = subdirs
148+
149+PROJECTNAME = $$system(basename ../*.qmlproject)
150+PROJECTNAME = $$replace(PROJECTNAME,.qmlproject,)
151+
152+## DESKTOPFILE = ../$${PROJECTNAME}.desktop
153+DESKTOPFILE = ../click-update-manager.desktop
154+
155+SOURCECODE = ../*.qml \
156+ ../Components/*.qml
157+
158+BUILDDIR = ../.build
159+DESKTOPFILETEMP = $${BUILDDIR}/$${PROJECTNAME}.desktop.js
160+
161+message("")
162+message(" Project Name: $$PROJECTNAME ")
163+message(" Source Code: $$SOURCECODE ")
164+message("")
165+message(" Run 'make pot' to generate the pot file from source code. ")
166+message("")
167+
168+## Generate pot file 'make pot'
169+potfile.target = pot
170+potfile.commands = xgettext \
171+ -o $${PROJECTNAME}.pot \
172+ --copyright=\"Canonical Ltd. \" \
173+ --package-name $${PROJECTNAME} \
174+ --qt --c++ --add-comments=TRANSLATORS \
175+ --keyword=tr --keyword=tr:1,2 \
176+ $${SOURCECODE} $${DESKTOPFILETEMP}
177+potfile.depends = desktopfile
178+QMAKE_EXTRA_TARGETS += potfile
179+
180+## Do not use this rule directly. It's a dependency rule to
181+## generate an intermediate .js file to extract translatable
182+## strings from the .desktop file
183+desktopfile.target = desktopfile
184+desktopfile.commands = awk \'BEGIN { FS=\"=\" }; /Name/ {print \"var s = i18n.tr(\42\" \$$2 \"\42);\"}\' $${DESKTOPFILE} > $${DESKTOPFILETEMP}
185+desktopfile.depends = makebuilddir
186+QMAKE_EXTRA_TARGETS += desktopfile
187+
188+## Dependency rule to create the temporary build dir
189+makebuilddir.target = makebuilddir
190+makebuilddir.commands = mkdir -p $${BUILDDIR}
191+QMAKE_EXTRA_TARGETS += makebuilddir
192+
193+## Rule to clean the products of the build
194+clean.target = clean
195+clean.commands = rm -Rf $${BUILDDIR}
196+QMAKE_EXTRA_TARGETS += clean
197+
198
199=== added file 'po/updatemanager.pot'
200--- po/updatemanager.pot 1970-01-01 00:00:00 +0000
201+++ po/updatemanager.pot 2013-10-01 07:00:58 +0000
202@@ -0,0 +1,68 @@
203+# click-update-manager translations
204+# Copyright (C) 2013 Canonical Ltd.
205+# This file is distributed under the same license as the click-update-manager package.
206+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
207+#
208+#, fuzzy
209+msgid ""
210+msgstr ""
211+"Project-Id-Version: updatemanager\n"
212+"Report-Msgid-Bugs-To: \n"
213+"POT-Creation-Date: 2013-10-01 08:42+0200\n"
214+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
215+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
216+"Language-Team: LANGUAGE <LL@li.org>\n"
217+"Language: \n"
218+"MIME-Version: 1.0\n"
219+"Content-Type: text/plain; charset=CHARSET\n"
220+"Content-Transfer-Encoding: 8bit\n"
221+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
222+
223+#: ../Components/PageUpdate.qml:24
224+msgid "Updates"
225+msgstr ""
226+
227+#: ../Components/PageUpdate.qml:51
228+msgid "No Updates Found"
229+msgstr ""
230+
231+#: ../Components/PageUpdate.qml:58
232+msgid "Please log into your Ubuntu One account in System Settings."
233+msgstr ""
234+
235+#. TRANSLATORS: this is shown in a button to re-check for updates. Please keep it short.
236+#: ../Components/PageUpdate.qml:67
237+msgid "Check again"
238+msgstr ""
239+
240+#: ../Components/PageUpdate.qml:88
241+#, qt-format
242+msgid "Install %1 Update"
243+msgid_plural "Install %1 Updates"
244+msgstr[0] ""
245+msgstr[1] ""
246+
247+#. TRANSLATORS: this is shown in a button to retry updates. Please keep it short.
248+#: ../Components/PageUpdate.qml:142
249+msgid "Retry"
250+msgstr ""
251+
252+#. TRANSLATORS: this is shown in a button to apply updates. Please keep it short.
253+#: ../Components/PageUpdate.qml:157
254+msgid "Update"
255+msgstr ""
256+
257+#. TRANSLATORS: this is a label that shows the version of the app
258+#: ../Components/PageUpdate.qml:201
259+msgid "Version:"
260+msgstr ""
261+
262+#. TRANSLATORS: this is a message to indicate success after the installation
263+#. process has finished
264+#: ../Components/PageUpdate.qml:239
265+msgid "Installed"
266+msgstr ""
267+
268+#: ../.build/updatemanager.desktop.js:1
269+msgid "Update Manager"
270+msgstr ""
271
272=== modified file 'updatemanager.qmlproject'
273--- updatemanager.qmlproject 2013-09-20 20:04:44 +0000
274+++ updatemanager.qmlproject 2013-10-01 07:00:58 +0000
275@@ -41,6 +41,17 @@
276 directory: "debian"
277 filter: "*"
278 }
279+ /* Shows the README files in the project view */
280+ Files {
281+ filter: "README*"
282+ }
283+ /* Shows the translation files and the .pro file used to generate the .pot template */
284+ Files {
285+ filter: "*.po*"
286+ }
287+ Files {
288+ filter: "*.pro"
289+ }
290 /* List of plugin directories passed to QML runtime */
291 importPaths: [ "." ,"/usr/bin","/usr/lib/x86_64-linux-gnu/qt5/qml" ]
292 }

Subscribers

People subscribed via source and target branches