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
=== added file '.bzrignore'
--- .bzrignore 1970-01-01 00:00:00 +0000
+++ .bzrignore 2013-10-01 07:00:58 +0000
@@ -0,0 +1,2 @@
1.build
2po/Makefile
03
=== modified file 'Components/PageUpdate.qml'
--- Components/PageUpdate.qml 2013-09-27 18:30:17 +0000
+++ Components/PageUpdate.qml 2013-10-01 07:00:58 +0000
@@ -63,6 +63,7 @@
63 Button {63 Button {
64 id: retryButton64 id: retryButton
65 objectName: "retryButton"65 objectName: "retryButton"
66 // TRANSLATORS: this is shown in a button to re-check for updates. Please keep it short.
66 text: i18n.tr("Check again")67 text: i18n.tr("Check again")
67 anchors {68 anchors {
68 left: parent.left69 left: parent.left
@@ -84,7 +85,7 @@
84 Button {85 Button {
85 id: installAllButton86 id: installAllButton
86 objectName: "installAllButton"87 objectName: "installAllButton"
87 text: i18n.tr("Install %1 Updates").arg(root.updates)88 text: i18n.tr("Install %1 Update", "Install %1 Updates", root.updates).arg(root.updates)
88 anchors {89 anchors {
89 left: parent.left90 left: parent.left
90 right: parent.right91 right: parent.right
@@ -137,6 +138,7 @@
137 onMessageChanged: {138 onMessageChanged: {
138 if(message.length > 0) {139 if(message.length > 0) {
139 labelVersion.text = message;140 labelVersion.text = message;
141 // TRANSLATORS: this is shown in a button to retry updates. Please keep it short.
140 buttonAppUpdate.text = i18n.tr("Retry");142 buttonAppUpdate.text = i18n.tr("Retry");
141 modelData.updateState = false;143 modelData.updateState = false;
142 }144 }
@@ -151,6 +153,7 @@
151153
152 Button {154 Button {
153 id: buttonAppUpdate155 id: buttonAppUpdate
156 // TRANSLATORS: this is shown in a button to apply updates. Please keep it short.
154 text: i18n.tr("Update")157 text: i18n.tr("Update")
155 height: textArea.height / 2158 height: textArea.height / 2
156159
@@ -194,7 +197,8 @@
194 left: parent.left197 left: parent.left
195 right: parent.right198 right: parent.right
196 }199 }
197 text: modelData.remoteVersion ? i18n.tr("Version: ") + modelData.remoteVersion : ""200 // TRANSLATORS: this is a label that shows the version of the app
201 text: modelData.remoteVersion ? i18n.tr("Version:") + " " + modelData.remoteVersion : ""
198 color: "white"202 color: "white"
199 visible: !modelData.updateState203 visible: !modelData.updateState
200 elide: Text.ElideRight204 elide: Text.ElideRight
@@ -230,6 +234,8 @@
230 onFinished: {234 onFinished: {
231 progress.visible = false;235 progress.visible = false;
232 buttonAppUpdate.visible = false;236 buttonAppUpdate.visible = false;
237 // TRANSLATORS: this is a message to indicate success after the installation
238 // process has finished
233 textArea.message = i18n.tr("Installed");239 textArea.message = i18n.tr("Installed");
234 root.updates -= 1;240 root.updates -= 1;
235 }241 }
236242
=== added file 'README.translations'
--- README.translations 1970-01-01 00:00:00 +0000
+++ README.translations 2013-10-01 07:00:58 +0000
@@ -0,0 +1,36 @@
1# Updating translations
2
3Translations for the Click Update Managerhappen in [Launchpad Translations][]
4and are automatically committed daily on the trunk branch in the po/ folder.
5
6They are then built and installed as part of the package build, so that
7developers don't really need to worry about them.
8
9However, there is one task that needs to be taken care of: exposing new
10translatable messages to translators. So whenever you add new translatable
11messages in the code, make sure to follow these steps:
12
13 1. Change directory to the po/ folder: `cd po`
14 2. Update the translations template: `qmake && make pot`
15 3. Commit the generated .pot file: `bzr commit -m"Updated translation template"`
16 4. Push the branch and send a merge proposal as usual
17
18And that's it, once the branch lands Launchpad should take care of all the rest!
19
20# Behind the scenes
21
22Behind the scenes, whenever the po/*.pot file (also known as translations template)
23is committed to trunk Launchpad reads it and updates the translatable strings
24exposed in the web UI. This will enable translators to work on the new strings.
25The translations template contains all translatable strings that have been
26extracted from the source code files.
27
28Launchpad will then store translations in its database and will commit them daily
29in the form of textual po/*.po files to trunk. The PO files are also usually
30referred to as the translations files. You'll find a translation file for each
31language the app has got at least a translated message available for.
32
33Translations for core apps follow the standard [gettext format].
34
35 [Launchpad Translations]: https://translations.launchpad.net/click-update-manager
36 [gettext format]: https://www.gnu.org/software/gettext/
037
=== modified file 'click-update-manager.desktop'
--- click-update-manager.desktop 2013-09-26 19:14:00 +0000
+++ click-update-manager.desktop 2013-10-01 07:00:58 +0000
@@ -6,3 +6,4 @@
6Terminal=false6Terminal=false
7Type=Application7Type=Application
8X-Ubuntu-Touch=true8X-Ubuntu-Touch=true
9X-Ubuntu-Gettext-Domain=updatemanager
910
=== modified file 'debian/rules'
--- debian/rules 2013-09-26 21:07:17 +0000
+++ debian/rules 2013-10-01 07:00:58 +0000
@@ -11,3 +11,16 @@
1111
12override_dh_auto_test:12override_dh_auto_test:
13 dh_auto_build -- check13 dh_auto_build -- check
14
15override_dh_install:
16 tests/autopilot/install_autopilot.sh $(CURDIR)
17 dh_install --fail-missing
18 appname=updatemanager; \
19 for pofile in $(shell find ./po -name "*.po"); do \
20 pofilename="$${pofile##*/}"; \
21 langcode="$${pofilename%.*}"; \
22 localedir="debian/$$appname/usr/share/locale/$$langcode/LC_MESSAGES"; \
23 mkdir -p $$localedir; \
24 mofile="$$localedir/$$appname.mo"; \
25 msgfmt -o $$mofile $$pofile; \
26 done
1427
=== added directory 'po'
=== added file 'po/po.pro'
--- po/po.pro 1970-01-01 00:00:00 +0000
+++ po/po.pro 2013-10-01 07:00:58 +0000
@@ -0,0 +1,58 @@
1## This .pro file is used to create a Makefile with the necessary rules
2## to create an initial translations template and to update it whenever
3## there are new translatable strings in the project that are ready to be
4## exposed to translators
5##
6## See the ../README.translations file for more information
7
8TEMPLATE = subdirs
9
10PROJECTNAME = $$system(basename ../*.qmlproject)
11PROJECTNAME = $$replace(PROJECTNAME,.qmlproject,)
12
13## DESKTOPFILE = ../$${PROJECTNAME}.desktop
14DESKTOPFILE = ../click-update-manager.desktop
15
16SOURCECODE = ../*.qml \
17 ../Components/*.qml
18
19BUILDDIR = ../.build
20DESKTOPFILETEMP = $${BUILDDIR}/$${PROJECTNAME}.desktop.js
21
22message("")
23message(" Project Name: $$PROJECTNAME ")
24message(" Source Code: $$SOURCECODE ")
25message("")
26message(" Run 'make pot' to generate the pot file from source code. ")
27message("")
28
29## Generate pot file 'make pot'
30potfile.target = pot
31potfile.commands = xgettext \
32 -o $${PROJECTNAME}.pot \
33 --copyright=\"Canonical Ltd. \" \
34 --package-name $${PROJECTNAME} \
35 --qt --c++ --add-comments=TRANSLATORS \
36 --keyword=tr --keyword=tr:1,2 \
37 $${SOURCECODE} $${DESKTOPFILETEMP}
38potfile.depends = desktopfile
39QMAKE_EXTRA_TARGETS += potfile
40
41## Do not use this rule directly. It's a dependency rule to
42## generate an intermediate .js file to extract translatable
43## strings from the .desktop file
44desktopfile.target = desktopfile
45desktopfile.commands = awk \'BEGIN { FS=\"=\" }; /Name/ {print \"var s = i18n.tr(\42\" \$$2 \"\42);\"}\' $${DESKTOPFILE} > $${DESKTOPFILETEMP}
46desktopfile.depends = makebuilddir
47QMAKE_EXTRA_TARGETS += desktopfile
48
49## Dependency rule to create the temporary build dir
50makebuilddir.target = makebuilddir
51makebuilddir.commands = mkdir -p $${BUILDDIR}
52QMAKE_EXTRA_TARGETS += makebuilddir
53
54## Rule to clean the products of the build
55clean.target = clean
56clean.commands = rm -Rf $${BUILDDIR}
57QMAKE_EXTRA_TARGETS += clean
58
059
=== added file 'po/updatemanager.pot'
--- po/updatemanager.pot 1970-01-01 00:00:00 +0000
+++ po/updatemanager.pot 2013-10-01 07:00:58 +0000
@@ -0,0 +1,68 @@
1# click-update-manager translations
2# Copyright (C) 2013 Canonical Ltd.
3# This file is distributed under the same license as the click-update-manager package.
4# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5#
6#, fuzzy
7msgid ""
8msgstr ""
9"Project-Id-Version: updatemanager\n"
10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2013-10-01 08:42+0200\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"
15"Language: \n"
16"MIME-Version: 1.0\n"
17"Content-Type: text/plain; charset=CHARSET\n"
18"Content-Transfer-Encoding: 8bit\n"
19"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
20
21#: ../Components/PageUpdate.qml:24
22msgid "Updates"
23msgstr ""
24
25#: ../Components/PageUpdate.qml:51
26msgid "No Updates Found"
27msgstr ""
28
29#: ../Components/PageUpdate.qml:58
30msgid "Please log into your Ubuntu One account in System Settings."
31msgstr ""
32
33#. TRANSLATORS: this is shown in a button to re-check for updates. Please keep it short.
34#: ../Components/PageUpdate.qml:67
35msgid "Check again"
36msgstr ""
37
38#: ../Components/PageUpdate.qml:88
39#, qt-format
40msgid "Install %1 Update"
41msgid_plural "Install %1 Updates"
42msgstr[0] ""
43msgstr[1] ""
44
45#. TRANSLATORS: this is shown in a button to retry updates. Please keep it short.
46#: ../Components/PageUpdate.qml:142
47msgid "Retry"
48msgstr ""
49
50#. TRANSLATORS: this is shown in a button to apply updates. Please keep it short.
51#: ../Components/PageUpdate.qml:157
52msgid "Update"
53msgstr ""
54
55#. TRANSLATORS: this is a label that shows the version of the app
56#: ../Components/PageUpdate.qml:201
57msgid "Version:"
58msgstr ""
59
60#. TRANSLATORS: this is a message to indicate success after the installation
61#. process has finished
62#: ../Components/PageUpdate.qml:239
63msgid "Installed"
64msgstr ""
65
66#: ../.build/updatemanager.desktop.js:1
67msgid "Update Manager"
68msgstr ""
069
=== modified file 'updatemanager.qmlproject'
--- updatemanager.qmlproject 2013-09-20 20:04:44 +0000
+++ updatemanager.qmlproject 2013-10-01 07:00:58 +0000
@@ -41,6 +41,17 @@
41 directory: "debian"41 directory: "debian"
42 filter: "*"42 filter: "*"
43 }43 }
44 /* Shows the README files in the project view */
45 Files {
46 filter: "README*"
47 }
48 /* Shows the translation files and the .pro file used to generate the .pot template */
49 Files {
50 filter: "*.po*"
51 }
52 Files {
53 filter: "*.pro"
54 }
44 /* List of plugin directories passed to QML runtime */55 /* List of plugin directories passed to QML runtime */
45 importPaths: [ "." ,"/usr/bin","/usr/lib/x86_64-linux-gnu/qt5/qml" ]56 importPaths: [ "." ,"/usr/bin","/usr/lib/x86_64-linux-gnu/qt5/qml" ]
46}57}

Subscribers

People subscribed via source and target branches