Merge lp:~dpm/ubuntu-weather-app/desktop-file-i18n into lp:ubuntu-weather-app/obsolete.trunk

Proposed by David Planella
Status: Merged
Approved by: Martin Borho
Approved revision: 34
Merged at revision: 32
Proposed branch: lp:~dpm/ubuntu-weather-app/desktop-file-i18n
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 155 lines (+48/-40)
3 files modified
po/po.pro (+35/-28)
po/ubuntu-weather-app.pot (+12/-12)
ubuntu-weather-app.desktop (+1/-0)
To merge this branch: bzr merge lp:~dpm/ubuntu-weather-app/desktop-file-i18n
Reviewer Review Type Date Requested Status
Martin Borho Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+168946@code.launchpad.net

Commit message

Updated the qmake file to extract translatable strings from the .desktop file and include them in the generated .pot file.

Description of the change

Updated the qmake file to extract translatable strings from the .desktop file and include them in the generated .pot file.

Up until now, the .desktop file contents and thus the name of the app in the dash was not translatable.

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

Internationalized desktop file

34. By David Planella

Changed the intermediate .h file to .js, which seems more appropriate for the SDK, and does not require an extra gettext keyword

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
Martin Borho (martin-borho) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/po.pro'
2--- po/po.pro 2013-05-28 12:26:03 +0000
3+++ po/po.pro 2013-06-12 13:56:30 +0000
4@@ -3,42 +3,49 @@
5 PROJECTNAME = $$system(basename ../*.qmlproject)
6 PROJECTNAME = $$replace(PROJECTNAME,.qmlproject,)
7
8-SOURCECODE = ../*.qml
9-SOURCECODE += ../components/*.qml
10-SOURCECODE += ../components/*.js
11+DESKTOPFILE = ../$${PROJECTNAME}.desktop
12+
13+SOURCECODE = ../*.qml \
14+ ../components/*.qml \
15+ ../components/*.js
16+
17+BUILDDIR = ../.build
18+DESKTOPFILETEMP = $${BUILDDIR}/$${PROJECTNAME}.desktop.js
19
20 message("")
21 message(" Project Name: $$PROJECTNAME ")
22 message(" Source Code: $$SOURCECODE ")
23 message("")
24-message(" run 'make pot' to generate the pot file from source code. ")
25-message(" run 'make mo' to generate the mo files from po files. ")
26-message(" run 'qmake; make install' to install the mo files. ")
27+message(" Run 'make pot' to generate the pot file from source code. ")
28 message("")
29
30-## generate pot file 'make pot'
31+## Generate pot file 'make pot'
32 potfile.target = pot
33-potfile.commands = xgettext -o $${PROJECTNAME}.pot --copyright=\"Canonical Ltd. \" --package-name $${PROJECTNAME} --qt --c++ --add-comments=TRANSLATORS --keyword=tr --keyword=tr:1,2 $${SOURCECODE}
34+potfile.commands = xgettext \
35+ -o $${PROJECTNAME}.pot \
36+ --copyright=\"Canonical Ltd. \" \
37+ --package-name $${PROJECTNAME} \
38+ --qt --c++ --add-comments=TRANSLATORS \
39+ --keyword=tr --keyword=tr:1,2 \
40+ $${SOURCECODE} $${DESKTOPFILETEMP}
41+potfile.depends = desktopfile
42 QMAKE_EXTRA_TARGETS += potfile
43
44-## generate mo files 'make mo'
45-mofiles.target = mo
46-mofiles.commands = msgfmt *.po
47-QMAKE_EXTRA_TARGETS += mofiles
48-
49-## Installation steps for mo files. 'make install'
50-MO_FILES = $$system(ls *.mo)
51-
52-install_mo_commands =
53-for(mo_file, MO_FILES) {
54- mo_name = $$replace(mo_file,.mo,)
55- mo_targetpath = $(INSTALL_ROOT)/usr/share/locale/$${mo_name}/LC_MESSAGES
56- mo_target = $${mo_targetpath}/$${PROJECTNAME}.mo
57- !isEmpty(install_mo_commands): install_mo_commands += &&
58- install_mo_commands += test -d $$mo_targetpath || mkdir -p $$mo_targetpath
59- install_mo_commands += && cp $$mo_file $$mo_target
60-}
61-
62-install.commands = $$install_mo_commands
63-QMAKE_EXTRA_TARGETS += install
64+## Do not use this rule directly. It's a dependency rule to
65+## generate an intermediate .h file to extract translatable
66+## strings from the .desktop file
67+desktopfile.target = desktopfile
68+desktopfile.commands = awk \'BEGIN { FS=\"=\" }; /Name/ {print \"var s = i18n.tr(\42\" \$$2 \"\42);\"}\' $${DESKTOPFILE} > $${DESKTOPFILETEMP}
69+desktopfile.depends = makebuilddir
70+QMAKE_EXTRA_TARGETS += desktopfile
71+
72+## Dependency rule to create the temporary build dir
73+makebuilddir.target = makebuilddir
74+makebuilddir.commands = mkdir -p $${BUILDDIR}
75+QMAKE_EXTRA_TARGETS += makebuilddir
76+
77+## Rule to clean the products of the build
78+clean.target = clean
79+clean.commands = rm -Rf $${BUILDDIR}
80+QMAKE_EXTRA_TARGETS += clean
81
82
83=== modified file 'po/ubuntu-weather-app.pot'
84--- po/ubuntu-weather-app.pot 2013-05-28 12:26:03 +0000
85+++ po/ubuntu-weather-app.pot 2013-06-12 13:56:30 +0000
86@@ -1,6 +1,6 @@
87-# Ubuntu Touch Weather app translations
88-# Copyright (C) 2013 Canonical Ltd.
89-# This file is distributed under the same license as the ubuntu-weather-app package.
90+# SOME DESCRIPTIVE TITLE.
91+# Copyright (C) YEAR Canonical Ltd.
92+# This file is distributed under the same license as the PACKAGE package.
93 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
94 #
95 #, fuzzy
96@@ -8,7 +8,7 @@
97 msgstr ""
98 "Project-Id-Version: ubuntu-weather-app\n"
99 "Report-Msgid-Bugs-To: \n"
100-"POT-Creation-Date: 2013-05-28 14:18+0200\n"
101+"POT-Creation-Date: 2013-06-12 15:54+0200\n"
102 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
103 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
104 "Language-Team: LANGUAGE <LL@li.org>\n"
105@@ -22,18 +22,18 @@
106 msgstr ""
107
108 #: ../components/AddLocationDialog.qml:14
109-msgid "Write a city name o pick it by your location"
110+msgid "Write a city name or pick it by your location"
111 msgstr ""
112
113-#: ../components/AddLocationDialog.qml:42
114+#: ../components/AddLocationDialog.qml:43
115 msgid "Enter a city name"
116 msgstr ""
117
118-#: ../components/AddLocationDialog.qml:62
119+#: ../components/AddLocationDialog.qml:63
120 msgid "Use my own location"
121 msgstr ""
122
123-#: ../components/AddLocationDialog.qml:74
124+#: ../components/AddLocationDialog.qml:75
125 msgid "Cancel"
126 msgstr ""
127
128@@ -46,10 +46,6 @@
129 msgid "Min."
130 msgstr ""
131
132-#: ../components/LoadingComponent.qml:29
133-msgid "Loading"
134-msgstr ""
135-
136 #: ../components/LocationTab.qml:64 ../components/LocationTabEmpty.qml:20
137 msgid "Add"
138 msgstr ""
139@@ -65,3 +61,7 @@
140 #: ../components/LocationTabEmpty.qml:8
141 msgid "No Locations"
142 msgstr ""
143+
144+#: ../.build/ubuntu-weather-app.desktop.js:1
145+msgid "Weather"
146+msgstr ""
147
148=== modified file 'ubuntu-weather-app.desktop'
149--- ubuntu-weather-app.desktop 2013-04-11 20:37:30 +0000
150+++ ubuntu-weather-app.desktop 2013-06-12 13:56:30 +0000
151@@ -8,3 +8,4 @@
152 Name=Weather
153 X-Ubuntu-Touch=true
154 X-Ubuntu-StageHint=SideStage
155+X-Ubuntu-Gettext-Domain=ubuntu-weather-app

Subscribers

People subscribed via source and target branches