Use new API in main.go
This commit is contained in:
parent
a34e948a57
commit
90d47f1a16
7
main.go
7
main.go
@ -5,7 +5,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"./trans"
|
"./trans"
|
||||||
"./identify"
|
|
||||||
"github.com/deanishe/awgo"
|
"github.com/deanishe/awgo"
|
||||||
"regexp"
|
"regexp"
|
||||||
)
|
)
|
||||||
@ -26,7 +25,9 @@ func run() {
|
|||||||
fromLang, toLang = decideWhatLanguagesToUse(word)
|
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 {
|
for _, translation := range translations {
|
||||||
wf.NewItem(translation).Arg(translation).Valid(true)
|
wf.NewItem(translation).Arg(translation).Valid(true)
|
||||||
}
|
}
|
||||||
@ -58,7 +59,7 @@ func isTransLanguageSpecifier(arg string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func decideWhatLanguagesToUse(word string) (string, string) {
|
func decideWhatLanguagesToUse(word string) (string, string) {
|
||||||
fromLang := identify.New(word).Identify()
|
fromLang := trans.New(word).Identify()
|
||||||
toLang := map[string]string{
|
toLang := map[string]string{
|
||||||
"en": "hu",
|
"en": "hu",
|
||||||
"hu": "en",
|
"hu": "en",
|
||||||
|
Loading…
Reference in New Issue
Block a user