Merge lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1558643 into lp:ubuntu-calendar-app
- ubuntu-calendar-app-fix_1558643
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Renato Araujo Oliveira Filho |
Approved revision: | 838 |
Merged at revision: | 833 |
Proposed branch: | lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1558643 |
Merge into: | lp:ubuntu-calendar-app |
Diff against target: |
456 lines (+107/-69) 7 files modified
MonthComponent.qml (+5/-5) ViewHeader.qml (+33/-19) WeekView.qml (+9/-3) YearViewDelegate.qml (+2/-2) dateExt.js (+9/-0) po/com.ubuntu.calendar.pot (+44/-40) tests/unittests/tst_date.qml (+5/-0) |
To merge this branch: | bzr merge lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1558643 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Renato Araujo Oliveira Filho (community) | Approve | ||
Jenkins Bot | continuous-integration | Approve | |
Review via email: mp+293321@code.launchpad.net |
Commit message
Enable translators to changes year/month position on year and week views
Description of the change
Enable translators to changes year/month position on year and week views
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
Renato Araujo Oliveira Filho (renatofilho) wrote : | # |
Looks good, but what do you think about using "Qt.locale(
- 834. By Arthur Mello
-
Use Qt locale date format to decide if year should be displayed before month
- 835. By Arthur Mello
-
Update pot file
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:835
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
- 836. By Arthur Mello
-
Move repeated code to date library
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:836
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
- 837. By Arthur Mello
-
Move to stand alone function
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:837
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
- 838. By Arthur Mello
-
Add unittest
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:838
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Renato Araujo Oliveira Filho (renatofilho) wrote : | # |
looks good.
Preview Diff
1 | === modified file 'MonthComponent.qml' |
2 | --- MonthComponent.qml 2016-04-28 13:44:33 +0000 |
3 | +++ MonthComponent.qml 2016-04-29 21:32:29 +0000 |
4 | @@ -40,8 +40,8 @@ |
5 | |
6 | property string dayLabelFontSize: "medium" |
7 | property string dateLabelFontSize: "large" |
8 | - property string monthLabelFontSize: "large" |
9 | - property string yearLabelFontSize: "large" |
10 | + property string leftLabelFontSize: "large" |
11 | + property string rightLabelFontSize: "large" |
12 | |
13 | signal monthSelected(var date); |
14 | signal dateSelected(var date); |
15 | @@ -140,7 +140,7 @@ |
16 | |
17 | Loader { |
18 | width: parent.width |
19 | - height: isYearView ? FontUtils.sizeToPixels(root.monthLabelFontSize) : 0; |
20 | + height: isYearView ? FontUtils.sizeToPixels(root.leftLabelFontSize) : 0; |
21 | sourceComponent: isYearView ? headerComp : undefined |
22 | Component{ |
23 | id: headerComp |
24 | @@ -151,8 +151,8 @@ |
25 | year: root.currentYear |
26 | daysInMonth: intern.daysInStartMonth |
27 | |
28 | - monthLabelFontSize: root.monthLabelFontSize |
29 | - yearLabelFontSize: root.yearLabelFontSize |
30 | + leftLabelFontSize: root.leftLabelFontSize |
31 | + rightLabelFontSize: root.rightLabelFontSize |
32 | } |
33 | } |
34 | } |
35 | |
36 | === modified file 'ViewHeader.qml' |
37 | --- ViewHeader.qml 2016-03-02 19:55:52 +0000 |
38 | +++ ViewHeader.qml 2016-04-29 21:32:29 +0000 |
39 | @@ -17,24 +17,25 @@ |
40 | */ |
41 | import QtQuick 2.4 |
42 | import Ubuntu.Components 1.3 |
43 | +import "dateExt.js" as DateExt |
44 | import "./3rd-party/lunar.js" as Lunar |
45 | |
46 | Item{ |
47 | id: header |
48 | width: parent.width |
49 | - height: monthLabel.height |
50 | + height: leftLabel.height |
51 | |
52 | property int month; |
53 | property int year; |
54 | property int daysInMonth; |
55 | |
56 | - property string monthLabelFontSize: "large" |
57 | - property string yearLabelFontSize: "large" |
58 | + property string leftLabelFontSize: "large" |
59 | + property string rightLabelFontSize: "large" |
60 | |
61 | Label{ |
62 | - id: monthLabel |
63 | - objectName: "monthLabel" |
64 | - fontSize: monthLabelFontSize |
65 | + id: leftLabel |
66 | + objectName: "leftLabel" |
67 | + fontSize: leftLabelFontSize |
68 | anchors.leftMargin: units.gu(1) |
69 | anchors.left: parent.left |
70 | color:"black" |
71 | @@ -42,9 +43,9 @@ |
72 | } |
73 | |
74 | Label{ |
75 | - id: yearLabel |
76 | - objectName: "yearLabel" |
77 | - fontSize: yearLabelFontSize |
78 | + id: rightLabel |
79 | + objectName: "rightLabel" |
80 | + fontSize: rightLabelFontSize |
81 | anchors.right: parent.right |
82 | anchors.rightMargin: units.gu(1) |
83 | color:"black" |
84 | @@ -52,20 +53,33 @@ |
85 | } |
86 | |
87 | Component.onCompleted: { |
88 | - yearLabel.text = Qt.binding(function(){ |
89 | + leftLabel.text = Qt.binding(function(){ |
90 | + var labelDate = new Date(year, month) |
91 | + |
92 | + if (mainView.displayLunarCalendar) { |
93 | + var lunarDate = Lunar.calendar.solar2lunar(year, month + 1, daysInMonth) |
94 | + return lunarDate.IMonthCn |
95 | + } else { |
96 | + if (DateExt.isYearPrecedesMonthFormat(Qt.locale().dateFormat(Locale.ShortFormat))) { |
97 | + return labelDate.toLocaleString(Qt.locale(), "yyyy") |
98 | + } else { |
99 | + return labelDate.toLocaleString(Qt.locale(), "MMMM") |
100 | + } |
101 | + } |
102 | + }) |
103 | + |
104 | + rightLabel.text = Qt.binding(function(){ |
105 | + var labelDate = new Date(year, month) |
106 | + |
107 | if (mainView.displayLunarCalendar) { |
108 | var lunarDate = Lunar.calendar.solar2lunar(year, month + 1, daysInMonth) |
109 | return lunarDate.gzYear |
110 | } else { |
111 | - return year |
112 | - } |
113 | - }) |
114 | - monthLabel.text = Qt.binding(function(){ |
115 | - if (mainView.displayLunarCalendar) { |
116 | - var lunarDate = Lunar.calendar.solar2lunar(year, month + 1, daysInMonth) |
117 | - return lunarDate.IMonthCn |
118 | - } else { |
119 | - return Qt.locale().standaloneMonthName(month) |
120 | + if (DateExt.isYearPrecedesMonthFormat(Qt.locale().dateFormat(Locale.ShortFormat))) { |
121 | + return labelDate.toLocaleString(Qt.locale(), "MMMM") |
122 | + } else { |
123 | + return labelDate.toLocaleString(Qt.locale(), "yyyy") |
124 | + } |
125 | } |
126 | }) |
127 | } |
128 | |
129 | === modified file 'WeekView.qml' |
130 | --- WeekView.qml 2016-03-17 01:51:25 +0000 |
131 | +++ WeekView.qml 2016-04-29 21:32:29 +0000 |
132 | @@ -137,9 +137,15 @@ |
133 | if (currentLastDayOfWeek.getMonth() !== currentFirstDayOfWeek.getMonth()) { |
134 | var firstMonthName = currentFirstDayOfWeek.toLocaleString(Qt.locale(),i18n.tr("MMM")) |
135 | var lastMonthName = currentLastDayOfWeek.toLocaleString(Qt.locale(),i18n.tr("MMM")) |
136 | - return (firstMonthName[0].toUpperCase() + firstMonthName.substr(1, 2) + "/" + |
137 | - lastMonthName[0].toUpperCase() + lastMonthName.substr(1, 2) + " " + |
138 | - currentLastDayOfWeek.getFullYear()) |
139 | + var firstLastMonthStr = firstMonthName[0].toUpperCase() + firstMonthName.substr(1, 2) + |
140 | + "/" + |
141 | + lastMonthName[0].toUpperCase() + lastMonthName.substr(1, 2) |
142 | + |
143 | + if (DateExt.isYearPrecedesMonthFormat(Qt.locale().dateFormat(Locale.ShortFormat))) { |
144 | + return currentLastDayOfWeek.getFullYear() + " " + firstLastMonthStr |
145 | + } else { |
146 | + return firstLastMonthStr + " " + currentLastDayOfWeek.getFullYear() |
147 | + } |
148 | } else { |
149 | var monthName = currentDate.toLocaleString(Qt.locale(),i18n.tr("MMMM yyyy")) |
150 | return monthName[0].toUpperCase() + monthName.substr(1, monthName.length - 1) |
151 | |
152 | === modified file 'YearViewDelegate.qml' |
153 | --- YearViewDelegate.qml 2016-03-02 19:55:52 +0000 |
154 | +++ YearViewDelegate.qml 2016-04-29 21:32:29 +0000 |
155 | @@ -56,8 +56,8 @@ |
156 | isYearView: true |
157 | dayLabelFontSize:"x-small" |
158 | dateLabelFontSize: "medium" |
159 | - monthLabelFontSize: "medium" |
160 | - yearLabelFontSize: "medium" |
161 | + leftLabelFontSize: "medium" |
162 | + rightLabelFontSize: "medium" |
163 | onMonthSelected: { |
164 | yearView.monthSelected(date); |
165 | } |
166 | |
167 | === modified file 'dateExt.js' |
168 | --- dateExt.js 2016-03-16 20:01:23 +0000 |
169 | +++ dateExt.js 2016-04-29 21:32:29 +0000 |
170 | @@ -161,3 +161,12 @@ |
171 | // Convert back to days and return |
172 | return Math.round(difference_ms/one_day); |
173 | } |
174 | + |
175 | +function isYearPrecedesMonthFormat( dateShortFormat ) { |
176 | + var yearIndexFormat = dateShortFormat.indexOf("y"); |
177 | + var monthIndexFormat = dateShortFormat.indexOf("M"); |
178 | + |
179 | + return yearIndexFormat >= 0 && |
180 | + monthIndexFormat >= 0 && |
181 | + yearIndexFormat < monthIndexFormat; |
182 | +} |
183 | |
184 | === modified file 'po/com.ubuntu.calendar.pot' |
185 | --- po/com.ubuntu.calendar.pot 2016-03-23 03:59:15 +0000 |
186 | +++ po/com.ubuntu.calendar.pot 2016-04-29 21:32:29 +0000 |
187 | @@ -1,6 +1,6 @@ |
188 | # SOME DESCRIPTIVE TITLE. |
189 | # Copyright (C) YEAR Canonical Ltd. |
190 | -# This file is distributed under the same license as the PACKAGE package. |
191 | +# This file is distributed under the same license as the package. |
192 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
193 | # |
194 | #, fuzzy |
195 | @@ -8,7 +8,7 @@ |
196 | msgstr "" |
197 | "Project-Id-Version: \n" |
198 | "Report-Msgid-Bugs-To: \n" |
199 | -"POT-Creation-Date: 2016-03-23 00:58-0300\n" |
200 | +"POT-Creation-Date: 2016-04-29 15:21-0300\n" |
201 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
202 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
203 | "Language-Team: LANGUAGE <LL@li.org>\n" |
204 | @@ -18,7 +18,7 @@ |
205 | "Content-Transfer-Encoding: 8bit\n" |
206 | "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" |
207 | |
208 | -#: ../AgendaView.qml:50 ../calendar.qml:344 ../calendar.qml:576 |
209 | +#: ../AgendaView.qml:50 ../calendar.qml:348 ../calendar.qml:580 |
210 | msgid "Agenda" |
211 | msgstr "" |
212 | |
213 | @@ -104,7 +104,7 @@ |
214 | msgstr "" |
215 | |
216 | #: ../ColorPickerDialog.qml:55 ../DeleteConfirmationDialog.qml:60 |
217 | -#: ../EditEventConfirmationDialog.qml:53 ../NewEvent.qml:341 |
218 | +#: ../EditEventConfirmationDialog.qml:53 ../NewEvent.qml:331 |
219 | msgid "Cancel" |
220 | msgstr "" |
221 | |
222 | @@ -116,14 +116,14 @@ |
223 | msgid "Search contact" |
224 | msgstr "" |
225 | |
226 | -#: ../DayView.qml:72 ../MonthView.qml:50 ../WeekView.qml:55 ../YearView.qml:57 |
227 | +#: ../DayView.qml:72 ../MonthView.qml:48 ../WeekView.qml:55 ../YearView.qml:57 |
228 | msgid "Today" |
229 | msgstr "" |
230 | |
231 | #. TRANSLATORS: this is a time formatting string, |
232 | #. see http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions. |
233 | #. It's used in the header of the month and week views |
234 | -#: ../DayView.qml:122 ../MonthView.qml:78 ../WeekView.qml:144 |
235 | +#: ../DayView.qml:122 ../MonthView.qml:76 ../WeekView.qml:154 |
236 | msgid "MMMM yyyy" |
237 | msgstr "" |
238 | |
239 | @@ -154,11 +154,11 @@ |
240 | msgid "Delete this" |
241 | msgstr "" |
242 | |
243 | -#: ../DeleteConfirmationDialog.qml:51 ../NewEvent.qml:348 |
244 | +#: ../DeleteConfirmationDialog.qml:51 ../NewEvent.qml:338 |
245 | msgid "Delete" |
246 | msgstr "" |
247 | |
248 | -#: ../EditEventConfirmationDialog.qml:29 ../NewEvent.qml:336 |
249 | +#: ../EditEventConfirmationDialog.qml:29 ../NewEvent.qml:326 |
250 | msgid "Edit Event" |
251 | msgstr "" |
252 | |
253 | @@ -182,12 +182,12 @@ |
254 | |
255 | #. TRANSLATORS: the first argument (%1) refers to a start time for an event, |
256 | #. while the second one (%2) refers to the end time |
257 | -#: ../EventBubble.qml:100 |
258 | +#: ../EventBubble.qml:136 |
259 | #, qt-format |
260 | msgid "%1 - %2" |
261 | msgstr "" |
262 | |
263 | -#: ../EventDetails.qml:37 ../NewEvent.qml:484 |
264 | +#: ../EventDetails.qml:37 ../NewEvent.qml:496 |
265 | msgid "Event Details" |
266 | msgstr "" |
267 | |
268 | @@ -195,32 +195,36 @@ |
269 | msgid "Edit" |
270 | msgstr "" |
271 | |
272 | -#: ../EventDetails.qml:164 ../TimeLineHeader.qml:66 |
273 | +#: ../EventDetails.qml:176 ../TimeLineHeader.qml:66 |
274 | msgid "All Day" |
275 | msgstr "" |
276 | |
277 | -#: ../EventDetails.qml:336 ../NewEvent.qml:549 |
278 | +#: ../EventDetails.qml:351 ../NewEvent.qml:562 |
279 | #: com.ubuntu.calendar_calendar.desktop.in.in.h:1 |
280 | msgid "Calendar" |
281 | msgstr "" |
282 | |
283 | -#: ../EventDetails.qml:369 |
284 | +#: ../EventDetails.qml:395 |
285 | +msgid "Attending" |
286 | +msgstr "" |
287 | + |
288 | +#: ../EventDetails.qml:397 |
289 | msgid "Not Attending" |
290 | msgstr "" |
291 | |
292 | -#: ../EventDetails.qml:373 |
293 | -msgid "Attending" |
294 | +#: ../EventDetails.qml:399 |
295 | +msgid "Maybe" |
296 | msgstr "" |
297 | |
298 | -#: ../EventDetails.qml:377 |
299 | +#: ../EventDetails.qml:401 |
300 | msgid "No Reply" |
301 | msgstr "" |
302 | |
303 | -#: ../EventDetails.qml:400 ../NewEvent.qml:515 |
304 | +#: ../EventDetails.qml:440 ../NewEvent.qml:528 |
305 | msgid "Description" |
306 | msgstr "" |
307 | |
308 | -#: ../EventDetails.qml:418 ../EventReminder.qml:36 ../NewEvent.qml:711 |
309 | +#: ../EventDetails.qml:467 ../NewEvent.qml:721 ../NewEvent.qml:760 |
310 | msgid "Reminder" |
311 | msgstr "" |
312 | |
313 | @@ -228,7 +232,7 @@ |
314 | #. and it is shown as the header of the page to choose repetition |
315 | #. and as the header of the list item that shows the repetition |
316 | #. summary in the page that displays the event details |
317 | -#: ../EventRepetition.qml:40 ../EventRepetition.qml:153 |
318 | +#: ../EventRepetition.qml:40 ../EventRepetition.qml:152 |
319 | msgid "Repeat" |
320 | msgstr "" |
321 | |
322 | @@ -236,18 +240,18 @@ |
323 | msgid "Repeats On:" |
324 | msgstr "" |
325 | |
326 | -#: ../EventRepetition.qml:217 |
327 | +#: ../EventRepetition.qml:218 |
328 | msgid "Recurring event ends" |
329 | msgstr "" |
330 | |
331 | #. TRANSLATORS: this refers to how often a recurrent event repeats |
332 | #. and it is shown as the header of the option selector to choose |
333 | #. its repetition |
334 | -#: ../EventRepetition.qml:240 ../NewEvent.qml:685 |
335 | +#: ../EventRepetition.qml:242 ../NewEvent.qml:697 |
336 | msgid "Repeats" |
337 | msgstr "" |
338 | |
339 | -#: ../EventRepetition.qml:265 |
340 | +#: ../EventRepetition.qml:268 |
341 | msgid "Date" |
342 | msgstr "" |
343 | |
344 | @@ -288,60 +292,60 @@ |
345 | |
346 | #. TRANSLATORS: This is shown in the month view as "Wk" as a title |
347 | #. to indicate the week numbers. It should be a max of up to 3 characters. |
348 | -#: ../MonthComponent.qml:317 |
349 | +#: ../MonthComponent.qml:281 |
350 | msgid "Wk" |
351 | msgstr "" |
352 | |
353 | -#: ../MonthView.qml:73 ../WeekView.qml:131 |
354 | +#: ../MonthView.qml:71 ../WeekView.qml:131 |
355 | #, qt-format |
356 | msgid "%1 %2" |
357 | msgstr "" |
358 | |
359 | -#: ../NewEvent.qml:179 |
360 | +#: ../NewEvent.qml:185 |
361 | msgid "End time can't be before start time" |
362 | msgstr "" |
363 | |
364 | -#: ../NewEvent.qml:336 ../NewEventBottomEdge.qml:53 |
365 | +#: ../NewEvent.qml:326 ../NewEventBottomEdge.qml:53 |
366 | msgid "New Event" |
367 | msgstr "" |
368 | |
369 | -#: ../NewEvent.qml:365 |
370 | +#: ../NewEvent.qml:355 |
371 | msgid "Save" |
372 | msgstr "" |
373 | |
374 | -#: ../NewEvent.qml:376 |
375 | +#: ../NewEvent.qml:366 |
376 | msgid "Error" |
377 | msgstr "" |
378 | |
379 | -#: ../NewEvent.qml:378 |
380 | +#: ../NewEvent.qml:368 |
381 | msgid "OK" |
382 | msgstr "" |
383 | |
384 | -#: ../NewEvent.qml:438 |
385 | +#: ../NewEvent.qml:430 |
386 | msgid "From" |
387 | msgstr "" |
388 | |
389 | -#: ../NewEvent.qml:451 |
390 | +#: ../NewEvent.qml:446 |
391 | msgid "To" |
392 | msgstr "" |
393 | |
394 | -#: ../NewEvent.qml:468 |
395 | +#: ../NewEvent.qml:473 |
396 | msgid "All day event" |
397 | msgstr "" |
398 | |
399 | -#: ../NewEvent.qml:497 |
400 | +#: ../NewEvent.qml:510 |
401 | msgid "Event Name" |
402 | msgstr "" |
403 | |
404 | -#: ../NewEvent.qml:534 |
405 | +#: ../NewEvent.qml:547 |
406 | msgid "Location" |
407 | msgstr "" |
408 | |
409 | -#: ../NewEvent.qml:589 |
410 | +#: ../NewEvent.qml:603 |
411 | msgid "Guests" |
412 | msgstr "" |
413 | |
414 | -#: ../NewEvent.qml:598 |
415 | +#: ../NewEvent.qml:613 |
416 | msgid "Add Guest" |
417 | msgstr "" |
418 | |
419 | @@ -466,19 +470,19 @@ |
420 | "about them" |
421 | msgstr "" |
422 | |
423 | -#: ../calendar.qml:312 ../calendar.qml:492 |
424 | +#: ../calendar.qml:316 ../calendar.qml:496 |
425 | msgid "Year" |
426 | msgstr "" |
427 | |
428 | -#: ../calendar.qml:320 ../calendar.qml:513 |
429 | +#: ../calendar.qml:324 ../calendar.qml:517 |
430 | msgid "Month" |
431 | msgstr "" |
432 | |
433 | -#: ../calendar.qml:328 ../calendar.qml:534 |
434 | +#: ../calendar.qml:332 ../calendar.qml:538 |
435 | msgid "Week" |
436 | msgstr "" |
437 | |
438 | -#: ../calendar.qml:336 ../calendar.qml:555 |
439 | +#: ../calendar.qml:340 ../calendar.qml:559 |
440 | msgid "Day" |
441 | msgstr "" |
442 | |
443 | |
444 | === modified file 'tests/unittests/tst_date.qml' |
445 | --- tests/unittests/tst_date.qml 2014-08-18 16:48:54 +0000 |
446 | +++ tests/unittests/tst_date.qml 2016-04-29 21:32:29 +0000 |
447 | @@ -120,4 +120,9 @@ |
448 | compare(d.endOfDay(), new Date(2014, 2, 3, 23, 59, 59, 0)); |
449 | } |
450 | |
451 | + function test_isYearPrecedesMonthFormat(test) { |
452 | + verify(!DATE.isYearPrecedesMonthFormat(Qt.locale("en").dateFormat(Locale.ShortFormat))); |
453 | + verify(DATE.isYearPrecedesMonthFormat(Qt.locale("hu").dateFormat(Locale.ShortFormat))); |
454 | + } |
455 | + |
456 | } |
PASSED: Continuous integration, rev:833 /core-apps- jenkins. ubuntu. com/job/ calendar- app-ci/ 838/ /core-apps- jenkins. ubuntu. com/job/ generic- update- mp/877/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /core-apps- jenkins. ubuntu. com/job/ calendar- app-ci/ 838/rebuild
https:/