Documentation
¶
Index ¶
- Constants
- func AsyncTranslate(eachTranslatorTimeout time.Duration, req *Request, ts ...string) <-chan *Response
- func IsChinese(str string) bool
- type Request
- type Response
- func BaiduTranslate(ctx context.Context, req Request) (resp *Response)
- func BingTranslate(ctx context.Context, req Request) *Response
- func GoogleTranslate(ctx context.Context, req Request) *Response
- func SogouTranslate(ctx context.Context, req Request) *Response
- func TencentTranslate(ctx context.Context, req Request) *Response
- func YoudaoTranslate(ctx context.Context, req Request) *Response
Constants ¶
View Source
const ( Chinese = "zh-CN" English = "en" Russian = "ru" Japanese = "ja" German = "de" French = "fr" Korean = "ko" Spanish = "es" )
Variables ¶
This section is empty.
Functions ¶
func AsyncTranslate ¶ added in v0.4.5
Types ¶
type Request ¶
type Request struct {
// FromLang the from language of the translation
FromLang string
// ToLang the to language of the translation
ToLang string
// Text translation text
Text string
}
Request translation request
type Response ¶
type Response struct {
// Name the translator name
Name string
// Homepage the translator homepage
Homepage string
// Result the translation result
Result string
// Err the translation error
Err error
}
Response translation response
func BaiduTranslate ¶ added in v0.4.5
func GoogleTranslate ¶ added in v0.4.5
func SogouTranslate ¶ added in v0.4.5
func TencentTranslate ¶ added in v0.4.5
Source Files
¶
Click to show internal directories.
Click to hide internal directories.
