Translate the remaining shell text at display and keep translated values out of logic

This commit is contained in:
ZacharyZhang-NY committed 2026-10-06 21:50:11 -04:00
1 parent e236713d9f
commit 2b2302a279
17 files changed
+112 -25

No files matched your search

+26 -14
View File
@@ -449,12 +449,18 @@ Panel {
function resetCreditsText(credits) {
if (!credits || !(Number(credits.available) > 0)) return ""
var count = Number(credits.available)
var text = count + " free reset" + (count === 1 ? "" : "s")
var text = I18n.tr(count === 1 ? "%1 free reset" : "%1 free resets", count)
var expires = new Date(String(credits.nextExpiresAt || "")).getTime()
if (isFinite(expires) && expires > nowMs) text += " · next expires in " + formatDuration(expires - nowMs)
if (isFinite(expires) && expires > nowMs) text += " · " + I18n.tr("next expires in %1", formatDuration(expires - nowMs))
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."
]
function planLabel(p) {
var tier = String(p && p.tierLabel || "")
return tier === "" ? "" : tier.charAt(0).toUpperCase() + tier.slice(1)
@@ -491,11 +497,11 @@ Panel {
function windowTitle(label) {
var text = String(label || "").toLowerCase()
if (text.indexOf("month") >= 0) return I18n.tr("Monthly")
if (windowIsLong(text)) return I18n.tr("Weekly")
if (text.indexOf("session") >= 0 || windowSpanMs(label) > 0) return I18n.tr("Session")
if (text.indexOf("month") >= 0) return "Monthly"
if (windowIsLong(text)) return "Weekly"
if (text.indexOf("session") >= 0 || windowSpanMs(label) > 0) return "Session"
var plain = String(label || "").replace(/\s*\(.*\)\s*/, "").trim()
return plain === "" ? I18n.tr("Limit") : plain
return plain === "" ? "Limit" : plain
}
// A collector that already knows which window a limit belongs to says so,
@@ -1064,6 +1070,7 @@ Panel {
Text {
visible: root.blankSlate && root.picking
width: parent.width
textFormat: Text.PlainText
text: I18n.tr("Sign in to an AI coding subscription, and this panel keeps track of how much of it you have left.")
color: root.dim
font.family: root.fontFamily
@@ -1136,6 +1143,7 @@ Panel {
Text {
width: parent.width
textFormat: Text.PlainText
text: I18n.tr("Name this account. It signs in through a private window, so your browser's current account isn't picked up.")
color: root.dim
font.family: root.fontFamily
@@ -1165,7 +1173,7 @@ Panel {
Text {
width: parent.width
textFormat: Text.PlainText
text: root.addStatus
text: I18n.trMatch(root.addStatus, root.addMessageTemplates)
color: root.foreground
font.family: root.fontFamily
font.pixelSize: Style.font.bodySmall
@@ -1178,6 +1186,7 @@ Panel {
spacing: Style.space(4)
Text {
textFormat: Text.PlainText
text: I18n.tr("Confirm this code in your browser")
color: root.dim
font.family: root.fontFamily
@@ -1202,6 +1211,7 @@ Panel {
Text {
width: parent.width
textFormat: Text.PlainText
text: I18n.tr("If the page shows a code instead of finishing, paste it here.")
color: root.dim
font.family: root.fontFamily
@@ -1233,7 +1243,7 @@ Panel {
visible: root.addStage === "done" || root.addStage === "error"
width: parent.width
textFormat: Text.PlainText
text: root.addResult
text: I18n.trMatch(root.addResult, root.addMessageTemplates)
color: root.addStage === "error" ? root.urgent : root.foreground
font.family: root.fontFamily
font.pixelSize: Style.font.bodySmall
@@ -1340,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 ? String(section.provider.authHelpText || section.provider.usageStatusText || "") : ""
text: section.provider ? I18n.tr(String(section.provider.authHelpText || section.provider.usageStatusText || "")) : ""
color: root.urgent
font.family: root.fontFamily
font.pixelSize: Style.font.caption
@@ -1809,6 +1819,7 @@ Panel {
id: headActive
visible: head.isActive
anchors.right: parent.right
textFormat: Text.PlainText
text: I18n.tr("ACTIVE")
color: Color.accent
font.family: root.fontFamily
@@ -1857,6 +1868,7 @@ Panel {
Text {
id: unavailableLabel
textFormat: Text.PlainText
text: I18n.tr("Usage unavailable")
color: root.dim
font.family: root.fontFamily
@@ -1867,7 +1879,7 @@ Panel {
PanelToolTip {
visible: unavailableHover.hovered && unavailable.visible
text: unavailable.record ? String(unavailable.record.authHelpText || I18n.tr("Usage has not been updated yet.")) : ""
text: unavailable.record ? I18n.tr(String(unavailable.record.authHelpText || "Usage has not been updated yet.")) : ""
}
}
@@ -1892,7 +1904,7 @@ Panel {
text: {
var lines = []
if (compact.window) {
lines.push(I18n.tr("%1: %2% used", compact.window.title, Math.round(compact.window.percent * 100))
lines.push(I18n.tr("%1: %2% used", I18n.tr(compact.window.title), Math.round(compact.window.percent * 100))
+ (compact.resetMs > 0 ? " · " + I18n.tr("resets in %1", root.formatDuration(compact.resetMs)) : ""))
}
if (compact.stale)
@@ -1900,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", compact.scoped[i].title, Math.round(compact.scoped[i].percent * 100),
String(compact.window ? compact.window.title : "").toLowerCase()))
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()))
return lines.join("\n")
}
}
@@ -1911,7 +1923,7 @@ Panel {
textFormat: Text.PlainText
width: parent.width * 0.3
anchors.verticalCenter: parent.verticalCenter
text: compact.window ? compact.window.title : ""
text: compact.window ? I18n.tr(compact.window.title) : ""
color: root.foreground
font.family: root.fontFamily
font.pixelSize: Style.font.bodySmall