1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-06-08 04:09:15 -04:00

Add context to font weight keys, wrap render settings, fix uptime prefix (#2529)

* fix: i18n inconsistencies

* Update UserInfoCard.qml
This commit is contained in:
Youseffo13
2026-06-01 00:10:43 +02:00
committed by GitHub
parent 98844a3b85
commit b1ac6b0ef9
4 changed files with 36 additions and 25 deletions
@@ -60,7 +60,7 @@ Rectangle {
} }
Typography { Typography {
text: DgopService.uptime || I18n.tr("Unknown") text: DgopService.uptime ? I18n.tr("up") + " " + DgopService.uptime.slice(3) : I18n.tr("Unknown")
style: Typography.Style.Caption style: Typography.Style.Caption
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
} }
@@ -99,7 +99,9 @@ Card {
} }
StyledText { StyledText {
text: DgopService.shortUptime || I18n.tr("up") text: DgopService.shortUptime
? I18n.tr("up") + DgopService.shortUptime.slice(2)
: I18n.tr("up")
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7) color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -251,59 +251,59 @@ Item {
settingKey: "fontWeight" settingKey: "fontWeight"
text: I18n.tr("Font Weight") text: I18n.tr("Font Weight")
description: I18n.tr("Select font weight for UI text") description: I18n.tr("Select font weight for UI text")
options: [I18n.tr("Thin"), I18n.tr("Extra Light"), I18n.tr("Light"), I18n.tr("Regular"), I18n.tr("Medium"), I18n.tr("Demi Bold"), I18n.tr("Bold"), I18n.tr("Extra Bold"), I18n.tr("Black")] options: [I18n.tr("Thin", "font weight"), I18n.tr("Extra Light", "font weight"), I18n.tr("Light", "font weight"), I18n.tr("Regular", "font weight"), I18n.tr("Medium", "font weight"), I18n.tr("Demi Bold", "font weight"), I18n.tr("Bold", "font weight"), I18n.tr("Extra Bold", "font weight"), I18n.tr("Black", "font weight")]
currentValue: { currentValue: {
switch (SettingsData.fontWeight) { switch (SettingsData.fontWeight) {
case Font.Thin: case Font.Thin:
return I18n.tr("Thin"); return I18n.tr("Thin", "font weight");
case Font.ExtraLight: case Font.ExtraLight:
return I18n.tr("Extra Light"); return I18n.tr("Extra Light", "font weight");
case Font.Light: case Font.Light:
return I18n.tr("Light"); return I18n.tr("Light", "font weight");
case Font.Normal: case Font.Normal:
return I18n.tr("Regular"); return I18n.tr("Regular", "font weight");
case Font.Medium: case Font.Medium:
return I18n.tr("Medium"); return I18n.tr("Medium", "font weight");
case Font.DemiBold: case Font.DemiBold:
return I18n.tr("Demi Bold"); return I18n.tr("Demi Bold", "font weight");
case Font.Bold: case Font.Bold:
return I18n.tr("Bold"); return I18n.tr("Bold", "font weight");
case Font.ExtraBold: case Font.ExtraBold:
return I18n.tr("Extra Bold"); return I18n.tr("Extra Bold", "font weight");
case Font.Black: case Font.Black:
return I18n.tr("Black"); return I18n.tr("Black", "font weight");
default: default:
return I18n.tr("Regular"); return I18n.tr("Regular", "font weight");
} }
} }
onValueChanged: value => { onValueChanged: value => {
var weight; var weight;
switch (value) { switch (value) {
case I18n.tr("Thin"): case I18n.tr("Thin", "font weight"):
weight = Font.Thin; weight = Font.Thin;
break; break;
case I18n.tr("Extra Light"): case I18n.tr("Extra Light", "font weight"):
weight = Font.ExtraLight; weight = Font.ExtraLight;
break; break;
case I18n.tr("Light"): case I18n.tr("Light", "font weight"):
weight = Font.Light; weight = Font.Light;
break; break;
case I18n.tr("Regular"): case I18n.tr("Regular", "font weight"):
weight = Font.Normal; weight = Font.Normal;
break; break;
case I18n.tr("Medium"): case I18n.tr("Medium", "font weight"):
weight = Font.Medium; weight = Font.Medium;
break; break;
case I18n.tr("Demi Bold"): case I18n.tr("Demi Bold", "font weight"):
weight = Font.DemiBold; weight = Font.DemiBold;
break; break;
case I18n.tr("Bold"): case I18n.tr("Bold", "font weight"):
weight = Font.Bold; weight = Font.Bold;
break; break;
case I18n.tr("Extra Bold"): case I18n.tr("Extra Bold", "font weight"):
weight = Font.ExtraBold; weight = Font.ExtraBold;
break; break;
case I18n.tr("Black"): case I18n.tr("Black", "font weight"):
weight = Font.Black; weight = Font.Black;
break; break;
default: default:
@@ -347,7 +347,7 @@ Item {
buttonPadding: parent.width < 480 ? Theme.spacingS : Theme.spacingL buttonPadding: parent.width < 480 ? Theme.spacingS : Theme.spacingL
minButtonWidth: parent.width < 480 ? 64 : 96 minButtonWidth: parent.width < 480 ? 64 : 96
textSize: parent.width < 480 ? Theme.fontSizeSmall : Theme.fontSizeMedium textSize: parent.width < 480 ? Theme.fontSizeSmall : Theme.fontSizeMedium
model: ["Native", "Qt", "Curve"] model: [I18n.tr("Native"), I18n.tr("Qt"), I18n.tr("Curve")]
selectionMode: "single" selectionMode: "single"
currentIndex: { currentIndex: {
switch (SettingsData.textRenderType) { switch (SettingsData.textRenderType) {
@@ -455,7 +455,7 @@ Item {
buttonPadding: parent.width < 480 ? Theme.spacingXS : Theme.spacingS buttonPadding: parent.width < 480 ? Theme.spacingXS : Theme.spacingS
minButtonWidth: parent.width < 480 ? 40 : 56 minButtonWidth: parent.width < 480 ? 40 : 56
textSize: parent.width < 480 ? Theme.fontSizeSmall : Theme.fontSizeMedium textSize: parent.width < 480 ? Theme.fontSizeSmall : Theme.fontSizeMedium
model: ["Default", "Low", "Normal", "High", "Very High"] model: [I18n.tr("Default"), I18n.tr("Low"), I18n.tr("Normal"), I18n.tr("High"), I18n.tr("Very High")]
selectionMode: "single" selectionMode: "single"
currentIndex: SettingsData.textRenderQuality currentIndex: SettingsData.textRenderQuality
onSelectionChanged: (index, selected) => { onSelectionChanged: (index, selected) => {
@@ -22,6 +22,15 @@ FloatingWindow {
signal widgetSelected(string widgetId, string targetSection) signal widgetSelected(string widgetId, string targetSection)
function translateSection(section) {
switch (section.toLowerCase()) {
case "left": return I18n.tr("Left Section");
case "center": return I18n.tr("Center Section");
case "right": return I18n.tr("Right Section");
default: return section;
}
}
function updateFilteredWidgets() { function updateFilteredWidgets() {
if (!searchQuery || searchQuery.length === 0) { if (!searchQuery || searchQuery.length === 0) {
filteredWidgets = allWidgets.slice(); filteredWidgets = allWidgets.slice();
@@ -224,7 +233,7 @@ FloatingWindow {
} }
StyledText { StyledText {
text: I18n.tr("Add Widget to %1 Section").arg(root.targetSection) text: I18n.tr("Add Widget to %1").arg(translateSection(root.targetSection))
font.pixelSize: Theme.fontSizeXLarge font.pixelSize: Theme.fontSizeXLarge
color: Theme.surfaceText color: Theme.surfaceText
font.weight: Font.Medium font.weight: Font.Medium