Bug Description
The toolbar Toggle Preview button doesn't work on non-English systems because actionName is hardcoded to "Change Mode", but MarkEdit-preview localizes menu item titles.
Root Cause
firstActionNamed in MarkEdit does an exact title match:
// MarkEditMac/Sources/Extensions/NSMenu+Extension.swift
func firstActionNamed(_ title: String) -> NSMenuItem? {
firstDescendant {
$0.title == title && $0.action != nil
}
}
And MarkEdit-preview localizes the menu title per system language:
https://github.com/MarkEdit-app/MarkEdit-preview/blob/main/src/shared/strings.ts
'zh-CN': { changeMode: '切换模式' },
'zh-TW': { changeMode: '切換模式' },
'default': { changeMode: 'Change Mode' },
But Apply One-Click Toggle Setup always writes:
jsonc
"actionName": "Change Mode" // ❌ only works on English systems
Steps to Reproduce
1. Set macOS system language to 简体中文 (zh-CN)
2. Install MarkEdit-preview + Direct Preview
3. Run "Apply One-Click Toggle Setup"
4. Restart MarkEdit, add the Toggle Preview toolbar button
5. Click the 👁 button → nothing happens
Expected Behavior
The toolbar button should toggle Edit ↔ Preview regardless of system language.
Suggested Fix
Instead of hardcoding English, there are a few options:
1. Simplest: Accept multiple actionName values and try them in order:
jsonc
"actionName": ["Change Mode", "切换模式", "切換模式"]
2. Robust: Read the localized string from MarkEdit-preview's settings.json or expose it via an API.
3. Workaround for users: Document in README that non-English users need to manually change actionName to match their locale.
Environment
- macOS 26 (Sequoia)
- MarkEdit 1.33+
- MarkEdit-preview v1.8.1
- Direct Preview v0.1.0
- System Language: zh-CN (简体中文)
---
Bug Description
The toolbar
Toggle Previewbutton doesn't work on non-English systems becauseactionNameis hardcoded to"Change Mode", but MarkEdit-preview localizes menu item titles.Root Cause
firstActionNamedin MarkEdit does an exact title match: