translator

package
v0.0.0-...-13e6371 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckThrottle

func CheckThrottle(lastReq time.Time, delay time.Duration)

Types

type BadTranslationError

type BadTranslationError struct {
	Input  string
	Output string
}

func (BadTranslationError) Error

func (e BadTranslationError) Error() string

type Request

type Request struct {
	Text string `json:"text"`
	From string `json:"from"`
	To   string `json:"to"`
}

type Response

type Response struct {
	Text            string `json:"text"`
	From            string `json:"from"`
	To              string `json:"to"`
	TranslationText string `json:"translationText"`
}

type Translator

type Translator interface {
	Name() string
	Start(c config.TranslatorConfig) error
	Enabled() bool
	Translate(*Request) (string, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL