Merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-translation-issues into lp:ubuntu-docviewer-app/trunk

Proposed by Stefano Verzegnassi
Status: Merged
Approved by: Bartosz Kosiorek
Approved revision: 91
Merged at revision: 90
Proposed branch: lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-translation-issues
Merge into: lp:ubuntu-docviewer-app/trunk
Diff against target: 288 lines (+83/-39)
7 files modified
po/com.ubuntu.docviewer.pot (+59/-27)
src/app/qml/common/DetailsPage.qml (+1/-1)
src/app/qml/common/utils.js (+9/-5)
src/app/qml/documentPage/DeleteFileDialog.qml (+5/-2)
src/app/qml/documentPage/DocumentGridDelegate.qml (+7/-3)
src/app/qml/documentPage/DocumentListDelegate.qml (+1/-1)
src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml (+1/-0)
To merge this branch: bzr merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-translation-issues
Reviewer Review Type Date Requested Status
Bartosz Kosiorek (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+251788@code.launchpad.net

Commit message

Several translation fixes

Description of the change

Fixes for several issues related with translations

* In utils.js I used a workaround that has been accepted earlier in the clock-app (i18n singleton is not available in JS file).
* Fixed plural form in DeleteFile.qml (the "path ? <true_condition> : <false_condition>" has been keeped, since the removal of files work differently if called from selection mode instead of the ListItem swipe gesture)
* In DocumentGridDelegate.qml arguments are used in order to avoid truncation of translatable strings
* Fix for ErrorDialog not working (Ubuntu.Components.Popups import missing)

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: Approve (continuous-integration)
Revision history for this message
David Planella (dpm) wrote :

Looks good to me, just added one comment. Not sure if it can be worked around?

Revision history for this message
Bartosz Kosiorek (gang65) wrote :

Works ok for me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/com.ubuntu.docviewer.pot'
2--- po/com.ubuntu.docviewer.pot 2015-03-04 12:28:46 +0000
3+++ po/com.ubuntu.docviewer.pot 2015-03-04 17:51:36 +0000
4@@ -8,7 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: \n"
7 "Report-Msgid-Bugs-To: \n"
8-"POT-Creation-Date: 2015-03-04 13:28+0100\n"
9+"POT-Creation-Date: 2015-03-04 18:46+0100\n"
10 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13@@ -16,6 +16,7 @@
14 "MIME-Version: 1.0\n"
15 "Content-Type: text/plain; charset=CHARSET\n"
16 "Content-Transfer-Encoding: 8bit\n"
17+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
18
19 #: ../src/app/qml/common/DetailsPage.qml:27
20 #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:91
21@@ -52,7 +53,7 @@
22 msgstr ""
23
24 #: ../src/app/qml/common/ErrorDialog.qml:28
25-#: ../src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml:31
26+#: ../src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml:32
27 #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:61
28 #: ../src/app/qml/textView/TextViewDefaultHeader.qml:61
29 msgid "Close"
30@@ -76,31 +77,56 @@
31 msgid "No"
32 msgstr ""
33
34-#: ../src/app/qml/documentPage/DeleteFileDialog.qml:27
35+#. TRANSLATORS: %1 is the size of a file, expressed in GB
36+#: ../src/app/qml/common/utils.js:22
37+#, qt-format
38+msgid "%1 GB"
39+msgstr ""
40+
41+#. TRANSLATORS: %1 is the size of a file, expressed in MB
42+#: ../src/app/qml/common/utils.js:26
43+#, qt-format
44+msgid "%1 MB"
45+msgstr ""
46+
47+#. TRANSLATORS: %1 is the size of a file, expressed in kB
48+#: ../src/app/qml/common/utils.js:30
49+#, qt-format
50+msgid "%1 kB"
51+msgstr ""
52+
53+#. TRANSLATORS: %1 is the size of a file, expressed in byte
54+#: ../src/app/qml/common/utils.js:33
55+#, qt-format
56+msgid "%1 byte"
57+msgstr ""
58+
59+#: ../src/app/qml/documentPage/DeleteFileDialog.qml:28
60 msgid "Delete file"
61 msgstr ""
62
63-#: ../src/app/qml/documentPage/DeleteFileDialog.qml:28
64-#, qt-format
65-msgid "Delete %1 files"
66-msgstr ""
67-
68 #: ../src/app/qml/documentPage/DeleteFileDialog.qml:29
69+#, qt-format
70+msgid "Delete %1 file"
71+msgid_plural "Delete %1 files"
72+msgstr[0] ""
73+msgstr[1] ""
74+
75+#: ../src/app/qml/documentPage/DeleteFileDialog.qml:30
76+#: ../src/app/qml/documentPage/DeleteFileDialog.qml:31
77 msgid "Are you sure you want to permanently delete this file?"
78-msgstr ""
79-
80-#: ../src/app/qml/documentPage/DeleteFileDialog.qml:30
81-msgid "Are you sure you want to permanently delete these files?"
82-msgstr ""
83-
84-#: ../src/app/qml/documentPage/DeleteFileDialog.qml:33
85+msgid_plural "Are you sure you want to permanently delete these files?"
86+msgstr[0] ""
87+msgstr[1] ""
88+
89+#: ../src/app/qml/documentPage/DeleteFileDialog.qml:36
90 #: ../src/app/qml/documentPage/DocumentPagePickModeHeader.qml:27
91 #: ../src/app/qml/pdfView/PdfViewGotoDialog.qml:52
92 msgid "Cancel"
93 msgstr ""
94
95-#: ../src/app/qml/documentPage/DeleteFileDialog.qml:38
96-#: ../src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml:81
97+#: ../src/app/qml/documentPage/DeleteFileDialog.qml:41
98+#: ../src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml:82
99 msgid "Delete"
100 msgstr ""
101
102@@ -114,24 +140,30 @@
103 "folder."
104 msgstr ""
105
106-#: ../src/app/qml/documentPage/DocumentGridDelegate.qml:33
107-msgid "Today, "
108+#. TRANSLATORS: %1 refers to a time formatted as Locale.ShortFormat (e.g. hh:mm). It depends on system settings.
109+#. http://qt-project.org/doc/qt-4.8/qlocale.html#FormatType-enum
110+#: ../src/app/qml/documentPage/DocumentGridDelegate.qml:35
111+#, qt-format
112+msgid "Today, %1"
113 msgstr ""
114
115-#: ../src/app/qml/documentPage/DocumentGridDelegate.qml:36
116-msgid "Yesterday, "
117+#. TRANSLATORS: %1 refers to a time formatted as Locale.ShortFormat (e.g. hh:mm). It depends on system settings.
118+#. http://qt-project.org/doc/qt-4.8/qlocale.html#FormatType-enum
119+#: ../src/app/qml/documentPage/DocumentGridDelegate.qml:40
120+#, qt-format
121+msgid "Yesterday, %1"
122 msgstr ""
123
124 #. TRANSLATORS: this is a datetime formatting string,
125 #. see http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.
126-#: ../src/app/qml/documentPage/DocumentGridDelegate.qml:41
127+#: ../src/app/qml/documentPage/DocumentGridDelegate.qml:45
128 #: ../src/app/qml/documentPage/DocumentListDelegate.qml:35
129 msgid "dddd, hh:mm"
130 msgstr ""
131
132 #. TRANSLATORS: this is a datetime formatting string,
133 #. see http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.
134-#: ../src/app/qml/documentPage/DocumentGridDelegate.qml:45
135+#: ../src/app/qml/documentPage/DocumentGridDelegate.qml:49
136 #: ../src/app/qml/documentPage/DocumentListDelegate.qml:39
137 msgid "dd-MM-yyyy hh:mm"
138 msgstr ""
139@@ -157,7 +189,7 @@
140 msgstr ""
141
142 #: ../src/app/qml/documentPage/DocumentPage.qml:25
143-#: /tmp/tmp.VrJNVy5Wgh/po/com.ubuntu.docviewer.desktop.in.in.h:1
144+#: /home/stefano/Progetti/doc-viewer/build-ubuntu-docviewer-app-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1
145 msgid "Document Viewer"
146 msgstr ""
147
148@@ -175,11 +207,11 @@
149 msgid "Pick"
150 msgstr ""
151
152-#: ../src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml:51
153+#: ../src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml:52
154 msgid "Select None"
155 msgstr ""
156
157-#: ../src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml:53
158+#: ../src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml:54
159 msgid "Select All"
160 msgstr ""
161
162@@ -221,6 +253,6 @@
163 msgid "Loading..."
164 msgstr ""
165
166-#: /tmp/tmp.VrJNVy5Wgh/po/com.ubuntu.docviewer.desktop.in.in.h:2
167+#: /home/stefano/Progetti/doc-viewer/build-ubuntu-docviewer-app-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2
168 msgid "documents;viewer;pdf;reader;"
169 msgstr ""
170
171=== modified file 'src/app/qml/common/DetailsPage.qml'
172--- src/app/qml/common/DetailsPage.qml 2015-02-13 15:30:01 +0000
173+++ src/app/qml/common/DetailsPage.qml 2015-03-04 17:51:36 +0000
174@@ -35,7 +35,7 @@
175 }
176 ListItem.Subtitled {
177 text: i18n.tr("Size")
178- subText: Utils.printSize(file.size)
179+ subText: Utils.printSize(i18n, file.size)
180 }
181
182 ListItem.Subtitled {
183
184=== modified file 'src/app/qml/common/utils.js'
185--- src/app/qml/common/utils.js 2015-03-03 15:41:11 +0000
186+++ src/app/qml/common/utils.js 2015-03-04 17:51:36 +0000
187@@ -16,17 +16,21 @@
188
189 .pragma library
190
191-function printSize(size) {
192+function printSize(i18n, size) {
193 if (size >= 1073741824)
194- return (size / 1073741824).toFixed(2) + qsTr(" GiB");
195+ // TRANSLATORS: %1 is the size of a file, expressed in GB
196+ return i18n.tr("%1 GB").arg((size / 1073741824).toFixed(2));
197
198 if (size >= 1048576)
199- return (size / 1048576).toFixed(2) + qsTr(" MiB");
200+ // TRANSLATORS: %1 is the size of a file, expressed in MB
201+ return i18n.tr("%1 MB").arg((size / 1048576).toFixed(2));
202
203 if (size >= 1024)
204- return parseInt(size / 1024) + qsTr(" KiB");
205+ // TRANSLATORS: %1 is the size of a file, expressed in kB
206+ return i18n.tr("%1 kB").arg(parseInt(size / 1024));
207
208- return size + qsTr(" byte");
209+ // TRANSLATORS: %1 is the size of a file, expressed in byte
210+ return i18n.tr("%1 byte").arg(size);
211 }
212
213 function getNameOfFile(path) {
214
215=== modified file 'src/app/qml/documentPage/DeleteFileDialog.qml'
216--- src/app/qml/documentPage/DeleteFileDialog.qml 2015-03-03 15:41:11 +0000
217+++ src/app/qml/documentPage/DeleteFileDialog.qml 2015-03-04 17:51:36 +0000
218@@ -23,11 +23,14 @@
219 id: deleteFileDialog
220
221 property string path
222+ property int __deleteCount: documentPage.view.item.selectedItems.count
223
224 title: path ? i18n.tr("Delete file") :
225- i18n.tr("Delete %1 files").arg(documentPage.view.item.selectedItems.count)
226+ i18n.tr("Delete %1 file", "Delete %1 files", __deleteCount).arg(__deleteCount)
227 text: path ? i18n.tr("Are you sure you want to permanently delete this file?") :
228- i18n.tr("Are you sure you want to permanently delete these files?")
229+ i18n.tr("Are you sure you want to permanently delete this file?",
230+ "Are you sure you want to permanently delete these files?",
231+ __deleteCount)
232
233 Button {
234 text: i18n.tr("Cancel")
235
236=== modified file 'src/app/qml/documentPage/DocumentGridDelegate.qml'
237--- src/app/qml/documentPage/DocumentGridDelegate.qml 2015-03-03 15:41:11 +0000
238+++ src/app/qml/documentPage/DocumentGridDelegate.qml 2015-03-04 17:51:36 +0000
239@@ -30,10 +30,14 @@
240 var diff = model.dateDiff
241
242 if (diff < 1)
243- return i18n.tr("Today, ") + Qt.formatTime(date, Qt.locale().timeFormat(Locale.ShortFormat))
244+ // TRANSLATORS: %1 refers to a time formatted as Locale.ShortFormat (e.g. hh:mm). It depends on system settings.
245+ // http://qt-project.org/doc/qt-4.8/qlocale.html#FormatType-enum
246+ return i18n.tr("Today, %1").arg(Qt.formatTime(date, Qt.locale().timeFormat(Locale.ShortFormat)))
247
248 if (diff < 2)
249- return i18n.tr("Yesterday, ") + Qt.formatDateTime(date, Qt.locale().timeFormat(Locale.ShortFormat))
250+ // TRANSLATORS: %1 refers to a time formatted as Locale.ShortFormat (e.g. hh:mm). It depends on system settings.
251+ // http://qt-project.org/doc/qt-4.8/qlocale.html#FormatType-enum
252+ return i18n.tr("Yesterday, %1").arg(Qt.formatTime(date, Qt.locale().timeFormat(Locale.ShortFormat)))
253
254 if (diff < 7)
255 // TRANSLATORS: this is a datetime formatting string,
256@@ -156,7 +160,7 @@
257 }
258
259 Label {
260- text: Utils.printSize(model.size)
261+ text: Utils.printSize(i18n, model.size)
262 color: "white"
263 fontSize: "small"
264 }
265
266=== modified file 'src/app/qml/documentPage/DocumentListDelegate.qml'
267--- src/app/qml/documentPage/DocumentListDelegate.qml 2015-03-03 15:41:11 +0000
268+++ src/app/qml/documentPage/DocumentListDelegate.qml 2015-03-04 17:51:36 +0000
269@@ -99,7 +99,7 @@
270 }
271
272 Label {
273- text: Utils.printSize(model.size)
274+ text: Utils.printSize(i18n, model.size)
275 fontSize: "small"
276 }
277 }
278
279=== modified file 'src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml'
280--- src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml 2015-03-03 15:41:11 +0000
281+++ src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml 2015-03-04 17:51:36 +0000
282@@ -16,6 +16,7 @@
283
284 import QtQuick 2.3
285 import Ubuntu.Components 1.1
286+import Ubuntu.Components.Popups 1.0
287
288 import "../upstreamComponents"
289

Subscribers

People subscribed via source and target branches