Skip to content
/ translate Public

Use golang to achieve Baidu、Bing、Google、Youdao translation

Notifications You must be signed in to change notification settings

hwfy/translate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

translate

Call Translate api to translate one or more characters

Installation

go get github.com/hwfy/translate

Example

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]
// [こんにちは グローバル]

About

Use golang to achieve Baidu、Bing、Google、Youdao translation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages