Merge lp:~dpm/ubuntu-terminal-app/enable-translations into lp:ubuntu-terminal-app

Proposed by David Planella
Status: Work in progress
Proposed branch: lp:~dpm/ubuntu-terminal-app/enable-translations
Merge into: lp:ubuntu-terminal-app
Diff against target: 282 lines (+161/-36)
8 files modified
.bzrignore (+2/-0)
README.translations (+36/-0)
debian/changelog (+6/-0)
debian/control (+5/-4)
debian/rules (+9/-0)
po/po.pro (+42/-32)
po/ubuntu-terminal-app.pot (+50/-0)
ubuntu-terminal-app.qmlproject (+11/-0)
To merge this branch: bzr merge lp:~dpm/ubuntu-terminal-app/enable-translations
Reviewer Review Type Date Requested Status
Leo Arias (community) Needs Information
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing
Review via email: mp+187986@code.launchpad.net

Commit message

Enable the translations infrastructure: expose translations in Launchpad and build/ship them in the Debian package.

Description of the change

Enable the translations infrastructure: expose translations in Launchpad and build/ship them in the Debian package.

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)
Revision history for this message
Leo Arias (elopio) wrote :

David, this is no longer needed, right?

review: Needs Information

Unmerged revisions

27. By David Planella

Updated changelog, fixed a lintian warning

26. By David Planella

Added .pot file, added rule to build and ship translations

25. By David Planella

Changed the project file name for consistency and to get it to work with the translations script, updated the .pot template

24. By David Planella

Added initial translations infrastructure

23. By Nicholas Skaggs

Remove unused code, and finally fix circle menu test on device (thanks Omer!). Fixes: https://bugs.launchpad.net/bugs/1212262.

Approved by Ubuntu Phone Apps Jenkins Bot.

22. By Nicholas Skaggs

Fix valueselector (missed in previous merge)
Fix for circlemenu.

Approved by Ubuntu Phone Apps Jenkins Bot.

21. By Nicholas Skaggs

Change to polling instead of using assert, fix lambda silliness, and enable all tests.

Approved by Ubuntu Phone Apps Jenkins Bot.

20. By Nicholas Skaggs

This converts the terminal ap tests to the ubuntusdk emulator as well as cleans up and fixes all the tests; including the color scheme check. Fixes: https://bugs.launchpad.net/bugs/1188841.

Approved by Ubuntu Phone Apps Jenkins Bot.

19. By Nicholas Skaggs

This converts the terminal ap tests to the ubuntusdk emulator as well as cleans up and fixes all the tests; including the color scheme check. Fixes: https://bugs.launchpad.net/bugs/1188841.

Approved by Ubuntu Phone Apps Jenkins Bot.

18. By Michael Hall

Updated attribution in debian/copyright.

