v/GTT
1
0
mirror of https://github.com/eeeXun/GTT.git synced 2025-05-18 16:50:14 -07:00

update comment

This commit is contained in:
eeeXun 2022-10-23 22:30:03 +08:00
parent e313d326f3
commit 45da8702c6
4 changed files with 8 additions and 5 deletions

View File

@ -4,7 +4,7 @@ import (
"os"
)
// search XDG_CONFIG_HOME or $HOME/.config
// Search XDG_CONFIG_HOME or $HOME/.config
func configInit() {
var defaultConfigPath string
@ -37,6 +37,7 @@ func configInit() {
translator.dstLang = config.GetString("destination.language")
}
// Check if need to modify config file when quit program
func updateConfig() {
changed := false

View File

@ -1,5 +1,6 @@
package main
// https://cloud.google.com/translate/docs/languages
var (
Lang = []string{
"Afrikaans",

View File

@ -86,6 +86,7 @@ func (t *Translator) Translate(message string) (string, error) {
}
return translated, nil
}
return "", errors.New("Translation not found")
}

8
ui.go
View File

@ -103,7 +103,7 @@ func updateAllColor() {
updateNonConfigColor()
}
// update title and option
// Update title and option
func updateTitle() {
srcBox.SetTitle(translator.srcLang)
dstBox.SetTitle(translator.dstLang)
@ -239,7 +239,7 @@ func translatePageHandler(event *tcell.EventKey) *tcell.EventKey {
}
dstBox.SetText(src_text)
case tcell.KeyCtrlO:
// play source sound
// Play source sound
if translator.soundLock.Available() {
message := srcBox.GetText()
if len(message) > 0 {
@ -254,7 +254,7 @@ func translatePageHandler(event *tcell.EventKey) *tcell.EventKey {
}
case tcell.KeyCtrlP:
// play destination sound
// Play destination sound
if translator.soundLock.Available() {
message := dstBox.GetText(false)
if len(message) > 0 {
@ -268,7 +268,7 @@ func translatePageHandler(event *tcell.EventKey) *tcell.EventKey {
}
}
case tcell.KeyCtrlX:
// stop play sound
// Stop play sound
translator.soundLock.stop = true
}