~nikwen/ubuntu-calendar-app/fix-standalone-month-name-i18n

« back to all changes in this revision

Viewing changes to WeekView.qml

  • Committer: Niklas Wenzel
  • Date: 2016-02-06 17:23:51 UTC
  • mfrom: (734.1.23 ubuntu-calendar-app)
  • Revision ID: nikwen.developer@gmail.com-20160206172351-dl63vqqxjtcs87w7
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
17
 */
18
18
 
19
 
import QtQuick 2.3
20
 
import Ubuntu.Components 1.1
 
19
import QtQuick 2.4
 
20
import Ubuntu.Components 1.3
21
21
import "dateExt.js" as DateExt
22
22
import "ViewType.js" as ViewType
 
23
import "./3rd-party/lunar.js" as Lunar
23
24
 
24
25
Page{
25
26
    id: weekViewPage
47
48
        }
48
49
    }
49
50
 
50
 
    head {
51
 
        actions: [
 
51
    header: PageHeader {
 
52
        id: pageHeader
 
53
 
 
54
        leadingActionBar.actions: tabs.tabsAction
 
55
        trailingActionBar.actions: [
52
56
            calendarTodayAction,
53
57
            commonHeaderActions.newEventAction,
54
58
            commonHeaderActions.showCalendarAction,
57
61
            commonHeaderActions.settingsAction
58
62
        ]
59
63
 
60
 
        contents: Label {
61
 
            id:monthYear
62
 
            objectName:"monthYearLabel"
63
 
            fontSize: "x-large"
64
 
            // TRANSLATORS: This string is used in the header of the month, week and day views.
65
 
            // %1 is going to be replaced by the month name, %2 by the year.
66
 
            text: i18n.tr("%1 %2").arg(Qt.locale().standaloneMonthName(dayStart.getMonth(), Locale.LongFormat)).arg(dayStart.getFullYear())
67
 
            font.capitalization: Font.Capitalize
68
 
        }
 
64
        // TRANSLATORS: This string is used in the header of the month, week and day views.
 
65
        // %1 is going to be replaced by the month name, %2 by the year.
 
66
        title: i18n.tr("%1 %2").arg(Qt.locale().standaloneMonthName(dayStart.getMonth(), Locale.LongFormat)).arg(dayStart.getFullYear())
 
67
 
 
68
        flickable: null
69
69
    }
70
70
 
71
71
    PathViewBase{
72
72
        id: weekViewPath
73
73
        objectName: "weekviewpathbase"
74
74
 
75
 
        anchors.fill: parent
 
75
        anchors {
 
76
            fill: parent
 
77
            topMargin: header.height
 
78
        }
76
79
 
77
80
        //This is used to scroll all view together when currentItem scrolls
78
81
        property var childContentY;
162
165
            }
163
166
        }
164
167
    }
 
168
 
 
169
    Component.onCompleted: {
 
170
        pageHeader.title = Qt.binding(function(){
 
171
            if(mainView.displayLunarCalendar){
 
172
                var lunarDate = Lunar.calendar.solar2lunar(dayStart.getFullYear(),
 
173
                                                           dayStart.getMonth() + 1,
 
174
                                                           dayStart.getDate())
 
175
                return i18n.tr("%1 %2").arg(lunarDate .IMonthCn).arg(lunarDate.gzYear)
 
176
            } else {
 
177
                var monthName = dayStart.toLocaleString(Qt.locale(),i18n.tr("MMMM yyyy"))
 
178
                return monthName[0].toUpperCase() + monthName.substr(1, monthName.length - 1)
 
179
            }
 
180
        })
 
181
    }
165
182
}