translations: update qsTrs to Translation.tr and allow translation of notifications

This commit is contained in:
end-4
2025-07-17 13:56:50 +07:00
parent 9ca67f0095
commit 1e7c84a6c1
10 changed files with 104 additions and 41 deletions
+15 -4
View File
@@ -23,13 +23,24 @@ Singleton {
property bool isSuspendingAndNotCharging: allowAutomaticSuspend && isSuspending && !isCharging
onIsLowAndNotChargingChanged: {
if (available && isLowAndNotCharging)
Quickshell.execDetached(["bash", "-c", `notify-send "Low battery" "Consider plugging in your device" -u critical -a "Shell"`]);
if (available && isLowAndNotCharging) Quickshell.execDetached([
"notify-send",
Translation.tr("Low battery"),
Translation.tr("Consider plugging in your device"),
"-u", "critical",
"-a", "Shell"
])
}
onIsCriticalAndNotChargingChanged: {
if (available && isCriticalAndNotCharging)
Quickshell.execDetached(["bash", "-c", `notify-send "Critically low battery" "🙏 I beg for pleas charg\nAutomatic suspend triggers at ${Config.options.battery.suspend}%" -u critical -a "Shell"`]);
if (available && isCriticalAndNotCharging) Quickshell.execDetached([
"notify-send",
Translation.tr("Critically low battery"),
Translation.tr("Please charge!\nAutomatic suspend triggers at %1").arg(Config.options.battery.suspend),
"-u", "critical",
"-a", "Shell"
]);
}
onIsSuspendingAndNotChargingChanged: {
+19 -20
View File
@@ -17,25 +17,25 @@ Singleton {
property bool gpsActive: Config.options.bar.weather.enableGPS
property var location: ({
valid: false,
lat: 0,
lon: 0
})
valid: false,
lat: 0,
lon: 0
})
property var data: ({
uv: 0,
humidity: 0,
sunrise: 0,
sunset: 0,
windDir: 0,
wCode: 0,
city: 0,
wind: 0,
precip: 0,
visib: 0,
press: 0,
temp: 0
})
uv: 0,
humidity: 0,
sunrise: 0,
sunset: 0,
windDir: 0,
wCode: 0,
city: 0,
wind: 0,
precip: 0,
visib: 0,
press: 0,
temp: 0
})
function refineData(data) {
let temp = {};
@@ -90,8 +90,7 @@ Singleton {
}
Component.onCompleted: {
if (!root.gpsActive)
return;
if (!root.gpsActive) return;
console.info("[WeatherService] Starting the GPS service.");
positionSource.start();
}
@@ -139,7 +138,7 @@ Singleton {
positionSource.stop();
root.location.valid = false;
root.gpsActive = false;
Quickshell.execDetached(["bash", "-c", `notify-send WeatherService 'Can not find a GPS service. Using the fallback method instead.'`]);
Quickshell.execDetached(["notify-send", Translation.tr("Weather Service"), Translation.tr("Cannot find a GPS service. Using the fallback method instead."), "-a", "Shell"]);
console.error("[WeatherService] Could not aquire a valid backend plugin.");
}
}