1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-09 07:12:07 -04:00

locale: fix locale override persisting even when not explicitly set

This commit is contained in:
bbedward
2026-02-26 16:15:06 -05:00
parent 1fe72e1a66
commit fbc1ff62c7
6 changed files with 44 additions and 24 deletions

View File

@@ -21,7 +21,9 @@ Singleton {
property bool _isReadOnly: false
property bool _hasUnsavedChanges: false
property var _loadedSessionSnapshot: null
readonly property var _hooks: ({})
readonly property var _hooks: ({
"updateLocale": updateLocale
})
readonly property string _stateUrl: StandardPaths.writableLocation(StandardPaths.GenericStateLocation)
readonly property string _stateDir: Paths.strip(_stateUrl)
@@ -126,6 +128,8 @@ Singleton {
property var hiddenOutputDeviceNames: []
property var hiddenInputDeviceNames: []
property string locale: ""
property string launcherLastMode: "all"
property string appDrawerLastMode: "apps"
property string niriOverviewLastMode: "apps"
@@ -1104,6 +1108,14 @@ Singleton {
saveSettings();
}
function updateLocale() {
if (!locale) {
I18n._pickTranslation();
return;
}
I18n.useLocale(locale, locale.startsWith("en") ? "" : I18n.folder + "/" + locale + ".json");
}
function setLauncherLastMode(mode) {
launcherLastMode = mode;
saveSettings();