[localeq] Hook up to Config object

- get network status from the global Network object; document that
- get the strings describing the language and LC settings from
  the config-object instead of roll-our-own
- use the model of supported locales from Config to populate listboxes
- connect selection of language or LC to the Config object
This commit is contained in:
Adriaan de Groot 2020-07-23 23:26:15 +02:00
parent 75da1bece4
commit 00e9454344
2 changed files with 11 additions and 16 deletions

View File

@ -32,10 +32,6 @@ Item {
anchors.fill: parent
}
//Needs to come from Locale config
property var confLang: "en_US.UTF8"
property var confLocale: "nl_NL.UTF8"
Rectangle {
id: textArea
x: 28
@ -57,7 +53,7 @@ Item {
width: 240
wrapMode: Text.WordWrap
text: qsTr("<h1>Languages</h1> </br>
The system locale setting affects the language and character set for some command line user interface elements. The current setting is <strong>%1</strong>.").arg(confLang)
The system locale setting affects the language and character set for some command line user interface elements. The current setting is <strong>%1</strong>.").arg(config.currentLanguageCode)
font.pointSize: 10
}
}
@ -76,8 +72,7 @@ Item {
id: list1
focus: true
// bogus entries, need to come from Locale config
model: ["en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8"]
model: config.supportedLocales
currentIndex: 1
highlight: Rectangle {
@ -95,17 +90,17 @@ Item {
}
onClicked: {
list1.currentIndex = index
confLang = list1.currentIndex
}
}
}
onCurrentItemChanged: { config.currentLanguageCode = model[currentIndex] } /* This works because model is a stringlist */
}
}
}
}
Column {
id: i18n
id: lc_numeric
x: 430
y: 40
@ -118,7 +113,7 @@ Item {
width: 240
wrapMode: Text.WordWrap
text: qsTr("<h1>Locales</h1> </br>
The system locale setting affects the language and character set for some command line user interface elements. The current setting is <strong>%1</strong>.").arg(confLocale)
The system locale setting affects the numbers and dates format. The current setting is <strong>%1</strong>.").arg(config.currentLCCode)
font.pointSize: 10
}
}
@ -139,7 +134,7 @@ Item {
focus: true
// bogus entries, need to come from Locale config
model: ["en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8"]
model: config.supportedLocales
currentIndex: 2
highlight: Rectangle {
@ -154,11 +149,10 @@ Item {
cursorShape: Qt.PointingHandCursor
onClicked: {
list2.currentIndex = index
confLocale = list1.currentIndex
}
}
}
onCurrentItemChanged: console.debug(currentIndex)
onCurrentItemChanged: { config.currentLCCode = model[currentIndex]; } /* This works because model is a stringlist */
}
}
}

View File

@ -37,7 +37,8 @@ Page {
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
height: parent.height / 1.28
source: (Network.hasInternet) ? "Map.qml" : "Offline.qml"
// Network is in io.calamares.core
source: Network.hasInternet ? "Map.qml" : "Offline.qml"
}
RowLayout {
@ -67,7 +68,7 @@ Page {
Label {
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: qsTr("System language set to %1").arg(confLang)
text: config.currentLanguageStatus
}
Kirigami.Separator {
Layout.fillWidth: true
@ -75,7 +76,7 @@ Page {
Label {
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: qsTr("Numbers and dates locale set to %1").arg(confLocale)
text: config.currentLCStatus
}
}
Button {