2
* Copyright 2012 Canonical Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
import Ubuntu.Components 0.1
20
import Ubuntu.Components.ListItems 0.1 as ListItem
23
\brief An application to test locales on the device
25
Demonstrates following:
36
// objectName for functional testing purposes (autopilot-qt5)
37
objectName: "mainView"
39
// Note! applicationName needs to match the .desktop filename
40
applicationName: "locale"
43
This property enables the application to change orientation
44
when the device is rotated. The default is false.
50
automaticOrientation: true
51
property string locale: view.currentItem.locale
62
height: parent.height/2
64
highlightFollowsCurrentItem: true
84
delegate: ListItem.Standard {
85
property string locale: modelData
86
text: Qt.locale(modelData).name + " ("+ Qt.locale(modelData).nativeCountryName + "/" + Qt.locale(modelData).nativeLanguageName + ")"
87
onClicked: view.currentIndex = index
89
highlight: Rectangle {
99
topMargin: units.gu(0.5)
100
leftMargin: units.gu(0.5)
101
bottom: parent.bottom
107
spacing: units.gu(0.5)
110
property var date: new Date()
111
text: "Date: " + date.toLocaleDateString(Qt.locale(root.locale))
115
property var date: new Date()
116
text: "Time: " + date.toLocaleTimeString(Qt.locale(root.locale))
120
property var dow: Qt.locale(root.locale).firstDayOfWeek
121
text: "First day of week: " + Qt.locale(root.locale).standaloneDayName(dow)
125
property var num: 10023823
126
text: "Number: " + num.toLocaleString(Qt.locale(root.locale))
130
property var num: 10023823
131
text: "Currency: " + num.toLocaleCurrencyString(Qt.locale(root.locale))