Some changes for the notification layout & localize timestamps

This commit is contained in:
notiant
2025-11-23 00:51:04 +01:00
committed by GitHub
parent 1ff64efc64
commit e34248d5cb
14 changed files with 135 additions and 22 deletions
+14 -5
View File
@@ -504,7 +504,7 @@
"password": "Passwort eingeben...", "password": "Passwort eingeben...",
"restart": "Neu starten", "restart": "Neu starten",
"shut-down": "Herunterfahren", "shut-down": "Herunterfahren",
"suspend": "Ruhezustand", "suspend": "Energie sparen",
"welcome-back": "Willkommen zurück," "welcome-back": "Willkommen zurück,"
}, },
"notifications": { "notifications": {
@@ -513,6 +513,15 @@
"description": "Ihre Benachrichtigungen werden hier angezeigt, sobald sie eintreffen.", "description": "Ihre Benachrichtigungen werden hier angezeigt, sobald sie eintreffen.",
"no-notifications": "Keine Benachrichtigungen", "no-notifications": "Keine Benachrichtigungen",
"title": "Benachrichtigungen" "title": "Benachrichtigungen"
},
"time": {
"now": "jetzt",
"diffM": "vor 1 Minute",
"diffMM": "vor {diff} Minuten",
"diffH": "vor 1 Stunde",
"diffHH": "vor {diff} Stunden",
"diffD": "vor 1 Tag",
"diffDD": "vor {diff} Tagen"
} }
}, },
"options": { "options": {
@@ -763,11 +772,11 @@
"action-in-seconds": "{action} in {seconds} Sekunden...", "action-in-seconds": "{action} in {seconds} Sekunden...",
"hibernate": "Ruhezustand", "hibernate": "Ruhezustand",
"lock": "Sperren", "lock": "Sperren",
"lock-and-suspend": "Sperren und Ruhezustand", "lock-and-suspend": "Sperren und Energie sparen",
"logout": "Abmelden", "logout": "Abmelden",
"reboot": "Neu starten", "reboot": "Neu starten",
"shutdown": "Herunterfahren", "shutdown": "Herunterfahren",
"suspend": "Energiesparmodus", "suspend": "Energie sparen",
"title": "Sitzungsmenü" "title": "Sitzungsmenü"
}, },
"settings": { "settings": {
@@ -1521,8 +1530,8 @@
"label": "Kompakter Sperrbildschirm" "label": "Kompakter Sperrbildschirm"
}, },
"lock-on-suspend": { "lock-on-suspend": {
"description": "Den Bildschirm beim Suspendieren des Systems automatisch sperren.", "description": "Den Bildschirm beim Energiesparen automatisch sperren.",
"label": "Sperren beim Ruhezustand" "label": "Sperren beim Energiesparen"
}, },
"show-hibernate": { "show-hibernate": {
"description": "Die Option 'Ruhezustand' in den Energieaktionen anzeigen.", "description": "Die Option 'Ruhezustand' in den Energieaktionen anzeigen.",
+9
View File
@@ -513,6 +513,15 @@
"description": "Your notifications will show up here as they arrive.", "description": "Your notifications will show up here as they arrive.",
"no-notifications": "No notifications", "no-notifications": "No notifications",
"title": "Notifications" "title": "Notifications"
},
"time": {
"now": "now",
"diffM": "1 minute ago",
"diffMM": "{diff} minutes ago",
"diffH": "1 hour ago",
"diffHH": "{diff} hours ago",
"diffD": "1 day ago",
"diffDD": "{diff} days ago"
} }
}, },
"options": { "options": {
+9
View File
@@ -513,6 +513,15 @@
"description": "Tus notificaciones aparecerán aquí a medida que lleguen.", "description": "Tus notificaciones aparecerán aquí a medida que lleguen.",
"no-notifications": "No hay notificaciones", "no-notifications": "No hay notificaciones",
"title": "Notificaciones" "title": "Notificaciones"
},
"time": {
"now": "ahora",
"diffM": "hace 1 minuto",
"diffMM": "hace {diff} minutos",
"diffH": "hace 1 hora",
"diffHH": "hace {diff} horas",
"diffD": "hace 1 día",
"diffDD": "hace {diff} días"
} }
}, },
"options": { "options": {
+9
View File
@@ -513,6 +513,15 @@
"description": "Vos notifications apparaîtront ici à mesure qu'elles arriveront.", "description": "Vos notifications apparaîtront ici à mesure qu'elles arriveront.",
"no-notifications": "Aucune notification", "no-notifications": "Aucune notification",
"title": "Notifications" "title": "Notifications"
},
"time": {
"now": "maintenant",
"diffM": "il y a 1 minute",
"diffMM": "il y a {diff} minutes",
"diffH": "il y a 1 heure",
"diffHH": "il y a {diff} heures",
"diffD": "il y a 1 jour",
"diffDD": "il y a {diff} jours"
} }
}, },
"options": { "options": {
+9
View File
@@ -513,6 +513,15 @@
"description": "Je meldingen verschijnen hier zodra ze binnenkomen.", "description": "Je meldingen verschijnen hier zodra ze binnenkomen.",
"no-notifications": "Geen meldingen", "no-notifications": "Geen meldingen",
"title": "Meldingen" "title": "Meldingen"
},
"time": {
"now": "nu",
"diffM": "1 minuut geleden",
"diffMM": "{diff} minuten geleden",
"diffH": "1 uur geleden",
"diffHH": "{diff} uur geleden",
"diffD": "1 dag geleden",
"diffDD": "{diff} dagen geleden"
} }
}, },
"options": { "options": {
+9
View File
@@ -513,6 +513,15 @@
"description": "Suas notificações aparecerão aqui assim que chegarem.", "description": "Suas notificações aparecerão aqui assim que chegarem.",
"no-notifications": "Nenhuma notificação", "no-notifications": "Nenhuma notificação",
"title": "Notificações" "title": "Notificações"
},
"time": {
"now": "agora",
"diffM": "há 1 minuto",
"diffMM": "há {diff} minutos",
"diffH": "há 1 hora",
"diffHH": "há {diff} horas",
"diffD": "há 1 dia",
"diffDD": "há {diff} dias"
} }
}, },
"options": { "options": {
+9
View File
@@ -513,6 +513,15 @@
"description": "Ваши уведомления будут появляться здесь по мере их поступления.", "description": "Ваши уведомления будут появляться здесь по мере их поступления.",
"no-notifications": "Нет уведомлений", "no-notifications": "Нет уведомлений",
"title": "Уведомления" "title": "Уведомления"
},
"time": {
"now": "сейчас",
"diffM": "1 минуту назад",
"diffMM": "{diff} минут назад",
"diffH": "1 час назад",
"diffHH": "{diff} часов назад",
"diffD": "1 день назад",
"diffDD": "{diff} дней назад"
} }
}, },
"options": { "options": {
+9
View File
@@ -513,6 +513,15 @@
"description": "Bildirimler geldikçe burada görünecek.", "description": "Bildirimler geldikçe burada görünecek.",
"no-notifications": "Bildirim yok", "no-notifications": "Bildirim yok",
"title": "Bildirimler" "title": "Bildirimler"
},
"time": {
"now": "şimdi",
"diffM": "1 dakika önce",
"diffMM": "{diff} dakika önce",
"diffH": "1 saat önce",
"diffHH": "{diff} saat önce",
"diffD": "1 gün önce",
"diffDD": "{diff} gün önce"
} }
}, },
"options": { "options": {
+9
View File
@@ -513,6 +513,15 @@
"description": "Ваші сповіщення з'являтимуться тут по мірі надходження.", "description": "Ваші сповіщення з'являтимуться тут по мірі надходження.",
"no-notifications": "Немає сповіщень", "no-notifications": "Немає сповіщень",
"title": "Сповіщення" "title": "Сповіщення"
},
"time": {
"now": "зараз",
"diffM": "1 хвилину тому",
"diffMM": "{diff} хвилин тому",
"diffH": "1 годину тому",
"diffHH": "{diff} годин тому",
"diffD": "1 день тому",
"diffDD": "{diff} днів тому"
} }
}, },
"options": { "options": {
+9
View File
@@ -513,6 +513,15 @@
"description": "您的通知将在到达时显示在此处。", "description": "您的通知将在到达时显示在此处。",
"no-notifications": "无通知", "no-notifications": "无通知",
"title": "通知" "title": "通知"
},
"time": {
"now": "现在",
"diffM": "1 分钟前",
"diffMM": "{diff} 分钟前",
"diffH": "1 小时前",
"diffHH": "{diff} 小时前",
"diffD": "1 天前",
"diffDD": "{diff} 天前"
} }
}, },
"options": { "options": {
+16 -4
View File
@@ -100,11 +100,23 @@ Singleton {
return ""; return "";
const diff = Date.now() - date.getTime(); const diff = Date.now() - date.getTime();
if (diff < 60000) if (diff < 60000)
return "now"; return I18n.tr("notifications.time.now");
if (diff < 120000)
return I18n.tr("notifications.time.diffM");
if (diff < 3600000) if (diff < 3600000)
return `${Math.floor(diff / 60000)}m ago`; return I18n.tr("notifications.time.diffMM", {
"diff": Math.floor(diff / 60000)
});
if (diff < 7200000)
return I18n.tr("notifications.time.diffH");
if (diff < 86400000) if (diff < 86400000)
return `${Math.floor(diff / 3600000)}h ago`; return I18n.tr("notifications.time.diffHH", {
return `${Math.floor(diff / 86400000)}d ago`; "diff": Math.floor(diff / 3600000)
});
if (diff < 172800000)
return I18n.tr("notifications.time.diffD");
return I18n.tr("notifications.time.diffDD", {
"diff": Math.floor(diff / 86400000)
});
} }
} }
+16 -8
View File
@@ -393,23 +393,22 @@ Variants {
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
spacing: Style.marginL spacing: Style.marginL
Layout.margins: Style.marginM Layout.leftMargin: Style.marginM * 2
Layout.rightMargin: Style.marginM * 2
Layout.topMargin: Style.marginM
Layout.bottomMargin: Style.marginM
ColumnLayout { ColumnLayout {
NImageCircled { NImageCircled {
Layout.preferredWidth: Math.round(40 * Style.uiScaleRatio) Layout.preferredWidth: Math.round(40 * Style.uiScaleRatio)
Layout.preferredHeight: Math.round(40 * Style.uiScaleRatio) Layout.preferredHeight: Math.round(40 * Style.uiScaleRatio)
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignVCenter
Layout.topMargin: 30
imagePath: model.originalImage || "" imagePath: model.originalImage || ""
borderColor: Color.transparent borderColor: Color.transparent
borderWidth: 0 borderWidth: 0
fallbackIcon: "bell" fallbackIcon: "bell"
fallbackIconSize: 24 fallbackIconSize: 24
} }
Item {
Layout.fillHeight: true
}
} }
ColumnLayout { ColumnLayout {
@@ -430,9 +429,18 @@ Variants {
} }
NText { NText {
text: `${model.appName || I18n.tr("system.unknown-app")} · ${Time.formatRelativeTime(model.timestamp)}` text: model.appName || "Unknown App"
color: Color.mSecondary
pointSize: Style.fontSizeXS pointSize: Style.fontSizeXS
font.weight: Style.fontWeightBold
color: Color.mSecondary
}
NText {
textFormat: Text.PlainText
text: " " + Time.formatRelativeTime(model.timestamp)
pointSize: Style.fontSizeXXS
color: Color.mOnSurfaceVariant
anchors.bottom: parent.bottom
} }
Item { Item {
@@ -238,13 +238,16 @@ SmartPanel {
NText { NText {
text: model.appName || "Unknown App" text: model.appName || "Unknown App"
pointSize: Style.fontSizeXS pointSize: Style.fontSizeXS
font.weight: Style.fontWeightBold
color: Color.mSecondary color: Color.mSecondary
} }
NText { NText {
text: Time.formatRelativeTime(model.timestamp) textFormat: Text.PlainText
pointSize: Style.fontSizeXS text: " " + Time.formatRelativeTime(model.timestamp)
color: Color.mSecondary pointSize: Style.fontSizeXXS
color: Color.mOnSurfaceVariant
anchors.bottom: parent.bottom
} }
} }
+2 -2
View File
@@ -100,9 +100,9 @@ Item {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: Style.marginM anchors.bottomMargin: Style.marginM
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Style.marginM * 2 anchors.leftMargin: Style.marginM * 3
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: Style.marginM * 2 anchors.rightMargin: Style.marginM * 3
spacing: Style.marginL spacing: Style.marginL
// Icon // Icon