Merge lp:~dobey/ubuntu-printing-app/fix-i18n into lp:ubuntu-printing-app

Proposed by dobey
Status: Merged
Approved by: Andrew Hayzen
Approved revision: 50
Merged at revision: 33
Proposed branch: lp:~dobey/ubuntu-printing-app/fix-i18n
Merge into: lp:ubuntu-printing-app
Prerequisite: lp:~dobey/ubuntu-printing-app/add-notifier-daemon
Diff against target: 370 lines (+144/-117)
4 files modified
CMakeLists.txt (+1/-11)
po/CMakeLists.txt (+13/-44)
po/ubuntu-printing-app.pot (+125/-58)
ubuntu-printing-app/CMakeLists.txt (+5/-4)
To merge this branch: bzr merge lp:~dobey/ubuntu-printing-app/fix-i18n
Reviewer Review Type Date Requested Status
Andrew Hayzen (community) Approve
Review via email: mp+320263@code.launchpad.net

Commit message

Use intltool module from cmake-extras and update template.

To post a comment you must log in.
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

Should this run when doing a build? I haven't yet been able to get the .pot to be regenerated when doing a build? I was expecting it todo this.

review: Needs Information
Revision history for this message
dobey (dobey) wrote :

No. Regenerating the .pot file with every build will create lots of needless changes to the file when strings aren't changed, and will create situations with conflicts when multiple people are working on different branches. The file should only be updated when strings are added or removed, generally. "make ubuntu-printing-app.pog" will cause it get rebuilt.

Revision history for this message
Andrew Hayzen (ahayzen) wrote :

