Translate finished messages by template and the world clock, Dropbox and scoped titles at display
This commit is contained in:
1 parent
2b2302a279
commit
f63ecb6697
13 files changed
+139
-28
No files matched your search
@@ -455,11 +455,11 @@ Panel {
|
||||
return text
|
||||
}
|
||||
|
||||
// omarchy-agent-account-add reports progress in English around the agent's name.
|
||||
readonly property var addMessageTemplates: [
|
||||
"Installing the %1 CLI…", "Sign in to %1 again in the browser window that opens.", "Sign in to %1 in the browser window that opens.",
|
||||
"Signed in to %1 again.", "Signed in to %1.", "The %1 sign-in didn't finish.", "Added %1."
|
||||
]
|
||||
// A model-scoped title ("Opus Monthly") keeps the model and translates the window.
|
||||
function windowLabel(title) {
|
||||
var match = String(title || "").match(/^(.*\S)\s+(Monthly|Weekly|Session|Limit)$/)
|
||||
return match ? match[1] + " " + I18n.tr(match[2]) : I18n.tr(String(title || ""))
|
||||
}
|
||||
|
||||
function planLabel(p) {
|
||||
var tier = String(p && p.tierLabel || "")
|
||||
@@ -1173,7 +1173,7 @@ Panel {
|
||||
Text {
|
||||
width: parent.width
|
||||
textFormat: Text.PlainText
|
||||
text: I18n.trMatch(root.addStatus, root.addMessageTemplates)
|
||||
text: I18n.trMessage(root.addStatus)
|
||||
color: root.foreground
|
||||
font.family: root.fontFamily
|
||||
font.pixelSize: Style.font.bodySmall
|
||||
@@ -1243,7 +1243,7 @@ Panel {
|
||||
visible: root.addStage === "done" || root.addStage === "error"
|
||||
width: parent.width
|
||||
textFormat: Text.PlainText
|
||||
text: I18n.trMatch(root.addResult, root.addMessageTemplates)
|
||||
text: I18n.trMessage(root.addResult)
|
||||
color: root.addStage === "error" ? root.urgent : root.foreground
|
||||
font.family: root.fontFamily
|
||||
font.pixelSize: Style.font.bodySmall
|
||||
@@ -1350,7 +1350,7 @@ Panel {
|
||||
width: parent.width
|
||||
textFormat: Text.PlainText
|
||||
// Shown for the status, so a record with no help to offer says the status rather than nothing.
|
||||
text: section.provider ? I18n.tr(String(section.provider.authHelpText || section.provider.usageStatusText || "")) : ""
|
||||
text: section.provider ? I18n.trMessage(String(section.provider.authHelpText || section.provider.usageStatusText || "")) : ""
|
||||
color: root.urgent
|
||||
font.family: root.fontFamily
|
||||
font.pixelSize: Style.font.caption
|
||||
@@ -1879,7 +1879,7 @@ Panel {
|
||||
|
||||
PanelToolTip {
|
||||
visible: unavailableHover.hovered && unavailable.visible
|
||||
text: unavailable.record ? I18n.tr(String(unavailable.record.authHelpText || "Usage has not been updated yet.")) : ""
|
||||
text: unavailable.record ? I18n.trMessage(String(unavailable.record.authHelpText || "Usage has not been updated yet.")) : ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1904,7 +1904,7 @@ Panel {
|
||||
text: {
|
||||
var lines = []
|
||||
if (compact.window) {
|
||||
lines.push(I18n.tr("%1: %2% used", I18n.tr(compact.window.title), Math.round(compact.window.percent * 100))
|
||||
lines.push(I18n.tr("%1: %2% used", root.windowLabel(compact.window.title), Math.round(compact.window.percent * 100))
|
||||
+ (compact.resetMs > 0 ? " · " + I18n.tr("resets in %1", root.formatDuration(compact.resetMs)) : ""))
|
||||
}
|
||||
if (compact.stale)
|
||||
@@ -1912,8 +1912,8 @@ Panel {
|
||||
? I18n.tr("Last updated %1 ago", root.formatDuration(root.nowMs - compact.fetchedAt))
|
||||
: compact.fetchedAt > 0 ? I18n.tr("Last updated less than a minute ago") : I18n.tr("Last updated time unavailable"))
|
||||
for (var i = 0; i < compact.scoped.length; i++)
|
||||
lines.push(I18n.tr("%1: %2% of its %3 allowance", I18n.tr(compact.scoped[i].title), Math.round(compact.scoped[i].percent * 100),
|
||||
I18n.tr(String(compact.window ? compact.window.title : "")).toLowerCase()))
|
||||
lines.push(I18n.tr("%1: %2% of its %3 allowance", root.windowLabel(compact.scoped[i].title), Math.round(compact.scoped[i].percent * 100),
|
||||
root.windowLabel(compact.window ? compact.window.title : "").toLowerCase()))
|
||||
return lines.join("\n")
|
||||
}
|
||||
}
|
||||
@@ -1923,7 +1923,7 @@ Panel {
|
||||
textFormat: Text.PlainText
|
||||
width: parent.width * 0.3
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: compact.window ? I18n.tr(compact.window.title) : ""
|
||||
text: compact.window ? root.windowLabel(compact.window.title) : ""
|
||||
color: root.foreground
|
||||
font.family: root.fontFamily
|
||||
font.pixelSize: Style.font.bodySmall
|
||||
|
||||
Reference in new issue
Block a user