Use new API in main.go

This commit is contained in:
Kristóf Tóth 2019-10-13 18:11:29 +02:00
parent a34e948a57
commit 90d47f1a16

View File

@ -5,7 +5,6 @@ import (
"os"
"strings"
"./trans"
"./identify"
"github.com/deanishe/awgo"
"regexp"
)
@ -26,7 +25,9 @@ func run() {
fromLang, toLang = decideWhatLanguagesToUse(word)
}
translations := trans.New(word, fromLang, toLang).Translate()
t := trans.New(word)
t.Language = fromLang
translations := t.Translate(toLang)
for _, translation := range translations {
wf.NewItem(translation).Arg(translation).Valid(true)
}
@ -58,7 +59,7 @@ func isTransLanguageSpecifier(arg string) bool {
}
func decideWhatLanguagesToUse(word string) (string, string) {
fromLang := identify.New(word).Identify()
fromLang := trans.New(word).Identify()
toLang := map[string]string{
"en": "hu",
"hu": "en",