diff --git a/config.go b/config.go index 99391c3..a9b1d8e 100644 --- a/config.go +++ b/config.go @@ -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 diff --git a/language.go b/language.go index 114b3c2..69b6ae8 100644 --- a/language.go +++ b/language.go @@ -1,5 +1,6 @@ package main +// https://cloud.google.com/translate/docs/languages var ( Lang = []string{ "Afrikaans", diff --git a/translator.go b/translator.go index 18a4fc0..c20adf6 100644 --- a/translator.go +++ b/translator.go @@ -86,6 +86,7 @@ func (t *Translator) Translate(message string) (string, error) { } return translated, nil } + return "", errors.New("Translation not found") } diff --git a/ui.go b/ui.go index abb3f60..d99a36a 100644 --- a/ui.go +++ b/ui.go @@ -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 }