Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ReTkk = regexp.MustCompile(`tkk:'(.+?)'`)
Functions ¶
func AllServiceUrls ¶ added in v0.1.5
func AllServiceUrls() []string
AllServiceUrls Returns all the services that are currently available.
Types ¶
type Option ¶ added in v0.1.3
type Option func(*Translator)
func WithRandomServiceUrl ¶ added in v0.1.3
func WithRandomServiceUrl() Option
func WithRandomServiceUrlEveryTime ¶ added in v0.1.3
func WithRetryTimes ¶ added in v0.1.3
func WithServiceUrl ¶ added in v0.1.3
func WithUserAgent ¶ added in v0.1.3
type TokenAcquirer ¶ added in v0.1.3
type TokenAcquirer struct {
// contains filtered or unexported fields
}
func Token ¶
func Token(host string, client *resty.Client) *TokenAcquirer
type Translated ¶ added in v0.1.3
type Translated struct { Src string // source language Dest string // destination language Origin string // original text Text string // Translated text }
Translated result object.
type Translator ¶ added in v0.1.3
type Translator struct {
// contains filtered or unexported fields
}
func New ¶
func New(options ...Option) *Translator
func (*Translator) Latency ¶ added in v0.1.3
func (t *Translator) Latency(serviceUrls []string)
Latency Test the delay of each service node
func (*Translator) Translate ¶ added in v0.1.3
func (t *Translator) Translate(origin, src, dest string) (*Translated, error)
Translate given content. Set src to `auto` and system will attempt to identify the source language automatically.
Click to show internal directories.
Click to hide internal directories.