translations: make language change happen live

This commit is contained in:
end-4
2025-09-05 23:31:08 +02:00
parent d7382db669
commit b0acc5a68e
4 changed files with 145 additions and 212 deletions
+71 -48
View File
@@ -12,7 +12,6 @@ import QtQuick.Layouts
import QtQuick.Window
import Quickshell
import Quickshell.Io
import Quickshell.Hyprland
import qs
import qs.services
import qs.modules.common
@@ -27,13 +26,8 @@ ApplicationWindow {
property bool showNextTime: false
visible: true
onClosing: {
Quickshell.execDetached([
"notify-send",
Translation.tr("Welcome app"),
Translation.tr("Enjoy! You can reopen the welcome app any time with <tt>Super+Shift+Alt+/</tt>. To open the settings app, hit <tt>Super+I</tt>"),
"-a", "Shell"
])
Qt.quit()
Quickshell.execDetached(["notify-send", Translation.tr("Welcome app"), Translation.tr("Enjoy! You can reopen the welcome app any time with <tt>Super+Shift+Alt+/</tt>. To open the settings app, hit <tt>Super+I</tt>"), "-a", "Shell"]);
Qt.quit();
}
title: Translation.tr("illogical-impulse Welcome")
@@ -118,6 +112,7 @@ ApplicationWindow {
}
}
}
Rectangle {
// Content container
color: Appearance.m3colors.m3surfaceContainerLow
@@ -132,11 +127,69 @@ ApplicationWindow {
anchors.fill: parent
ContentSection {
Layout.fillWidth: true
icon: "language"
title: Translation.tr("Language")
ConfigSelectionArray {
id: languageSelector
currentValue: Config.options.language.ui
onSelected: newValue => {
Config.options.language.ui = newValue;
}
options: [
{
displayName: Translation.tr("Auto (System)"),
value: "auto"
},
...Translation.availableLanguages.map(lang => {
return {
displayName: lang.replace('_', '-'),
value: lang
};
})]
}
}
ContentSection {
icon: "screenshot_monitor"
title: Translation.tr("Bar")
ConfigRow {
ContentSubsection {
title: "Corner style"
title: Translation.tr("Bar position")
ConfigSelectionArray {
currentValue: (Config.options.bar.bottom ? 1 : 0) | (Config.options.bar.vertical ? 2 : 0)
onSelected: newValue => {
Config.options.bar.bottom = (newValue & 1) !== 0;
Config.options.bar.vertical = (newValue & 2) !== 0;
}
options: [
{
displayName: Translation.tr("Top"),
icon: "arrow_upward",
value: 0 // bottom: false, vertical: false
},
{
displayName: Translation.tr("Left"),
icon: "arrow_back",
value: 2 // bottom: false, vertical: true
},
{
displayName: Translation.tr("Bottom"),
icon: "arrow_downward",
value: 1 // bottom: true, vertical: false
},
{
displayName: Translation.tr("Right"),
icon: "arrow_forward",
value: 3 // bottom: true, vertical: true
}
]
}
}
ContentSubsection {
title: Translation.tr("Bar style")
ConfigSelectionArray {
currentValue: Config.options.bar.cornerStyle
@@ -146,64 +199,31 @@ ApplicationWindow {
options: [
{
displayName: Translation.tr("Hug"),
icon: "line_curve",
value: 0
},
{
displayName: Translation.tr("Float"),
icon: "page_header",
value: 1
},
{
displayName: Translation.tr("Plain rectangle"),
displayName: Translation.tr("Rect"),
icon: "toolbar",
value: 2
}
]
}
}
ContentSubsection {
title: "Bar layout"
ConfigSelectionArray {
currentValue: Config.options.bar.vertical
onSelected: newValue => {
Config.options.bar.vertical = newValue;
}
options: [
{
displayName: Translation.tr("Horizontal"),
value: false
},
{
displayName: Translation.tr("Vertical"),
value: true
},
]
}
}
}
ConfigRow {
ConfigSwitch {
text: Translation.tr("Automatically hide")
checked: Config.options.bar.autoHide.enable
onCheckedChanged: {
Config.options.bar.autoHide.enable = checked;
}
}
ConfigSwitch {
text: Translation.tr("Place at the bottom/right")
checked: Config.options.bar.bottom
onCheckedChanged: {
Config.options.bar.bottom = checked;
}
}
}
}
ContentSection {
icon: "format_paint"
title: Translation.tr("Style & wallpaper")
ButtonGroup {
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
LightDarkPreferenceButton {
dark: false
}
@@ -272,6 +292,7 @@ ApplicationWindow {
}
ContentSection {
icon: "rule"
title: Translation.tr("Policies")
ConfigRow {
@@ -330,6 +351,7 @@ ApplicationWindow {
}
ContentSection {
icon: "info"
title: Translation.tr("Info")
Flow {
@@ -384,6 +406,7 @@ ApplicationWindow {
}
ContentSection {
icon: "monitoring"
title: Translation.tr("Useless buttons")
Flow {