Add Simplified Chinese as a system language
The installer asks for the language before the keyboard, and Setup > Language (omarchy language en|zh) switches it later. Under zh_CN the menu reads its labels from omarchy-menu.zh-cn.jsonc, the shell from I18nZh.js through I18n.tr, and notifications are worded by their sender through omarchy-text, which reads the same table. User text is never translated.
This commit is contained in:
138 files changed
+1986
-558
No files matched your search
@@ -73,7 +73,7 @@ Column {
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
topPadding: Style.spacing.md
|
||||
text: list.citySearch.loading ? list.citySearch.loadingText : "No matches"
|
||||
text: list.citySearch.loading ? list.citySearch.loadingText : I18n.tr("No matches")
|
||||
color: list.citySearch.fainter
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,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.
|
||||
@@ -223,7 +233,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
|
||||
}
|
||||
|
||||
@@ -234,7 +244,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
Caption {
|
||||
text: row.ready ? row.rowData.dayLabel : ""
|
||||
text: row.ready ? I18n.trMatch(row.rowData.dayLabel, ["Tomorrow", "Yesterday", "+%1 days", "%1 days"]) : ""
|
||||
visible: text !== ""
|
||||
}
|
||||
}
|
||||
@@ -301,7 +311,7 @@ Rectangle {
|
||||
color: Model.mix(Commons.Color.popups.background, row.foreground, _hot ? 0.24 : 0.14)
|
||||
borderSpec: Border.flat(Model.mix(Commons.Color.popups.background, row.foreground, _hot ? 0.65 : 0.35), Style.space(1))
|
||||
iconText: "\u00d7"
|
||||
tooltipText: "Remove"
|
||||
tooltipText: I18n.tr("Remove")
|
||||
foreground: row.dim
|
||||
hoverColor: row.foreground
|
||||
fontFamily: row.fontFamily
|
||||
|
||||
@@ -17,9 +17,9 @@ Column {
|
||||
// Zone id -> offset text; read inside a binding, so its dependencies track.
|
||||
property var offsetLabel: function(zoneId) { return "" }
|
||||
property bool loading: false
|
||||
property string buttonText: "+ Add a city"
|
||||
property string placeholderText: "Search cities\u2026"
|
||||
property string loadingText: "Loading zones\u2026"
|
||||
property string buttonText: "+ " + I18n.tr("Add a city")
|
||||
property string placeholderText: I18n.tr("Search cities…")
|
||||
property string loadingText: I18n.tr("Loading zones…")
|
||||
property real fontSize: Style.font.bodySmall
|
||||
property color foreground: Commons.Color.foreground
|
||||
property color dim: Qt.darker(foreground, 1.55)
|
||||
|
||||
@@ -66,8 +66,8 @@ Item {
|
||||
var out = []
|
||||
var up = Sun.eventMark(sun.riseMinutes)
|
||||
var down = Sun.eventMark(sun.setMinutes)
|
||||
if (up !== null) out.push({ x: up, minutes: sun.riseMinutes, rising: true, name: "Sunrise" })
|
||||
if (down !== null) out.push({ x: down, minutes: sun.setMinutes, rising: false, name: "Sunset" })
|
||||
if (up !== null) out.push({ x: up, minutes: sun.riseMinutes, rising: true, name: I18n.tr("Sunrise") })
|
||||
if (down !== null) out.push({ x: down, minutes: sun.setMinutes, rising: false, name: I18n.tr("Sunset") })
|
||||
return out
|
||||
}
|
||||
|
||||
|
||||
@@ -585,8 +585,8 @@ Item {
|
||||
limit: 5
|
||||
inlineResults: false
|
||||
loading: root.jumpOptions.length === 0
|
||||
buttonText: "Jump to a city"
|
||||
loadingText: "Loading cities\u2026"
|
||||
buttonText: I18n.tr("Jump to a city")
|
||||
loadingText: I18n.tr("Loading cities…")
|
||||
offsetLabel: function(zoneId) { return Model.utcOffsetLabel(root.offsets[zoneId]) }
|
||||
foreground: root.foreground
|
||||
dim: root.dim
|
||||
|
||||
@@ -73,7 +73,7 @@ Column {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: Style.space(9)
|
||||
|
||||
TitleWord { text: "World" }
|
||||
TitleWord { text: I18n.tr("World") }
|
||||
|
||||
Item {
|
||||
id: heroIcon
|
||||
@@ -151,7 +151,7 @@ Column {
|
||||
}
|
||||
}
|
||||
|
||||
TitleWord { text: "Clock" }
|
||||
TitleWord { text: I18n.tr("Clock") }
|
||||
}
|
||||
|
||||
component TitleWord: Text {
|
||||
|
||||
@@ -335,8 +335,8 @@ Panel {
|
||||
}
|
||||
|
||||
// No full stop: a period hanging off the arc reads as a speck.
|
||||
readonly property string hereLine: "It's " + localTime + " here"
|
||||
+ (homeCity !== "" ? " in " + homeCity : "")
|
||||
readonly property string hereLine: I18n.tr("It's %1 here", localTime)
|
||||
+ (homeCity !== "" ? I18n.tr(" in %1", homeCity) : "")
|
||||
+ (scrubLabel !== "" ? " " + scrubLabel : "")
|
||||
|
||||
// A capital's line box has empty space above it; the row's top pad drops by it.
|
||||
@@ -715,7 +715,7 @@ Panel {
|
||||
bar: root.bar
|
||||
slotSize: Style.bar.statusSlot
|
||||
text: ""
|
||||
tooltipText: "World clock"
|
||||
tooltipText: I18n.tr("World clock")
|
||||
onPressed: function(buttonCode) {
|
||||
if (buttonCode === Qt.RightButton || buttonCode === Qt.MiddleButton) root.refresh()
|
||||
else root.toggle()
|
||||
|
||||
Reference in new issue
Block a user