1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-11 16:22:09 -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:
Jonas Bloch
2026-02-26 22:00:17 +01:00
committed by GitHub
parent f82d7610e3
commit 1fe72e1a66
21 changed files with 819 additions and 536 deletions

View File

@@ -157,12 +157,12 @@ Singleton {
// Parse start and end dates using detected format
let startDate, endDate
if (event['start-date']) {
startDate = Date.fromLocaleString(Qt.locale(), event['start-date'], root.khalDateFormat)
startDate = Date.fromLocaleString(I18n.locale(), event['start-date'], root.khalDateFormat)
} else {
startDate = new Date()
}
if (event['end-date']) {
endDate = Date.fromLocaleString(Qt.locale(), event['end-date'], root.khalDateFormat)
endDate = Date.fromLocaleString(I18n.locale(), event['end-date'], root.khalDateFormat)
} else {
endDate = new Date(startDate)
}

View File

@@ -252,7 +252,7 @@ Singleton {
if (daysDiff === 0)
return timeStr;
try {
const localeName = (typeof Qt !== "undefined" && Qt.locale) ? Qt.locale().name : "en-US";
const localeName = (typeof I18n !== "undefined" && I18n.locale) ? I18n.locale().name : "en-US";
const weekday = date.toLocaleDateString(localeName, {
weekday: "long"
});
@@ -695,7 +695,7 @@ Singleton {
}
try {
const localeName = (typeof Qt !== "undefined" && Qt.locale) ? Qt.locale().name : "en-US";
const localeName = (typeof I18n !== "undefined" && I18n.locale) ? I18n.locale().name : "en-US";
const weekday = time.toLocaleDateString(localeName, {
weekday: "long"
});

View File

@@ -444,7 +444,7 @@ Singleton {
const date = new Date();
date.setDate(date.getDate() + index);
const locale = Qt.locale();
const locale = I18n.locale();
return locale.dayName(date.getDay(), Locale.ShortFormat);
}