Translate finished messages by template and the world clock, Dropbox and scoped titles at display

This commit is contained in:
ZacharyZhang-NY committed 2026-10-06 22:07:19 -04:00
1 parent 2b2302a279
commit f63ecb6697
13 files changed
+139 -28

No files matched your search

+12 -2
View File
@@ -11,6 +11,16 @@ import "Greetings.js" as Greet
Rectangle {
id: row
// Model.formatDate reads "Tue Oct 6"; a Chinese session reads 10月6日 周二.
function dateText(date) {
var match = String(date).match(/^(\w{3}) (\w{3}) (\d+)$/)
if (!I18n.chinese || !match) return date
var month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"].indexOf(match[2]) + 1
var weekday = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"].indexOf(match[1])
if (month < 1 || weekday < 0) return date
return month + "月" + match[3] + "日 " + ["周日", "周一", "周二", "周三", "周四", "周五", "周六"][weekday]
}
required property var modelData
required property int index
// The owning Panel: the row reads its clock, facts and drag state.
@@ -222,7 +232,7 @@ Rectangle {
Behavior on opacity { NumberAnimation { duration: Style.duration(110) } }
Caption {
text: row.ready ? row.rowData.date : "\u2026"
text: row.ready ? row.dateText(row.rowData.date) : "\u2026"
color: row.ready && row.rowData.dayLabel !== "" ? row.dim : row.fainter
}
@@ -233,7 +243,7 @@ Rectangle {
}
Caption {
text: row.ready ? row.rowData.dayLabel : ""
text: row.ready ? I18n.tr(row.rowData.dayLabel) : ""
visible: text !== ""
}
}