mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-02 03:28:28 -04:00
i18n: term overhaul
- Delete ~160-ish useless terms - Add context to more terms - Add a mechanism to duplicate the same terms with different contexts - sync
This commit is contained in:
@@ -117,12 +117,17 @@ Singleton {
|
||||
log.warn("Falling back to built-in English strings");
|
||||
}
|
||||
|
||||
function tr(term, context) {
|
||||
// isRealContext is consumed by translations/extract_translations.py only:
|
||||
// pass a literal `true` (same line) to give (term, context) its own POEditor
|
||||
// translation slot. Lookup ignores it -- a real context exists as a bucket
|
||||
// in the export, a comment-only context does not.
|
||||
function tr(term, context, isRealContext) {
|
||||
if (!translationsLoaded || !translations)
|
||||
return term;
|
||||
const ctx = context || term;
|
||||
if (translations[ctx] && translations[ctx][term])
|
||||
return translations[ctx][term];
|
||||
if (context && translations[context] && translations[context][term])
|
||||
return translations[context][term];
|
||||
if (translations[term] && translations[term][term])
|
||||
return translations[term][term];
|
||||
for (const c in translations) {
|
||||
if (translations[c] && translations[c][term])
|
||||
return translations[c][term];
|
||||
|
||||
@@ -291,7 +291,7 @@ Singleton {
|
||||
_parseError = true;
|
||||
const msg = e.message;
|
||||
log.error("Failed to parse session.json - file will not be overwritten.");
|
||||
Qt.callLater(() => ToastService.showError(I18n.tr("Failed to parse session.json"), msg));
|
||||
Qt.callLater(() => ToastService.showError(I18n.tr("Failed to parse %1").arg("session.json"), msg));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ Singleton {
|
||||
_parseError = true;
|
||||
const msg = e.message;
|
||||
log.error("Failed to parse session.json - file will not be overwritten.");
|
||||
Qt.callLater(() => ToastService.showError(I18n.tr("Failed to parse session.json"), msg));
|
||||
Qt.callLater(() => ToastService.showError(I18n.tr("Failed to parse %1").arg("session.json"), msg));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1793,7 +1793,7 @@ Singleton {
|
||||
_parseError = true;
|
||||
const msg = e.message;
|
||||
log.error("Failed to parse settings.json - file will not be overwritten. Error:", msg);
|
||||
Qt.callLater(() => ToastService.showError(I18n.tr("Failed to parse settings.json"), msg));
|
||||
Qt.callLater(() => ToastService.showError(I18n.tr("Failed to parse %1").arg("settings.json"), msg));
|
||||
applyStoredTheme();
|
||||
} finally {
|
||||
_loading = false;
|
||||
@@ -1891,7 +1891,7 @@ Singleton {
|
||||
_pluginParseError = true;
|
||||
const msg = e.message;
|
||||
log.error("Failed to parse plugin_settings.json - file will not be overwritten. Error:", msg);
|
||||
Qt.callLater(() => ToastService.showError(I18n.tr("Failed to parse plugin_settings.json"), msg));
|
||||
Qt.callLater(() => ToastService.showError(I18n.tr("Failed to parse %1").arg("plugin_settings.json"), msg));
|
||||
pluginSettings = {};
|
||||
} finally {
|
||||
_pluginSettingsLoading = false;
|
||||
@@ -3653,7 +3653,7 @@ Singleton {
|
||||
_parseError = true;
|
||||
const msg = e.message;
|
||||
log.error("Failed to reload settings.json - file will not be overwritten. Error:", msg);
|
||||
Qt.callLater(() => ToastService.showError(I18n.tr("Failed to parse settings.json"), msg));
|
||||
Qt.callLater(() => ToastService.showError(I18n.tr("Failed to parse %1").arg("settings.json"), msg));
|
||||
} finally {
|
||||
_loading = false;
|
||||
}
|
||||
|
||||
@@ -1956,7 +1956,7 @@ Singleton {
|
||||
function applyGtkColors() {
|
||||
if (!matugenAvailable) {
|
||||
if (typeof ToastService !== "undefined") {
|
||||
ToastService.showError(I18n.tr("matugen not available or disabled - cannot apply GTK colors"));
|
||||
ToastService.showError(I18n.tr("matugen not available or disabled - cannot apply %1 colors").arg("GTK"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1969,7 +1969,7 @@ Singleton {
|
||||
}
|
||||
} else {
|
||||
if (typeof ToastService !== "undefined") {
|
||||
ToastService.showError(I18n.tr("Failed to apply GTK colors"));
|
||||
ToastService.showError(I18n.tr("Failed to apply %1 colors").arg("GTK"));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1978,7 +1978,7 @@ Singleton {
|
||||
function applyQtColors() {
|
||||
if (!matugenAvailable) {
|
||||
if (typeof ToastService !== "undefined") {
|
||||
ToastService.showError(I18n.tr("matugen not available or disabled - cannot apply Qt colors"));
|
||||
ToastService.showError(I18n.tr("matugen not available or disabled - cannot apply %1 colors").arg("Qt"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1990,7 +1990,7 @@ Singleton {
|
||||
}
|
||||
} else {
|
||||
if (typeof ToastService !== "undefined") {
|
||||
ToastService.showError(I18n.tr("Failed to apply Qt colors"));
|
||||
ToastService.showError(I18n.tr("Failed to apply %1 colors").arg("Qt"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -646,7 +646,7 @@ Singleton {
|
||||
|
||||
onExited: exitCode => {
|
||||
if (exitCode === 0) {
|
||||
const message = root.authApplyTerminalFallbackFromPrecheck ? I18n.tr("Terminal opened. Complete authentication setup there; it will close automatically when done.") : I18n.tr("Terminal fallback opened. Complete authentication setup there; it will close automatically when done.");
|
||||
const message = root.authApplyTerminalFallbackFromPrecheck ? I18n.tr("Terminal opened. Complete authentication there; it will close automatically when done.") : I18n.tr("Terminal fallback opened. Complete authentication there; it will close automatically when done.");
|
||||
ToastService.showInfo(message, "", "", "auth-sync");
|
||||
} else {
|
||||
let details = (root.authApplyTerminalFallbackStderr || "").trim();
|
||||
|
||||
Reference in New Issue
Block a user