mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-03 20:32:07 -04:00
feat: add setting to change and hotreload locale (#1817)
* feat: add setting to change and hotreload locale * fix: typo in component id * feat: add persistent locale setting * feat: wrap useLocale in a settings set hook, enable locale hotreload when editing settings file * chore: update translation and settings file * feat: enable fuzzy search in locale setting * fix: regenerate translations with official plugins cloned * fix: revert back to system's locale for displaying certain time formats
This commit is contained in:
@@ -149,6 +149,7 @@ Singleton {
|
||||
property int mangoLayoutRadiusOverride: -1
|
||||
property int mangoLayoutBorderSize: -1
|
||||
|
||||
property string locale: ""
|
||||
property bool use24HourClock: true
|
||||
property bool showSeconds: false
|
||||
property bool padHours12Hour: false
|
||||
@@ -1130,13 +1131,18 @@ Singleton {
|
||||
Quickshell.execDetached(["sh", "-lc", script]);
|
||||
}
|
||||
|
||||
function updateLocale() {
|
||||
I18n.useLocale(locale, locale.startsWith("en") ? "" : I18n.folder + "/" + locale + ".json");
|
||||
}
|
||||
|
||||
readonly property var _hooks: ({
|
||||
"applyStoredTheme": applyStoredTheme,
|
||||
"regenSystemThemes": regenSystemThemes,
|
||||
"updateCompositorLayout": updateCompositorLayout,
|
||||
"applyStoredIconTheme": applyStoredIconTheme,
|
||||
"updateBarConfigs": updateBarConfigs,
|
||||
"updateCompositorCursor": updateCompositorCursor
|
||||
"updateCompositorCursor": updateCompositorCursor,
|
||||
"updateLocale": updateLocale,
|
||||
})
|
||||
|
||||
function set(key, value) {
|
||||
@@ -2640,6 +2646,7 @@ Singleton {
|
||||
_hasLoaded = true;
|
||||
applyStoredTheme();
|
||||
updateCompositorCursor();
|
||||
updateLocale();
|
||||
} catch (e) {
|
||||
_parseError = true;
|
||||
const msg = e.message;
|
||||
|
||||
Reference in New Issue
Block a user