Switch regions from Setup > Region and show Chinese menu labels under zh_CN

This commit is contained in:
ZacharyZhang-NY committed 2026-10-06 00:42:55 -04:00
1 parent 56c8344fd2
commit 5f6c803b21
12 files changed
+408 -18

No files matched your search

+14 -1
View File
@@ -37,6 +37,7 @@ Item {
function refresh() {
defaultMenuFile.reload()
localeMenuFile.reload()
userMenuFile.reload()
return "ok"
}
@@ -49,7 +50,9 @@ Item {
// path doesn't have to shell out to bash + jq on every open.
property string defaultMenuPath: omarchyPath + "/default/omarchy/omarchy-menu.jsonc"
property string userMenuPath: Quickshell.env("HOME") + "/.config/omarchy/extensions/omarchy-menu.jsonc"
property string localeMenuPath: (Quickshell.env("LANG") || "").startsWith("zh_CN") ? omarchyPath + "/default/omarchy/omarchy-menu.zh-cn.jsonc" : ""
property var defaultMenuItems: []
property var localeMenuItems: []
property var userMenuItems: []
property bool opened: false
property string mode: "menu"
@@ -247,7 +250,7 @@ Item {
// on a per-key basis (so the user can tweak label/icon/action without
// re-declaring the whole row).
function rebuildItemsFromSources() {
var mergedMenu = MenuModel.mergeMenuSources(root.defaultMenuItems, root.userMenuItems)
var mergedMenu = MenuModel.mergeMenuSources(root.defaultMenuItems, root.localeMenuItems.concat(root.userMenuItems))
root.providerRevision += 1
root.providersLoaded = ({})
root.providerQueue = []
@@ -974,6 +977,16 @@ Item {
onFileChanged: reload()
}
FileView {
id: localeMenuFile
path: root.localeMenuPath
watchChanges: true
printErrors: false
onLoaded: { root.localeMenuItems = root.parseMenuJsonc(text()); root.rebuildItemsFromSources() }
onLoadFailed: { root.localeMenuItems = []; root.rebuildItemsFromSources() }
onFileChanged: reload()
}
FileView {
id: userMenuFile
path: root.userMenuPath