OK thanks, this works nicely in that case :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2017-03-17 21:17:09 +0000
3+++ CMakeLists.txt 2017-03-17 21:17:09 +0000
4@@ -5,15 +5,7 @@
5 enable_testing()
6
7 # Load translation tools
8-find_program(INTLTOOL_MERGE intltool-merge)
9-if(NOT INTLTOOL_MERGE)
10- message(FATAL_ERROR "Could not find intltool-merge, please install the intltool package")
11-endif()
12-
13-find_program(INTLTOOL_EXTRACT intltool-extract)
14-if(NOT INTLTOOL_EXTRACT)
15- message(FATAL_ERROR "Could not find intltool-extract, please install the intltool package")
16-endif()
17+find_package(Intltool REQUIRED)
18
19 # Set the vars
20 set(APP_NAME ubuntu-printing-app)
21@@ -60,8 +52,6 @@
22
23 # Setup gettext defs and include po directory
24 set(GETTEXT_PACKAGE "ubuntu-printing-app")
25-add_definitions(-DI18N_DOMAIN="${GETTEXT_PACKAGE}")
26-
27 add_subdirectory(po)
28
29 # Add tests
30
31=== modified file 'po/CMakeLists.txt'
32--- po/CMakeLists.txt 2017-01-24 10:58:19 +0000
33+++ po/CMakeLists.txt 2017-03-17 21:17:09 +0000
34@@ -1,44 +1,13 @@
35-project(ubuntu-printing-app-translations)
36-
37-include(FindGettext)
38-find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext)
39-
40-file(RELATIVE_PATH DESKTOP_FILE_IN_IN ${CMAKE_SOURCE_DIR}
41- ${CMAKE_SOURCE_DIR}/ubuntu-printing-app/${DESKTOP_FILE}.in.in)
42-file(RELATIVE_PATH DESKTOP_FILE_IN_IN_H ${CMAKE_SOURCE_DIR}
43- ${CMAKE_CURRENT_SOURCE_DIR}/${DESKTOP_FILE_IN_IN}.h)
44-
45-file(GLOB_RECURSE I18N_SRC_FILES
46- RELATIVE ${CMAKE_SOURCE_DIR}
47- ${CMAKE_SOURCE_DIR}/ubuntu-printing-app/**.qml)
48-list(SORT I18N_SRC_FILES)
49-
50-set(DOMAIN ${GETTEXT_PACKAGE})
51-set(POT_FILE ${DOMAIN}.pot)
52-file(GLOB PO_FILES *.po)
53-
54-add_custom_target(${POT_FILE} ALL
55- COMMENT "Generating translation template"
56- COMMAND touch ${POT_FILE}
57- COMMAND ${INTLTOOL_EXTRACT} --update --type=gettext/ini
58- --srcdir=${CMAKE_SOURCE_DIR} ${DESKTOP_FILE_IN_IN}
59- COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} -o ${POT_FILE}
60- -D ${CMAKE_SOURCE_DIR}
61- --from-code=UTF-8
62- --c++ --qt --add-comments=TRANSLATORS
63- --keyword=tr --keyword=tr:1,2 --keyword=N_
64- -j
65- --package-name=ubuntu-printing-app
66- --copyright-holder='Canonical Ltd.'
67- -D ${CMAKE_SOURCE_DIR} ${I18N_SRC_FILES}
68- -D ${CMAKE_BINARY_DIR} ${DESKTOP_FILE_IN_IN_H}
69- COMMAND ${CMAKE_COMMAND} -E copy ${POT_FILE} ${CMAKE_CURRENT_SOURCE_DIR})
70-
71-foreach(PO_FILE ${PO_FILES})
72- get_filename_component(LANG ${PO_FILE} NAME_WE)
73- gettext_process_po_files(${LANG} ALL PO_FILES ${PO_FILE})
74- set(INSTALL_DIR ${CMAKE_INSTALL_LOCALEDIR}/${LANG}/LC_MESSAGES)
75- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG}.gmo
76- DESTINATION ${INSTALL_DIR}
77- RENAME ${DOMAIN}.mo)
78-endforeach(PO_FILE)
79+
80+intltool_update_potfile(
81+ KEYWORDS "_" "_:1,2" "N_" "N_:1,2" "tr" "tr:1,2"
82+ GETTEXT_PACKAGE ${GETTEXT_PACKAGE}
83+ COPYRIGHT_HOLDER "Canonical Ltd."
84+ FILE_GLOBS "${CMAKE_SOURCE_DIR}/*.desktop.in.in" "${CMAKE_SOURCE_DIR}/*.qml"
85+ FILTER "tests/*"
86+)
87+
88+intltool_install_translations(
89+ ALL
90+ GETTEXT_PACKAGE ${GETTEXT_PACKAGE}
91+)
92
93=== modified file 'po/ubuntu-printing-app.pot'
94--- po/ubuntu-printing-app.pot 2017-02-28 15:34:29 +0000
95+++ po/ubuntu-printing-app.pot 2017-03-17 21:17:09 +0000
96@@ -1,129 +1,196 @@
97 # SOME DESCRIPTIVE TITLE.
98 # Copyright (C) YEAR Canonical Ltd.
99-# This file is distributed under the same license as the ubuntu-printing-app package.
100+# This file is distributed under the same license as the PACKAGE package.
101 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
102 #
103 #, fuzzy
104 msgid ""
105 msgstr ""
106-"Project-Id-Version: ubuntu-printing-app\n"
107+"Project-Id-Version: PACKAGE VERSION\n"
108 "Report-Msgid-Bugs-To: \n"
109-"POT-Creation-Date: 2017-02-28 15:29+0000\n"
110+"POT-Creation-Date: 2017-03-17 17:00-0400\n"
111 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
112 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
113 "Language-Team: LANGUAGE <LL@li.org>\n"
114 "Language: \n"
115 "MIME-Version: 1.0\n"
116-"Content-Type: text/plain; charset=CHARSET\n"
117+"Content-Type: text/plain; charset=UTF-8\n"
118 "Content-Transfer-Encoding: 8bit\n"
119-
120-#: ubuntu-printing-app/Main.qml:66
121+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
122+
123+#: ../notifier/src/notify-engine.cpp:48
124+#, c-format
125+msgid "A cover is open on the printer “%s”."
126+msgstr ""
127+
128+#: ../notifier/src/notify-engine.cpp:49
129+#, c-format
130+msgid "The printer “%s” can’t be used, because required software is missing."
131+msgstr ""
132+
133+#: ../notifier/src/notify-engine.cpp:50
134+#, c-format
135+msgid "A door is open on the printer “%s”."
136+msgstr ""
137+
138+#: ../notifier/src/notify-engine.cpp:51
139+#, c-format
140+msgid "The printer “%s” is out of paper."
141+msgstr ""
142+
143+#: ../notifier/src/notify-engine.cpp:52
144+#, c-format
145+msgid "The printer “%s” is low on paper."
146+msgstr ""
147+
148+#: ../notifier/src/notify-engine.cpp:53
149+#, c-format
150+msgid "The printer “%s” is currently off-line."
151+msgstr ""
152+
153+#: ../notifier/src/notify-engine.cpp:54
154+#, c-format
155+msgid "The printer “%s” has an unknown problem."
156+msgstr ""
157+
158+#: ../notifier/src/notify-engine.cpp:55
159+#, c-format
160+msgid "The printer “%s” is out of toner."
161+msgstr ""
162+
163+#: ../notifier/src/notify-engine.cpp:56
164+#, c-format
165+msgid "The printer “%s” is low on toner."
166+msgstr ""
167+
168+#: ../notifier/src/notify-engine.cpp:167
169+#, c-format
170+msgid "“%s” has printed."
171+msgstr ""
172+
173+#: ../notifier/src/notify-engine.cpp:185
174+#, c-format
175+msgid "You have %d job queued to print on this printer."
176+msgid_plural "You have %d jobs queued to print on this printer."
177+msgstr[0] ""
178+msgstr[1] ""
179+
180+#: ../notifier/src/notify-engine.cpp:193
181+#: ../ubuntu-printing-app/components/AlertDialog.qml:28
182+msgid "OK"
183+msgstr ""
184+
185+#: ../notifier/src/notify-engine.cpp:195
186+msgid "Settings…"
187+msgstr ""
188+
189+#. notifier
190+#. printing
191+#. ubuntu
192+#: ../ubuntu-printing-app/ubuntu-printing-app.desktop.in.in.h:1
193+#: ../ubuntu-printing-app/components/PrintRow.qml:74
194+msgid "Print"
195+msgstr ""
196+
197+#: ../ubuntu-printing-app/ubuntu-printing-app.desktop.in.in.h:2
198+msgid "Print;Printing;"
199+msgstr ""
200+
201+#: ../ubuntu-printing-app/Main.qml:66
202 msgid "Document is invalid"
203 msgstr ""
204
205-#: ubuntu-printing-app/Main.qml:69
206+#: ../ubuntu-printing-app/Main.qml:69
207 msgid "Document not found"
208 msgstr ""
209
210-#: ubuntu-printing-app/Main.qml:72
211+#: ../ubuntu-printing-app/Main.qml:72
212 msgid "Not a PDF document"
213 msgstr ""
214
215-#: ubuntu-printing-app/Main.qml:75
216+#: ../ubuntu-printing-app/Main.qml:75
217 msgid "An unknown error occurred"
218 msgstr ""
219
220-#: ubuntu-printing-app/Main.qml:99
221+#: ../ubuntu-printing-app/Main.qml:99
222 msgid "Error"
223 msgstr ""
224
225-#: ubuntu-printing-app/Main.qml:126
226+#: ../ubuntu-printing-app/Main.qml:126
227 msgid "URL of PDF to print"
228 msgstr ""
229
230-#: ubuntu-printing-app/components/AlertDialog.qml:28
231-msgid "OK"
232-msgstr ""
233-
234-#: ubuntu-printing-app/components/PrintRow.qml:57
235-msgid "Cancel"
236-msgstr ""
237-
238-#: ubuntu-printing-app/components/PrintRow.qml:71
239-msgid "Create PDF"
240-msgstr ""
241-
242-#: ubuntu-printing-app/components/PrintRow.qml:71
243-#: po/ubuntu-printing-app/ubuntu-printing-app.desktop.in.in.h:1
244-msgid "Print"
245-msgstr ""
246-
247-#: ubuntu-printing-app/components/PrintRow.qml:71
248-msgid "Sheets"
249-msgstr ""
250-
251-#: ubuntu-printing-app/pages/ContentPeerPickerPage.qml:43
252-msgid "Open With..."
253-msgstr ""
254-
255-#: ubuntu-printing-app/pages/EmptyPage.qml:48
256+#: ../ubuntu-printing-app/pages/EmptyPage.qml:48
257 msgid ""
258 "No document was chosen for printing. In order to print, you need to select "
259 "print from an app. Alternatively you can export a PDF document from an app."
260 msgstr ""
261
262-#: ubuntu-printing-app/pages/PrintPage.qml:47
263+#: ../ubuntu-printing-app/pages/PrintPage.qml:47
264 msgid "Page Setup"
265 msgstr ""
266
267-#: ubuntu-printing-app/pages/PrintPage.qml:47
268+#: ../ubuntu-printing-app/pages/PrintPage.qml:47
269 msgid "Printer Options"
270 msgstr ""
271
272-#: ubuntu-printing-app/pages/PrintPage.qml:85
273+#: ../ubuntu-printing-app/pages/PrintPage.qml:86
274 msgid "Printer"
275 msgstr ""
276
277-#: ubuntu-printing-app/pages/PrintPage.qml:106
278+#: ../ubuntu-printing-app/pages/PrintPage.qml:107
279 msgid "Copies"
280 msgstr ""
281
282-#: ubuntu-printing-app/pages/PrintPage.qml:129
283-msgid "Collate"
284-msgstr ""
285-
286-#: ubuntu-printing-app/pages/PrintPage.qml:149
287-msgid "Reverse"
288-msgstr ""
289-
290-#: ubuntu-printing-app/pages/PrintPage.qml:170
291+#: ../ubuntu-printing-app/pages/PrintPage.qml:131
292 msgid "All"
293 msgstr ""
294
295-#: ubuntu-printing-app/pages/PrintPage.qml:170
296+#: ../ubuntu-printing-app/pages/PrintPage.qml:131
297 msgid "Range"
298 msgstr ""
299
300-#: ubuntu-printing-app/pages/PrintPage.qml:174
301+#: ../ubuntu-printing-app/pages/PrintPage.qml:135
302 msgid "Pages"
303 msgstr ""
304
305-#: ubuntu-printing-app/pages/PrintPage.qml:216
306+#: ../ubuntu-printing-app/pages/PrintPage.qml:177
307 msgid "eg 1-3,8"
308 msgstr ""
309
310-#: ubuntu-printing-app/pages/PrintPage.qml:225
311+#: ../ubuntu-printing-app/pages/PrintPage.qml:186
312 msgid "Two-sided"
313 msgstr ""
314
315-#: ubuntu-printing-app/pages/PrintPage.qml:246
316+#: ../ubuntu-printing-app/pages/PrintPage.qml:207
317 msgid "Color"
318 msgstr ""
319
320-#: ubuntu-printing-app/pages/PrintPage.qml:267
321+#: ../ubuntu-printing-app/pages/PrintPage.qml:228
322 msgid "Quality"
323 msgstr ""
324
325-#: po/ubuntu-printing-app/ubuntu-printing-app.desktop.in.in.h:2
326-msgid "Print;Printing;"
327+#: ../ubuntu-printing-app/pages/PrintPage.qml:246
328+msgid "Collate"
329+msgstr ""
330+
331+#: ../ubuntu-printing-app/pages/PrintPage.qml:266
332+msgid "Reverse"
333+msgstr ""
334+
335+#: ../ubuntu-printing-app/pages/ContentPeerPickerPage.qml:43
336+msgid "Open With..."
337+msgstr ""
338+
339+#. Text color is determined from background color so set from html
340+#: ../ubuntu-printing-app/components/PrintRow.qml:60
341+msgid "Cancel"
342+msgstr ""
343+
344+#: ../ubuntu-printing-app/components/PrintRow.qml:74
345+msgid "Create PDF"
346+msgstr ""
347+
348+#: ../ubuntu-printing-app/components/PrintRow.qml:74
349+msgid "Sheets"
350 msgstr ""
351
352=== modified file 'ubuntu-printing-app/CMakeLists.txt'
353--- ubuntu-printing-app/CMakeLists.txt 2017-01-20 12:36:56 +0000
354+++ ubuntu-printing-app/CMakeLists.txt 2017-03-17 21:17:09 +0000
355@@ -12,10 +12,11 @@
356
357 # Install desktop file
358 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${DESKTOP_FILE}.in.in ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE}.in)
359-
360-add_custom_target(${DESKTOP_FILE} ALL
361- COMMENT "Merging translations into ${DESKTOP_FILE}"
362- COMMAND LC_ALL=C ${INTLTOOL_MERGE} -d -u ${CMAKE_SOURCE_DIR}/po ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE}
363+intltool_merge_translations(
364+ "${DESKTOP_FILE}.in"
365+ "${DESKTOP_FILE}"
366+ ALL
367+ UTF8
368 )
369
370 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE}

Subscribers

People subscribed via source and target branches

to all changes: