Skip to content

Commit

Permalink
add english translation
Browse files Browse the repository at this point in the history
  • Loading branch information
xianyukang committed May 5, 2024
1 parent 823417b commit cea3306
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 51 deletions.
Binary file modified MyKeymap.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion bin/AlignComment.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ GetSelectedText() {

Send("^c")
if not (ClipWait(0.4)) {
Tip("没有选中的文本或文件", -1200)
Tip("no items selected", -1200)
return
}
text := A_Clipboard
Expand Down
2 changes: 1 addition & 1 deletion bin/Launcher.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)")) {
ExitApp
} catch Error as e {
hasTip := true
ToolTip("`n MyKeymap 当前以普通权限运行`n 在一些高权限窗口中会完全失效 ( 比如任务管理器 ) `n ")
ToolTip("`n MyKeymap is running with normal privileges.`n MyKeymap will not work in a window with admin rights ( e.g., Taskmgr.exe ) `n ")
}
}

Expand Down
22 changes: 11 additions & 11 deletions bin/MyKeymap.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ InitKeymap()
km.Map("singlePress", _ => (Send("{blind}{3}")))
km.Map("*/", km.ToggleLock)

; 分号模式
km13 := KeymapManager.NewKeymap("*;", "分号模式", "")
; 分号模式( ; )
km13 := KeymapManager.NewKeymap("*;", "分号模式( `; )", "")
km := km13
km.Map("*a", _ => (Send("{blind}*")))
km.Map("*b", _ => (Send("{blind}%")))
Expand All @@ -199,8 +199,8 @@ InitKeymap()
km.Map("*z", _ => (Send("{blind}\")))
km.Map("singlePress", _ => EnterSemicolonAbbr(semiHook, semiHookAbbrWindow))

; 句号模式
km14 := KeymapManager.NewKeymap("*.", "句号模式", "")
; 句号模式( . )
km14 := KeymapManager.NewKeymap("*.", "句号模式( . )", "")
km := km14
km.Map("singlePress", _ => (Send("{blind}{.}")))
km.Map("*,", _ => HoldDownModifierKey("LShift"))
Expand Down Expand Up @@ -354,14 +354,14 @@ ExecSemicolonAbbr(command) {
}

InitTrayMenu() {
m := GetMenuName()
A_TrayMenu.Delete()
A_TrayMenu.Add("暂停", TrayMenuHandler)
A_TrayMenu.Add("退出", TrayMenuHandler)
A_TrayMenu.Add("重启程序", TrayMenuHandler)
A_TrayMenu.Add("打开设置", TrayMenuHandler)
A_TrayMenu.Add("帮助文档", TrayMenuHandler)
A_TrayMenu.Add("查看窗口标识符", TrayMenuHandler)
A_TrayMenu.Default := "暂停"
A_TrayMenu.Add(m.Pause, TrayMenuHandler)
A_TrayMenu.Add(m.Exit, TrayMenuHandler)
A_TrayMenu.Add(m.Reload, TrayMenuHandler)
A_TrayMenu.Add(m.Settings, TrayMenuHandler)
A_TrayMenu.Add(m.Spy, TrayMenuHandler)
A_TrayMenu.Default := m.Pause
A_TrayMenu.ClickCount := 1

A_IconTip := "MyKeymap 2.0-beta28 created by 咸鱼阿康"
Expand Down
4 changes: 2 additions & 2 deletions bin/WindowSpy.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ WinSpyGui() {
oGui.OnEvent("Size", WinSpySize)

oGui.BackColor := "FFFFFF"
oGui.SetFont("s11")
oGui.SetFont("s11", "Segoe UI")
oGui.Add("Text", , "程序的窗口标识符有下面三种:")
oGui.Add("Text", , "▷ 窗口名: 无标题 - 记事本")
oGui.Add("Text", , "▷ 进程名: ahk_exe notepad.exe")
Expand All @@ -34,7 +34,7 @@ WinSpyGui() {
oGui.Add("Text", , "➤ 也可以组合两个标识符: 记事 ahk_exe notepad.exe (更精确")
oGui.Add("Text", , "")

oGui.Add("Text", , "当前窗口的三种标识符:")
oGui.Add("Text", , "Window Title, Class and Process:")
oGui.Add("Edit", "xm w640 r4 ReadOnly -Wrap vCtrl_Title")
; oGui.Add("Text",,"当前鼠标位置:")
; oGui.Add("Edit","w640 r4 ReadOnly vCtrl_MousePos")
Expand Down
12 changes: 6 additions & 6 deletions bin/lib/Actions.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ ToggleWindowTopMost() {
value := !(WinGetExStyle("A") & 0x8)
WinSetAlwaysOnTop(value, "A")
if value {
Tip("Always-on-top: on")
Tip("Always-on-top: On")
} else {
Tip("Always-on-top: off")
Tip("Always-on-top: Off")
}
}

Expand Down Expand Up @@ -552,18 +552,18 @@ CopySelectedAsPlainText() {
A_Clipboard := ""
Send "^c"
if !ClipWait(1) {
Tip("复制失败")
Tip(" Copy: fail ")
return
}
A_Clipboard := A_Clipboard
Tip("复制成功")
Tip(" Copy: ok ")
}

MuteActiveApp() {
code := RunWait("bin\SoundControl.exe ToggleMute " GetActiveProcess("name"))
switch code {
case 1: Tip("Mute: on")
case 2: Tip("Mute: off")
case 1: Tip("Mute: On")
case 2: Tip("Mute: Off")
default: Tip("Cannot mute this app")
}
}
52 changes: 35 additions & 17 deletions bin/lib/Functions.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@
* @param MyMenu
*/
TrayMenuHandler(ItemName, ItemPos, MyMenu) {
m := GetMenuName()
switch ItemName {
case "退出":
case m.Exit:
MyKeymapExit()
case "暂停":
case m.Pause:
MyKeymapToggleSuspend()
case "重启程序":
case m.Reload:
MyKeymapReload()
case "打开设置":
case m.Settings:
MyKeymapOpenSettings()
case "帮助文档":
Run("https://xianyukang.com/MyKeymap.html")
case "查看窗口标识符":
case m.Spy:
run("MyKeymap.exe /script bin\WindowSpy.ahk")
}
}
Expand All @@ -35,16 +34,25 @@ MyKeymapExit(ExitReason?, ExitCode?) {
* 暂停
*/
MyKeymapToggleSuspend() {
Suspend(!A_IsSuspended)
if (A_IsSuspended) {
TraySetIcon("./bin/icons/logo2.ico")
A_TrayMenu.Check("暂停")
Tip(" 暂停 MyKeymap ", -500)
} else {
TraySetIcon("./bin/icons/logo.ico")
A_TrayMenu.UnCheck("暂停")
Tip(" 恢复 MyKeymap ", -500)
fn() {
m := GetMenuName()
Suspend(!A_IsSuspended)
if (A_IsSuspended) {
TraySetIcon("./bin/icons/logo2.ico")
A_TrayMenu.Check(m.Pause)
Tip(" MyKeymap: Off ", -500)
} else {
TraySetIcon("./bin/icons/logo.ico")
A_TrayMenu.UnCheck(m.Pause)
Tip(" MyKeymap: On ", -500)
}
}

if A_PriorKey == "RButton" {
SetTimer(fn, -200)
return
}
fn()
}

/**
Expand Down Expand Up @@ -358,7 +366,7 @@ GetSelectedText() {

Send("^c")
if not (ClipWait(0.4)) {
Tip("没有选中的文本或文件", -700)
Tip("no items selected", -700)
return
}
text := A_Clipboard
Expand Down Expand Up @@ -578,4 +586,14 @@ PasteToPrograms(text) {
*/
NotActiveWin() {
return IsDesktop() || not WinExist("A")
}

GetMenuName() {
return {
Pause: "暂停 | Pause ",
Exit: "退出 | Exit ",
Reload: "重启程序 | Reload ",
Settings: "打开设置 | Settings ",
Spy: "窗口标识 | Window Spy ",
}
}
4 changes: 2 additions & 2 deletions bin/lib/KeymapManager.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

; 未锁定
if !this.L.locked {
this.ShowToolTip("已锁定 " this.L.toLock.Name, this.L.show)
this.ShowToolTip("Lock " this.L.toLock.Name, this.L.show)
this._lock()
; 锁定时注册个函数, 用于自动关闭锁定, TaskSwitch 模式会用到这个
if this.L.locked.AfterLocked {
Expand All @@ -88,7 +88,7 @@
if !this.L.toggle {
return
}
this.ShowToolTip("取消锁定", this.L.show)
this.ShowToolTip("Lock: Off", this.L.show)
this.Unlock()
return
}
Expand Down
6 changes: 5 additions & 1 deletion config-server/internal/script/script.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ func ahkString(s string) string {
return `"` + s + `"`
}

func escapeSemicolon(s string) string {
return strings.ReplaceAll(s, ";", "`;")
}

func escapeAhkHotkey(key string) string {
if key == ";" {
return "`;"
Expand Down Expand Up @@ -159,7 +163,7 @@ func renderKeymap(km Keymap) string {
hotkey = "customHotkeys"
}
if km.ParentID == 0 {
line += fmt.Sprintf("NewKeymap(%s, %s, %s)\n", ahkString(hotkey), ahkString(km.Name), ahkString(divide(km.Delay, 1000)))
line += fmt.Sprintf("NewKeymap(%s, %s, %s)\n", ahkString(hotkey), escapeSemicolon(ahkString(km.Name)), ahkString(divide(km.Delay, 1000)))
} else {
line += fmt.Sprintf("AddSubKeymap(km%d, %s, %s)\n", km.ParentID, ahkString(hotkey), ahkString(km.Name))
}
Expand Down
14 changes: 7 additions & 7 deletions config-server/templates/mykeymap.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ ExecSemicolonAbbr(command) {
{{- end }}

InitTrayMenu() {
m := GetMenuName()
A_TrayMenu.Delete()
A_TrayMenu.Add("暂停", TrayMenuHandler)
A_TrayMenu.Add("退出", TrayMenuHandler)
A_TrayMenu.Add("重启程序", TrayMenuHandler)
A_TrayMenu.Add("打开设置", TrayMenuHandler)
A_TrayMenu.Add("帮助文档", TrayMenuHandler)
A_TrayMenu.Add("查看窗口标识符", TrayMenuHandler)
A_TrayMenu.Default := "暂停"
A_TrayMenu.Add(m.Pause, TrayMenuHandler)
A_TrayMenu.Add(m.Exit, TrayMenuHandler)
A_TrayMenu.Add(m.Reload, TrayMenuHandler)
A_TrayMenu.Add(m.Settings, TrayMenuHandler)
A_TrayMenu.Add(m.Spy, TrayMenuHandler)
A_TrayMenu.Default := m.Pause
A_TrayMenu.ClickCount := 1

A_IconTip := "MyKeymap {{ .Options.MykeymapVersion }} created by 咸鱼阿康"
Expand Down
6 changes: 3 additions & 3 deletions data/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@
},
{
"id": 13,
"name": "分号模式",
"name": "分号模式( ; )",
"enable": true,
"hotkey": "*;",
"parentID": 0,
Expand Down Expand Up @@ -1388,7 +1388,7 @@
},
{
"id": 14,
"name": "句号模式",
"name": "句号模式( . )",
"enable": true,
"hotkey": "*.",
"parentID": 0,
Expand Down Expand Up @@ -1648,7 +1648,7 @@
},
{
"id": 17,
"name": "鼠标侧键(后退)",
"name": "鼠标侧键( Back )",
"enable": false,
"hotkey": "XButton1",
"parentID": 0,
Expand Down

0 comments on commit cea3306

Please sign in to comment.