Provide language translation operations using Microsoft translator Text API with Go.
go get github.com/teitei-tk/malwiya
- Go Version 1.7.x or later
package main
import (
"os"
"log"
"fmt"
"github.com/teitei-tk/malwiya"
)
func main() {
subscriptionKey := os.Getenv("SUBSCRIPTION_KEY")
m := malwiya.New(subscriptionKey)
fromTextLang := "en"
toTextLang := "ja"
text := "I love gopher♡"
result, err := m.Translate(text, fromTextLang, toTextLang)
if err != nil {
log.Fatal(err)
}
fmt.Println(result) // 私は gopher♡ が大好き
}
- Test code
- Documents
Apache License, Version 2.0