From c006377c573f0fb68f7074c7e51305bf6e0375f9 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sun, 7 Jun 2026 20:48:48 +1000 Subject: [PATCH] feat: impl lang & region page --- modules/nexus/PageCompRegistry.qml | 8 + modules/nexus/pages/LanguageAndRegion.qml | 175 ++++++++++++++++++++++ 2 files changed, 183 insertions(+) create mode 100644 modules/nexus/pages/LanguageAndRegion.qml diff --git a/modules/nexus/PageCompRegistry.qml b/modules/nexus/PageCompRegistry.qml index b6e9f0bb..76d2ab5a 100644 --- a/modules/nexus/PageCompRegistry.qml +++ b/modules/nexus/PageCompRegistry.qml @@ -124,6 +124,14 @@ QtObject { ServicesPage {} } } + }, + Component { + // Language & region + StackPage { + Component { + LanguageAndRegion {} + } + } } ] diff --git a/modules/nexus/pages/LanguageAndRegion.qml b/modules/nexus/pages/LanguageAndRegion.qml new file mode 100644 index 00000000..b31fc825 --- /dev/null +++ b/modules/nexus/pages/LanguageAndRegion.qml @@ -0,0 +1,175 @@ +import QtQuick +import QtQuick.Layouts +import Caelestia.Config +import qs.components +import qs.components.controls +import qs.services +import qs.modules.nexus.common + +PageBase { + id: root + + // Temperature units (index 0 = Celsius, 1 = Fahrenheit — matches Weather.formatTemp) + readonly property list tempItems: [ + MenuItem { + text: "°C" + }, + MenuItem { + text: "°F" + } + ] + + // Clock format (index 0 = 24-hour, 1 = 12-hour — matches Time.useTwelveHourClock) + readonly property list clockItems: [ + MenuItem { + text: qsTr("24-hour") + }, + MenuItem { + text: qsTr("12-hour") + } + ] + + title: qsTr("Language & region") + + ColumnLayout { + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + width: root.cappedWidth + spacing: Tokens.spacing.extraSmall / 2 + + // Language + SectionHeader { + first: true + text: qsTr("Language") + } + + // Read-only: the shell follows the system locale (no in-shell translations yet) + ConnectedRect { + Layout.fillWidth: true + first: true + last: true + implicitHeight: localeLayout.implicitHeight + localeLayout.anchors.margins * 2 + + RowLayout { + id: localeLayout + + anchors.fill: parent + anchors.margins: Tokens.padding.medium + anchors.leftMargin: Tokens.padding.largeIncreased + anchors.rightMargin: Tokens.padding.largeIncreased + spacing: Tokens.spacing.medium + + ColumnLayout { + Layout.fillWidth: true + spacing: 0 + + StyledText { + Layout.fillWidth: true + text: qsTr("System language") + font: Tokens.font.body.small + elide: Text.ElideRight + } + + StyledText { + Layout.fillWidth: true + text: qsTr("Follows your system locale (%1)").arg(Qt.locale().name) + color: Colours.palette.m3outline + font: Tokens.font.label.small + elide: Text.ElideRight + } + } + + StyledText { + text: Qt.locale().nativeLanguageName || Qt.locale().name + color: Colours.palette.m3onSurfaceVariant + font: Tokens.font.body.small + } + } + } + + // Weather + SectionHeader { + text: qsTr("Weather") + } + + // Placeholder until the map-based location picker lands + ConnectedRect { + Layout.fillWidth: true + first: true + last: true + implicitHeight: comingSoon.implicitHeight + Tokens.padding.extraLarge * 2 + + ColumnLayout { + id: comingSoon + + anchors.centerIn: parent + width: parent.width - Tokens.padding.largeIncreased * 2 + spacing: Tokens.padding.extraSmall + + MaterialIcon { + Layout.alignment: Qt.AlignHCenter + text: "map" + color: Colours.palette.m3outlineVariant + font: Tokens.font.icon.extraLarge + } + + StyledText { + Layout.alignment: Qt.AlignHCenter + text: qsTr("Location picker coming soon") + color: Colours.palette.m3outlineVariant + font: Tokens.font.title.small + } + + StyledText { + Layout.fillWidth: true + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + text: qsTr("Choose your weather location on a map in a future update") + color: Colours.palette.m3outlineVariant + font: Tokens.font.body.small + } + } + } + + // Units + SectionHeader { + text: qsTr("Units") + } + + SelectRow { + Layout.fillWidth: true + first: true + label: qsTr("Temperature") + subtext: qsTr("Units for weather temperatures") + menuItems: root.tempItems + active: root.tempItems[GlobalConfig.services.useFahrenheit ? 1 : 0] + onSelected: item => GlobalConfig.services.useFahrenheit = root.tempItems.indexOf(item) === 1 + } + + SelectRow { + Layout.fillWidth: true + last: true + label: qsTr("System temperatures") + subtext: qsTr("Units for CPU and GPU temperatures") + menuItems: root.tempItems + active: root.tempItems[GlobalConfig.services.useFahrenheitPerformance ? 1 : 0] + onSelected: item => GlobalConfig.services.useFahrenheitPerformance = root.tempItems.indexOf(item) === 1 + } + + // Time & date + SectionHeader { + text: qsTr("Time & date") + } + + SelectRow { + Layout.fillWidth: true + first: true + last: true + label: qsTr("Clock format") + subtext: qsTr("How times are shown across the shell") + menuItems: root.clockItems + active: root.clockItems[GlobalConfig.services.useTwelveHourClock ? 1 : 0] + onSelected: item => GlobalConfig.services.useTwelveHourClock = root.clockItems.indexOf(item) === 1 + } + } +}