1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-04 21:02:06 -04:00

i18n: general term cleanup, add missing terms, interpolate some

This commit is contained in:
bbedward
2025-12-18 16:19:27 -05:00
parent baf23157fc
commit 2a91bc41f7
30 changed files with 1540 additions and 421 deletions

View File

@@ -201,7 +201,7 @@ Rectangle {
}
StyledText {
text: modelData === AudioService.source ? "Active" : "Available"
text: modelData === AudioService.source ? I18n.tr("Active") : I18n.tr("Available")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
elide: Text.ElideRight
@@ -241,7 +241,7 @@ Rectangle {
StyledText {
text: {
const isThisDevicePinned = (SettingsData.audioInputDevicePins || {})["preferredInput"] === modelData.name;
return isThisDevicePinned ? "Pinned" : "Pin";
return isThisDevicePinned ? I18n.tr("Pinned") : I18n.tr("Pin");
}
font.pixelSize: Theme.fontSizeSmall
color: {

View File

@@ -211,7 +211,7 @@ Rectangle {
}
StyledText {
text: modelData === AudioService.sink ? "Active" : "Available"
text: modelData === AudioService.sink ? I18n.tr("Active") : I18n.tr("Available")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
elide: Text.ElideRight
@@ -251,7 +251,7 @@ Rectangle {
StyledText {
text: {
const isThisDevicePinned = (SettingsData.audioOutputDevicePins || {})["preferredOutput"] === modelData.name;
return isThisDevicePinned ? "Pinned" : "Pin";
return isThisDevicePinned ? I18n.tr("Pinned") : I18n.tr("Pin");
}
font.pixelSize: Theme.fontSizeSmall
color: {

View File

@@ -1,6 +1,4 @@
import QtQuick
import QtQuick.Controls
import Quickshell
import Quickshell.Services.UPower
import qs.Common
import qs.Services
@@ -66,7 +64,7 @@ Rectangle {
spacing: Theme.spacingS
StyledText {
text: BatteryService.batteryAvailable ? `${BatteryService.batteryLevel}%` : "Power"
text: BatteryService.batteryAvailable ? `${BatteryService.batteryLevel}%` : I18n.tr("Power")
font.pixelSize: Theme.fontSizeXLarge
color: {
if (BatteryService.isLowBattery && !BatteryService.isCharging) {
@@ -81,7 +79,7 @@ Rectangle {
}
StyledText {
text: BatteryService.batteryAvailable ? BatteryService.batteryStatus : "Management"
text: BatteryService.batteryAvailable ? BatteryService.batteryStatus : I18n.tr("Management")
font.pixelSize: Theme.fontSizeLarge
color: {
if (BatteryService.isLowBattery && !BatteryService.isCharging) {
@@ -100,10 +98,10 @@ Rectangle {
StyledText {
text: {
if (!BatteryService.batteryAvailable)
return "Power profile management available";
return I18n.tr("Power profile management available");
const time = BatteryService.formatTimeRemaining();
if (time !== "Unknown") {
return BatteryService.isCharging ? `Time until full: ${time}` : `Time remaining: ${time}`;
return BatteryService.isCharging ? I18n.tr("Time until full: %1").arg(time) : I18n.tr("Time remaining: %1").arg(time);
}
return "";
}
@@ -176,7 +174,7 @@ Rectangle {
}
StyledText {
text: BatteryService.batteryCapacity > 0 ? `${BatteryService.batteryCapacity.toFixed(1)} Wh` : "Unknown"
text: BatteryService.batteryCapacity > 0 ? `${BatteryService.batteryCapacity.toFixed(1)} Wh` : I18n.tr("Unknown")
font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText
font.weight: Font.Bold

View File

@@ -1,7 +1,4 @@
import QtQuick
import QtQuick.Controls
import Quickshell
import Quickshell.Io
import qs.Common
import qs.Services
import qs.Widgets
@@ -42,7 +39,7 @@ Item {
if (!device)
return;
BluetoothService.getAvailableCodecs(device, function(codecs, current) {
BluetoothService.getAvailableCodecs(device, function (codecs, current) {
availableCodecs = codecs;
currentCodec = current;
isLoading = false;
@@ -60,7 +57,7 @@ Item {
}
isLoading = true;
BluetoothService.switchCodec(device, profileName, function(success, message) {
BluetoothService.switchCodec(device, profileName, function (success, message) {
isLoading = false;
if (success) {
ToastService.showToast(message, ToastService.levelInfo);
@@ -85,8 +82,12 @@ Item {
propagateComposedEvents: false
onClicked: root.hide()
onWheel: (wheel) => { wheel.accepted = true }
onPositionChanged: (mouse) => { mouse.accepted = true }
onWheel: wheel => {
wheel.accepted = true;
}
onPositionChanged: mouse => {
mouse.accepted = true;
}
}
Rectangle {
@@ -111,8 +112,8 @@ Item {
enabled: root.visible
Keys.onEscapePressed: {
root.hide()
event.accepted = true
root.hide();
event.accepted = true;
}
}
@@ -133,9 +134,15 @@ Item {
hoverEnabled: true
preventStealing: true
propagateComposedEvents: false
onClicked: (mouse) => { mouse.accepted = true }
onWheel: (wheel) => { wheel.accepted = true }
onPositionChanged: (mouse) => { mouse.accepted = true }
onClicked: mouse => {
mouse.accepted = true;
}
onWheel: wheel => {
wheel.accepted = true;
}
onPositionChanged: mouse => {
mouse.accepted = true;
}
}
Column {
@@ -174,9 +181,7 @@ Item {
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceTextMedium
}
}
}
Rectangle {
@@ -186,7 +191,7 @@ Item {
}
StyledText {
text: isLoading ? "Loading codecs..." : `Current: ${currentCodec}`
text: isLoading ? I18n.tr("Loading codecs...") : I18n.tr("Current: %1").arg(currentCodec)
font.pixelSize: Theme.fontSizeSmall
color: isLoading ? Theme.primary : Theme.surfaceTextMedium
font.weight: Font.Medium
@@ -245,9 +250,7 @@ Item {
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceTextMedium
}
}
}
DankIcon {
@@ -271,14 +274,9 @@ Item {
selectCodec(modelData.profile);
}
}
}
}
}
}
Behavior on opacity {
@@ -286,7 +284,6 @@ Item {
duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing
}
}
Behavior on scale {
@@ -294,8 +291,6 @@ Item {
duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing
}
}
}
}

View File

@@ -113,7 +113,7 @@ Rectangle {
}
StyledText {
text: BluetoothService.adapter && BluetoothService.adapter.discovering ? "Scanning" : "Scan"
text: BluetoothService.adapter && BluetoothService.adapter.discovering ? I18n.tr("Scanning") : I18n.tr("Scan")
color: BluetoothService.adapter && BluetoothService.adapter.enabled ? Theme.primary : Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
@@ -231,7 +231,7 @@ Rectangle {
width: 200
StyledText {
text: modelData.name || modelData.deviceName || "Unknown Device"
text: modelData.name || modelData.deviceName || I18n.tr("Unknown Device")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
font.weight: modelData.connected ? Font.Medium : Font.Normal
@@ -245,15 +245,15 @@ Rectangle {
StyledText {
text: {
if (modelData.state === BluetoothDeviceState.Connecting)
return "Connecting..."
return I18n.tr("Connecting...")
if (modelData.connected) {
let status = "Connected"
let status = I18n.tr("Connected")
if (currentCodec) {
status += " • " + currentCodec
}
return status
}
return "Paired"
return I18n.tr("Paired")
}
font.pixelSize: Theme.fontSizeSmall
color: {
@@ -320,7 +320,7 @@ Rectangle {
StyledText {
text: {
const isThisDevicePinned = (SettingsData.bluetoothDevicePins || {})["preferredDevice"] === modelData.address
return isThisDevicePinned ? "Pinned" : "Pin"
return isThisDevicePinned ? I18n.tr("Pinned") : I18n.tr("Pin")
}
font.pixelSize: Theme.fontSizeSmall
color: {
@@ -458,7 +458,7 @@ Rectangle {
width: 200
StyledText {
text: modelData.name || modelData.deviceName || "Unknown Device"
text: modelData.name || modelData.deviceName || I18n.tr("Unknown Device")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
elide: Text.ElideRight
@@ -470,8 +470,8 @@ Rectangle {
StyledText {
text: {
if (modelData.pairing || isBusy) return "Pairing..."
if (modelData.blocked) return "Blocked"
if (modelData.pairing || isBusy) return I18n.tr("Pairing...")
if (modelData.blocked) return I18n.tr("Blocked")
return BluetoothService.getSignalStrength(modelData)
}
font.pixelSize: Theme.fontSizeSmall
@@ -493,9 +493,9 @@ Rectangle {
anchors.rightMargin: Theme.spacingM
anchors.verticalCenter: parent.verticalCenter
text: {
if (isBusy) return "Pairing..."
if (!canConnect) return "Cannot pair"
return "Pair"
if (isBusy) return I18n.tr("Pairing...")
if (!canConnect) return I18n.tr("Cannot pair")
return I18n.tr("Pair")
}
font.pixelSize: Theme.fontSizeSmall
color: (canConnect && !isBusy) ? Theme.primary : Theme.surfaceVariantText
@@ -546,7 +546,7 @@ Rectangle {
}
MenuItem {
text: bluetoothContextMenu.currentDevice && bluetoothContextMenu.currentDevice.connected ? "Disconnect" : "Connect"
text: bluetoothContextMenu.currentDevice && bluetoothContextMenu.currentDevice.connected ? I18n.tr("Disconnect") : I18n.tr("Connect")
height: 32
contentItem: StyledText {

View File

@@ -141,7 +141,7 @@ Rectangle {
StyledText {
anchors.horizontalCenter: parent.horizontalCenter
text: DisplayService.brightnessAvailable ? "No brightness devices available" : "Brightness control not available"
text: DisplayService.brightnessAvailable ? I18n.tr("No brightness devices available") : I18n.tr("Brightness control not available")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
horizontalAlignment: Text.AlignHCenter
@@ -173,7 +173,7 @@ Rectangle {
}
StyledText {
text: root.getScreenPinKey() || "Unknown Monitor"
text: root.getScreenPinKey() || I18n.tr("Unknown Monitor")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
@@ -201,7 +201,7 @@ Rectangle {
}
StyledText {
text: isPinnedToScreen ? "Pinned" : "Pin"
text: isPinnedToScreen ? I18n.tr("Pinned") : I18n.tr("Pin")
font.pixelSize: Theme.fontSizeSmall
color: isPinnedToScreen ? Theme.primary : Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
@@ -317,11 +317,11 @@ Rectangle {
text: {
const deviceClass = modelData.class || "";
if (deviceClass === "backlight")
return "Backlight device";
return I18n.tr("Backlight device");
if (deviceClass === "ddc")
return "DDC/CI monitor";
return I18n.tr("DDC/CI monitor");
if (deviceClass === "leds")
return "LED device";
return I18n.tr("LED device");
return deviceClass;
}
font.pixelSize: Theme.fontSizeSmall
@@ -430,7 +430,7 @@ Rectangle {
}
StyledText {
text: SessionData.getBrightnessExponential(modelData.name) ? "Exponential" : "Linear"
text: SessionData.getBrightnessExponential(modelData.name) ? I18n.tr("Exponential") : I18n.tr("Linear")
font.pixelSize: Theme.fontSizeSmall
color: SessionData.getBrightnessExponential(modelData.name) ? Theme.primary : Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter

View File

@@ -1,6 +1,4 @@
import QtQuick
import QtQuick.Controls
import Quickshell
import qs.Common
import qs.Services
import qs.Widgets
@@ -20,11 +18,11 @@ Rectangle {
border.width: 0
Component.onCompleted: {
DgopService.addRef(["diskmounts"])
DgopService.addRef(["diskmounts"]);
}
Component.onDestruction: {
DgopService.removeRef(["diskmounts"])
DgopService.removeRef(["diskmounts"]);
}
DankFlickable {
@@ -61,7 +59,7 @@ Rectangle {
StyledText {
anchors.horizontalCenter: parent.horizontalCenter
text: DgopService.dgopAvailable ? "No disk data available" : "dgop not available"
text: DgopService.dgopAvailable ? I18n.tr("No disk data available") : I18n.tr("dgop not available")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
horizontalAlignment: Text.AlignHCenter
@@ -96,20 +94,22 @@ Rectangle {
name: "storage"
size: Theme.iconSize
color: {
const percentStr = modelData.percent?.replace("%", "") || "0"
const percent = parseFloat(percentStr) || 0
if (percent > 90) return Theme.error
if (percent > 75) return Theme.warning
return modelData.mount === currentMountPath ? Theme.primary : Theme.surfaceText
const percentStr = modelData.percent?.replace("%", "") || "0";
const percent = parseFloat(percentStr) || 0;
if (percent > 90)
return Theme.error;
if (percent > 75)
return Theme.warning;
return modelData.mount === currentMountPath ? Theme.primary : Theme.surfaceText;
}
anchors.horizontalCenter: parent.horizontalCenter
}
StyledText {
text: {
const percentStr = modelData.percent?.replace("%", "") || "0"
const percent = parseFloat(percentStr) || 0
return percent.toFixed(0) + "%"
const percentStr = modelData.percent?.replace("%", "") || "0";
const percent = parseFloat(percentStr) || 0;
return percent.toFixed(0) + "%";
}
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
@@ -122,7 +122,7 @@ Rectangle {
width: parent.parent.width - parent.parent.anchors.leftMargin - parent.spacing - 50 - Theme.spacingM
StyledText {
text: modelData.mount === "/" ? "Root Filesystem" : modelData.mount
text: modelData.mount === "/" ? I18n.tr("Root Filesystem") : modelData.mount
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
font.weight: modelData.mount === currentMountPath ? Font.Medium : Font.Normal
@@ -154,11 +154,10 @@ Rectangle {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
currentMountPath = modelData.mount
mountPathChanged(modelData.mount)
currentMountPath = modelData.mount;
mountPathChanged(modelData.mount);
}
}
}
}
}

View File

@@ -118,7 +118,7 @@ Rectangle {
buttonHeight: 28
textSize: Theme.fontSizeSmall
model: ["Ethernet", "WiFi"]
model: [I18n.tr("Ethernet"), I18n.tr("WiFi")]
currentIndex: currentPreferenceIndex
selectionMode: "single"
onSelectionChanged: (index, selected) => {
@@ -173,7 +173,7 @@ Rectangle {
StyledText {
anchors.horizontalCenter: parent.horizontalCenter
text: NetworkService.wifiEnabled ? "Disabling WiFi..." : "Enabling WiFi..."
text: NetworkService.wifiEnabled ? I18n.tr("Disabling WiFi...") : I18n.tr("Enabling WiFi...")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
horizontalAlignment: Text.AlignHCenter
@@ -303,7 +303,7 @@ Rectangle {
width: 200
StyledText {
text: modelData.id || "Unknown Config"
text: modelData.id || I18n.tr("Unknown Config")
font.pixelSize: Theme.fontSizeMedium
color: modelData.isActive ? Theme.primary : Theme.surfaceText
font.weight: modelData.isActive ? Font.Medium : Font.Normal
@@ -549,7 +549,7 @@ Rectangle {
width: 200
StyledText {
text: modelData.ssid || "Unknown Network"
text: modelData.ssid || I18n.tr("Unknown Network")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
font.weight: modelData.ssid === NetworkService.currentWifiSSID ? Font.Medium : Font.Normal
@@ -561,13 +561,13 @@ Rectangle {
spacing: Theme.spacingXS
StyledText {
text: modelData.ssid === NetworkService.currentWifiSSID ? "Connected •" : (modelData.secured ? "Secured •" : "Open •")
text: modelData.ssid === NetworkService.currentWifiSSID ? I18n.tr("Connected") + " •" : (modelData.secured ? I18n.tr("Secured") + " •" : I18n.tr("Open") + " •")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: modelData.saved ? "Saved" : ""
text: modelData.saved ? I18n.tr("Saved") : ""
font.pixelSize: Theme.fontSizeSmall
color: Theme.primary
visible: text.length > 0
@@ -635,7 +635,7 @@ Rectangle {
StyledText {
text: {
const isThisNetworkPinned = (SettingsData.wifiNetworkPins || {})["preferredWifi"] === modelData.ssid;
return isThisNetworkPinned ? "Pinned" : "Pin";
return isThisNetworkPinned ? I18n.tr("Pinned") : I18n.tr("Pin");
}
font.pixelSize: Theme.fontSizeSmall
color: {
@@ -714,7 +714,7 @@ Rectangle {
}
MenuItem {
text: networkContextMenu.currentConnected ? "Disconnect" : "Connect"
text: networkContextMenu.currentConnected ? I18n.tr("Disconnect") : I18n.tr("Connect")
height: 32
contentItem: StyledText {