mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
feat: Implement language selection feature
This commit is contained in:
@@ -68,6 +68,16 @@
|
||||
"description": "Increase or decrease the size of the monospaced text."
|
||||
}
|
||||
}
|
||||
},
|
||||
"language": {
|
||||
"section": {
|
||||
"label": "Language",
|
||||
"description": "Choose your preferred language for the application."
|
||||
},
|
||||
"select": {
|
||||
"label": "Application Language",
|
||||
"description": "Select the language used in the application's interface."
|
||||
}
|
||||
}
|
||||
},
|
||||
"audio": {
|
||||
@@ -1197,7 +1207,7 @@
|
||||
"scan-again": "Scan again"
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
"tooltips": {
|
||||
"refresh": "Refresh",
|
||||
"close": "Close",
|
||||
|
||||
@@ -66,7 +66,8 @@
|
||||
"animationSpeed": 1,
|
||||
"animationDisabled": false,
|
||||
"compactLockScreen": false,
|
||||
"lockOnSuspend": true
|
||||
"lockOnSuspend": true,
|
||||
"language": "en"
|
||||
},
|
||||
"location": {
|
||||
"name": "Tokyo",
|
||||
@@ -255,4 +256,4 @@
|
||||
"battery": {
|
||||
"chargingMode": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,6 +168,13 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
// Check for user-defined language setting
|
||||
if (Settings.data.general.language !== "" && availableLanguages.includes(Settings.data.general.language)) {
|
||||
Logger.d("I18n", `User-defined language found: "${Settings.data.general.language}"`)
|
||||
setLanguage(Settings.data.general.language)
|
||||
return
|
||||
}
|
||||
|
||||
// Detect user's favorite locale - languages
|
||||
for (var i = 0; i < Qt.locale().uiLanguages.length; i++) {
|
||||
const fullUserLang = Qt.locale().uiLanguages[i]
|
||||
|
||||
@@ -192,6 +192,7 @@ Singleton {
|
||||
property bool animationDisabled: false
|
||||
property bool compactLockScreen: false
|
||||
property bool lockOnSuspend: true
|
||||
property string language: "en"
|
||||
}
|
||||
|
||||
// location
|
||||
|
||||
@@ -190,7 +190,36 @@ ColumnLayout {
|
||||
Layout.bottomMargin: Style.marginXL
|
||||
}
|
||||
|
||||
// Lock Screen
|
||||
// Language selection
|
||||
ColumnLayout {
|
||||
spacing: Style.marginL
|
||||
Layout.fillWidth: true
|
||||
|
||||
NHeader {
|
||||
label: I18n.tr("settings.general.language.section.label")
|
||||
description: I18n.tr("settings.general.language.section.description")
|
||||
}
|
||||
|
||||
NComboBox {
|
||||
Layout.fillWidth: true
|
||||
label: I18n.tr("settings.general.language.select.label")
|
||||
description: I18n.tr("settings.general.language.select.description")
|
||||
model: I18n.availableLanguages.map(function(langCode) {
|
||||
return { "key": langCode, "name": langCode }
|
||||
})
|
||||
currentKey: Settings.data.general.language !== "" ? Settings.data.general.language : I18n.langCode
|
||||
onSelected: key => {
|
||||
Settings.data.general.language = key
|
||||
I18n.setLanguage(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: Style.marginXL
|
||||
Layout.bottomMargin: Style.marginXL
|
||||
}
|
||||
ColumnLayout {
|
||||
spacing: Style.marginL
|
||||
Layout.fillWidth: true
|
||||
|
||||
Reference in New Issue
Block a user