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:
ZacharyZhang-NY committed 2026-10-12 02:56:40 -04:00
1 parent defbf90e89
commit a9b39710a2
138 files changed
+1986 -558

No files matched your search

+5 -3
View File
@@ -21,7 +21,7 @@ BarWidget {
: setting("format", "dddd HH:mm")
readonly property string configuredAltFormat: vertical
? setting("verticalFormatAlt", "dd\nMMM\n'W'ww\n''yy")
: setting("formatAlt", "d MMMM 'W'ww yyyy")
: setting("formatAlt", I18n.chinese ? "yyyy年M月d日 'W'ww" : "d MMMM 'W'ww yyyy")
readonly property var formatRing: Model.clockFormatRing(configuredFormat, configuredAltFormat, Model.clockFormats(vertical))
@@ -56,8 +56,10 @@ BarWidget {
root.bar.shell.updateEntryInline(root.moduleName, entry)
}
// Qt.formatDateTime is always English; a Chinese session takes day and month names from its locale.
function formatted(date) {
return Qt.formatDateTime(date, activeFormat.replace(/ww/g, Model.isoWeekLiteral(date.getFullYear(), date.getMonth(), date.getDate())))
var format = activeFormat.replace(/ww/g, Model.isoWeekLiteral(date.getFullYear(), date.getMonth(), date.getDate()))
return I18n.chinese ? Qt.locale().toString(date, format) : Qt.formatDateTime(date, format)
}
// ---- Calendar popup. Shape contract for shell.summon/hide/toggle
@@ -153,7 +155,7 @@ BarWidget {
fixedHeight: root.vertical ? root.verticalLines.length * Style.bar.iconSlot : -1
horizontalMargin: 8.75
verticalPadding: 8.75
tooltipText: "Right-click to toggle format"
tooltipText: I18n.tr("Right-click to toggle format")
onPressed: function(b) {
if (b === Qt.RightButton) root.cycleFormat()
+15 -14
View File
@@ -67,10 +67,8 @@ Panel {
// convention. Clicking the grid's "W" heading writes the choice back to
// shell.json.
readonly property int weekStart: Model.normalizedWeekStart(setting("weekStartDay", null), Qt.locale().firstDayOfWeek)
// The interface is English throughout, so day names are not taken from the
// system locale. Where the week starts still is: that is a regional
// convention rather than a translation, and it stays overridable above.
readonly property var labelLocale: Qt.locale("en_US")
// Day names follow the interface language, not the system locale; the week start above is a regional convention.
readonly property var labelLocale: I18n.chinese ? Qt.locale("zh_CN") : Qt.locale("en_US")
readonly property string nextWeekStartLabel: labelLocale.dayName(Model.toggledWeekStart(weekStart), Locale.LongFormat)
readonly property var weekdays: Model.weekdayOrder(weekStart)
readonly property var weeks: Model.monthGrid(viewYear, viewMonth, weekStart, todayKey)
@@ -318,7 +316,7 @@ Panel {
id: heroDate
textFormat: Text.PlainText
anchors.verticalCenter: parent.verticalCenter
text: Qt.formatDate(root.today, "MMMM d")
text: I18n.chinese ? root.labelLocale.toString(root.today, "M月d日") : Qt.formatDate(root.today, "MMMM d")
color: heroMouse.containsMouse
? Style.hoverStateColor(root.contentForeground, Commons.Color.accent)
: root.contentForeground
@@ -341,7 +339,7 @@ Panel {
PanelToolTip {
visible: heroMouse.containsMouse
text: "Back to today"
text: I18n.tr("Back to today")
fontFamily: root.contentFontFamily
}
}
@@ -374,7 +372,8 @@ Panel {
Text {
anchors.verticalCenter: parent.verticalCenter
text: "BORN"
textFormat: Text.PlainText
text: I18n.tr("BORN")
color: Qt.darker(root.contentForeground, 1.5)
font.family: root.contentFontFamily
font.pixelSize: Style.font.bodySmall
@@ -385,7 +384,7 @@ Panel {
id: bornField
width: Style.space(70)
anchors.verticalCenter: parent.verticalCenter
placeholderText: "year"
placeholderText: I18n.tr("year")
foreground: root.contentForeground
font.family: root.contentFontFamily
inputMethodHints: Qt.ImhDigitsOnly
@@ -397,7 +396,8 @@ Panel {
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: 0
leftPadding: Style.space(6)
text: "LIVE TO"
textFormat: Text.PlainText
text: I18n.tr("LIVE TO")
color: Qt.darker(root.contentForeground, 1.5)
font.family: root.contentFontFamily
font.pixelSize: Style.font.bodySmall
@@ -484,7 +484,8 @@ Panel {
id: lifeLabel
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
text: "LIFE"
textFormat: Text.PlainText
text: I18n.tr("LIFE")
color: Qt.darker(root.contentForeground, 1.5)
font.family: root.contentFontFamily
font.pixelSize: Style.font.bodySmall
@@ -603,7 +604,7 @@ Panel {
PanelToolTip {
visible: weekStartMouse.containsMouse
text: "Start weeks on " + root.nextWeekStartLabel
text: I18n.tr("Start weeks on %1", root.nextWeekStartLabel)
fontFamily: root.contentFontFamily
}
}
@@ -726,7 +727,7 @@ Panel {
// "MAY 2026" and a "SEPTEMBER 2026".
width: Style.space(130)
horizontalAlignment: Text.AlignHCenter
text: Qt.formatDate(root.viewDate, "MMMM yyyy").toUpperCase()
text: I18n.chinese ? root.labelLocale.toString(root.viewDate, "yyyy年M月") : Qt.formatDate(root.viewDate, "MMMM yyyy").toUpperCase()
color: Qt.darker(root.contentForeground, 1.4)
font.family: root.contentFontFamily
font.pixelSize: Style.font.body
@@ -740,7 +741,7 @@ Panel {
anchors.leftMargin: -Style.space(8)
anchors.verticalCenter: parent.verticalCenter
iconText: "󰅁"
tooltipText: "Previous month"
tooltipText: I18n.tr("Previous month")
foreground: root.contentForeground
fontFamily: root.contentFontFamily
onClicked: root.moveMonth(-1)
@@ -751,7 +752,7 @@ Panel {
anchors.rightMargin: -Style.space(8)
anchors.verticalCenter: parent.verticalCenter
iconText: "󰅂"
tooltipText: "Next month"
tooltipText: I18n.tr("Next month")
foreground: root.contentForeground
fontFamily: root.contentFontFamily
onClicked: root.moveMonth(1)