Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Detected ¶
type Detected struct { Lang string `json:"lang"` // detected language Confidence float64 `json:"confidence"` // the confidence of detection result (0.00 to 1.00) }
Detected represents language detection result
type TranslateParams ¶
type TranslateParams struct { Src string `json:"src"` // source language (default: auto) Dest string `json:"dest"` // destination language Text string `json:"text"` // text for translating }
TranslateParams represents translate params
type Translated ¶
type Translated struct { Params TranslateParams `json:"params"` Text string `json:"text"` // translated text Pronunciation string `json:"pronunciation"` // pronunciation of translated text }
Translated represents translated result
func Translate ¶
func Translate(params TranslateParams) (Translated, error)
Translate uses defaultTranslator to translate params.text
type Translator ¶
type Translator struct {
// contains filtered or unexported fields
}
Translator is responsible for translation
func NewWithClient ¶
func NewWithClient(client *http.Client, serviceURLs ...string) *Translator
func (*Translator) Append ¶
func (t *Translator) Append(serviceURLs ...string)
Append appends serviceURLS to t's serviceURLs
func (*Translator) Detect ¶
func (t *Translator) Detect(text string) (Detected, error)
Detect detects text's language
func (*Translator) Translate ¶
func (t *Translator) Translate(params TranslateParams) (Translated, error)
Translate translates text from src language to dest language
Directories ¶
Path | Synopsis |
---|---|
Package tk generates google translate tk
|
Package tk generates google translate tk |
Package tkk gets google translate tkk
|
Package tkk gets google translate tkk |
Package transcookie just for caching google translation services' cookies
|
Package transcookie just for caching google translation services' cookies |
Click to show internal directories.
Click to hide internal directories.