Approved by Dmitry Zagnoyko, Ubuntu Phone Apps Jenkins Bot.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2013-04-23 20:42:10 +0000
3+++ .bzrignore 2013-09-27 06:58:57 +0000
4@@ -4,3 +4,5 @@
5 debian/ubuntu-terminal-app/
6 debian/*.debhelper.log
7 debian/*.substvars
8+.build
9+po/Makefile
10
11=== added file 'README.translations'
12--- README.translations 1970-01-01 00:00:00 +0000
13+++ README.translations 2013-09-27 06:58:57 +0000
14@@ -0,0 +1,36 @@
15+# Updating translations
16+
17+Translations for the Terminal app happen in [Launchpad Translations][] and
18+are automatically committed daily on the trunk branch in the po/ folder.
19+
20+They are then built and installed as part of the package build, so that
21+developers don't really need to worry about them.
22+
23+However, there is one task that needs to be taken care of: exposing new
24+translatable messages to translators. So whenever you add new translatable
25+messages in the code, make sure to follow these steps:
26+
27+ 1. Change directory to the po/ folder: `cd po`
28+ 2. Update the translations template: `qmake && make pot`
29+ 3. Commit the generated .pot file: `bzr commit -m"Updated translation template"`
30+ 4. Push the branch and send a merge proposal as usual
31+
32+And that's it, once the branch lands Launchpad should take care of all the rest!
33+
34+# Behind the scenes
35+
36+Behind the scenes, whenever the po/*.pot file (also known as translations template)
37+is committed to trunk Launchpad reads it and updates the translatable strings
38+exposed in the web UI. This will enable translators to work on the new strings.
39+The translations template contains all translatable strings that have been
40+extracted from the source code files.
41+
42+Launchpad will then store translations in its database and will commit them daily
43+in the form of textual po/*.po files to trunk. The PO files are also usually
44+referred to as the translations files. You'll find a translation file for each
45+language the app has got at least a translated message available for.
46+
47+Translations for core apps follow the standard [gettext format].
48+
49+ [Launchpad Translations]: https://translations.launchpad.net/ubuntu-terminal-app
50+ [gettext format]: https://www.gnu.org/software/gettext/
51
52=== modified file 'debian/changelog'
53--- debian/changelog 2013-05-24 16:18:10 +0000
54+++ debian/changelog 2013-09-27 06:58:57 +0000
55@@ -1,3 +1,9 @@
56+ubuntu-terminal-app (0.6) saucy; urgency=low
57+
58+ * Added translations infrastructure
59+
60+ -- David Planella <david.planella@ubuntu.com> Fri, 27 Sep 2013 08:49:50 +0200
61+
62 ubuntu-terminal-app (0.5) raring; urgency=low
63
64 * Added landscape mode
65
66=== modified file 'debian/control'
67--- debian/control 2013-08-09 21:33:43 +0000
68+++ debian/control 2013-09-27 06:58:57 +0000
69@@ -10,12 +10,12 @@
70 Package: ubuntu-terminal-app
71 Section: misc
72 Architecture: all
73-Depends: ${misc:Depends},
74- qmlscene,
75+Depends: qmlscene,
76 qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu,
77 qtdeclarative5-localstorage-plugin,
78 qtdeclarative5-qtquick2-plugin,
79- qtdeclarative5-konsole-qml-plugin (>= 0.1.1)
80+ qtdeclarative5-konsole-qml-plugin (>= 0.1.1),
81+ ${misc:Depends}
82 Description: Terminal application
83 Core Terminal application
84
85@@ -24,6 +24,7 @@
86 Depends: libautopilot-qt,
87 libqt5test5,
88 ubuntu-ui-toolkit-autopilot,
89- ubuntu-terminal-app (= ${source:Version})
90+ ubuntu-terminal-app (= ${source:Version}),
91+ ${misc:Depends}
92 Description: Autopilot tests for Terminal Application
93 This package contains the autopilot tests for the Terminal
94
95=== modified file 'debian/rules'
96--- debian/rules 2013-04-11 21:26:07 +0000
97+++ debian/rules 2013-09-27 06:58:57 +0000
98@@ -9,3 +9,12 @@
99
100 override_dh_install:
101 dh_install --fail-missing
102+ appname=ubuntu-terminal-app; \
103+ for pofile in $(shell find ./po -name "*.po"); do \
104+ pofilename="$${pofile##*/}"; \
105+ langcode="$${pofilename%.*}"; \
106+ localedir="debian/$$appname/usr/share/locale/$$langcode/LC_MESSAGES"; \
107+ mkdir -p $$localedir; \
108+ mofile="$$localedir/$$appname.mo"; \
109+ msgfmt -o $$mofile $$pofile; \
110+ done
111
112=== modified file 'po/po.pro'
113--- po/po.pro 2013-02-12 16:18:48 +0000
114+++ po/po.pro 2013-09-27 06:58:57 +0000
115@@ -1,48 +1,58 @@
116+## This .pro file is used to create a Makefile with the necessary rules
117+## to create an initial translations template and to update it whenever
118+## there are new translatable strings in the project that are ready to be
119+## exposed to translators
120+##
121+## See the ../README.translations file for more information
122+
123 TEMPLATE = subdirs
124
125 PROJECTNAME = $$system(basename ../*.qmlproject)
126 PROJECTNAME = $$replace(PROJECTNAME,.qmlproject,)
127
128-SOURCECODE = ../*.qml
129+DESKTOPFILE = ../$${PROJECTNAME}.desktop
130+
131+SOURCECODE = ../*.qml \
132+ ../config/*.qml \
133+ ../extraPanel/*.qml
134+
135+BUILDDIR = ../.build
136+DESKTOPFILETEMP = $${BUILDDIR}/$${PROJECTNAME}.desktop.js
137
138 message("")
139 message(" Project Name: $$PROJECTNAME ")
140 message(" Source Code: $$SOURCECODE ")
141 message("")
142-message(" run 'make pot' to generate the pot file from source code. ")
143-message(" run 'make translate' to create a new translation (po) based on pot. ")
144-message(" run 'make mo' to generate the mo files from po files. ")
145-message(" run 'qmake; make install' to install the mo files. ")
146+message(" Run 'make pot' to generate the pot file from source code. ")
147 message("")
148
149-## generate pot file 'make pot'
150+## Generate pot file 'make pot'
151 potfile.target = pot
152-potfile.commands = xgettext -o $${PROJECTNAME}.pot --package-name $${PROJECTNAME} --qt --c++ --add-comments=TRANSLATORS --keyword=tr $${SOURCECODE}
153+potfile.commands = xgettext \
154+ -o $${PROJECTNAME}.pot \
155+ --copyright=\"Canonical Ltd. \" \
156+ --package-name $${PROJECTNAME} \
157+ --qt --c++ --add-comments=TRANSLATORS \
158+ --keyword=tr --keyword=tr:1,2 \
159+ $${SOURCECODE} $${DESKTOPFILETEMP}
160+potfile.depends = desktopfile
161 QMAKE_EXTRA_TARGETS += potfile
162
163-## poedit target for new translations 'make translate'
164-poedit.target = translate
165-poedit.commands = cp messages.pot new_language.po; poedit new_language.po
166-QMAKE_EXTRA_TARGETS += poedit
167-
168-## generate mo files 'make mo'
169-mofiles.target = mo
170-mofiles.commands = msgfmt *.po
171-QMAKE_EXTRA_TARGETS += mofiles
172-
173-## Installation steps for mo files. 'make install'
174-MO_FILES = $$system(ls *.mo)
175-
176-install_mo_commands =
177-for(mo_file, MO_FILES) {
178- mo_name = $$replace(mo_file,.mo,)
179- mo_targetpath = $(INSTALL_ROOT)/usr/share/locale/$${mo_name}/LC_MESSAGES
180- mo_target = $${mo_targetpath}/$${PROJECTNAME}.mo
181- !isEmpty(install_mo_commands): install_mo_commands += &&
182- install_mo_commands += test -d $$mo_targetpath || mkdir -p $$mo_targetpath
183- install_mo_commands += && cp $$mo_file $$mo_target
184-}
185-
186-install.commands = $$install_mo_commands
187-QMAKE_EXTRA_TARGETS += install
188+## Do not use this rule directly. It's a dependency rule to
189+## generate an intermediate .js file to extract translatable
190+## strings from the .desktop file
191+desktopfile.target = desktopfile
192+desktopfile.commands = awk \'BEGIN { FS=\"=\" }; /Name/ {print \"var s = i18n.tr(\42\" \$$2 \"\42);\"}\' $${DESKTOPFILE} > $${DESKTOPFILETEMP}
193+desktopfile.depends = makebuilddir
194+QMAKE_EXTRA_TARGETS += desktopfile
195+
196+## Dependency rule to create the temporary build dir
197+makebuilddir.target = makebuilddir
198+makebuilddir.commands = mkdir -p $${BUILDDIR}
199+QMAKE_EXTRA_TARGETS += makebuilddir
200+
201+## Rule to clean the products of the build
202+clean.target = clean
203+clean.commands = rm -Rf $${BUILDDIR}
204+QMAKE_EXTRA_TARGETS += clean
205
206
207=== added file 'po/ubuntu-terminal-app.pot'
208--- po/ubuntu-terminal-app.pot 1970-01-01 00:00:00 +0000
209+++ po/ubuntu-terminal-app.pot 2013-09-27 06:58:57 +0000
210@@ -0,0 +1,50 @@
211+# SOME DESCRIPTIVE TITLE.
212+# Copyright (C) YEAR Canonical Ltd.
213+# This file is distributed under the same license as the PACKAGE package.
214+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
215+#
216+#, fuzzy
217+msgid ""
218+msgstr ""
219+"Project-Id-Version: ubuntu-terminal-app\n"
220+"Report-Msgid-Bugs-To: \n"
221+"POT-Creation-Date: 2013-09-27 08:41+0200\n"
222+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
223+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
224+"Language-Team: LANGUAGE <LL@li.org>\n"
225+"Language: \n"
226+"MIME-Version: 1.0\n"
227+"Content-Type: text/plain; charset=CHARSET\n"
228+"Content-Transfer-Encoding: 8bit\n"
229+
230+#: ../Configs.qml:46
231+msgid "Color scheme"
232+msgstr ""
233+
234+#: ../Configs.qml:60
235+msgid "Font size"
236+msgstr ""
237+
238+#: ../ubuntu-terminal-app.qml:24
239+msgid "Control keys"
240+msgstr ""
241+
242+#: ../ubuntu-terminal-app.qml:29
243+msgid "Function keys"
244+msgstr ""
245+
246+#: ../ubuntu-terminal-app.qml:34
247+msgid "Text ctrl keys"
248+msgstr ""
249+
250+#: ../ubuntu-terminal-app.qml:39
251+msgid "Hide extra panel"
252+msgstr ""
253+
254+#: ../ubuntu-terminal-app.qml:53 ../.build/ubuntu-terminal-app.desktop.js:1
255+msgid "Terminal"
256+msgstr ""
257+
258+#: ../ubuntu-terminal-app.qml:87
259+msgid "Settings"
260+msgstr ""
261
262=== renamed file 'terminal.qmlproject' => 'ubuntu-terminal-app.qmlproject'
263--- terminal.qmlproject 2013-04-30 20:53:03 +0000
264+++ ubuntu-terminal-app.qmlproject 2013-09-27 06:58:57 +0000
265@@ -15,6 +15,17 @@
266 ImageFiles {
267 directory: "."
268 }
269+ /* Shows the README files in the project view */
270+ Files {
271+ filter: "README*"
272+ }
273+ /* Shows the translation files and the .pro file used to generate the .pot template */
274+ Files {
275+ filter: "*.po*"
276+ }
277+ Files {
278+ filter: "*.pro"
279+ }
280 /* List of plugin directories passed to QML runtime */
281 importPaths: [ "." ,"/usr/lib/x86_64-linux-gnu/qt5/qml" ]
282 }

Subscribers

People subscribed via source and target branches