Call Translate api to translate one or more characters
go get github.com/hwfy/translate
package main
import (
"github.com/hwfy/translate"
"fmt"
)
func main() {
query := "感谢"
result := translate.Google("zh", "cht", query, "")
fmt.Println(result)
result = translate.Google("zh", "en", query, "")
fmt.Println(result)
result = translate.Google("zh", "jp", query, "")
fmt.Println(result)
querys := []string{"你好", "全球"}
results := translate.Googles("zh", "cht", querys, "")
fmt.Println(results)
results = translate.Googles("zh", "en", querys, "")
fmt.Println(results)
results = translate.Googles("zh", "jp", querys, "")
fmt.Println(results)
}
// OutPut:
// 感謝
// Thank
// ありがとうございます
// [你好 全球]
// [Hello. Global]
// [こんにちは グローバル]