module

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Engine = map[string]TranslateEngine{
		"deepl":  DeepLTranslate,
		"google": GoogleTranslate,
	}
)

Functions

func GetEngine

func GetEngine(q string) (string, error)

func GetRandomNumber

func GetRandomNumber() int64

Types

type InputObj

type InputObj struct {
	SourceText string `json:"text"`
	SourceLang string `json:"source_lang"`
	TargetLang string `json:"target_lang"`
	Engine     string `json:"engine"`
}

type OutputObj

type OutputObj struct {
	TransText    string `json:"text"`
	Alternatives []string
}

func DeepLTranslate

func DeepLTranslate(i *InputObj) (*OutputObj, int, error)

func GoogleTranslate

func GoogleTranslate(i *InputObj) (*OutputObj, int, error)

type TranslateEngine

type TranslateEngine func(i *InputObj) (*OutputObj, int, error)

Jump to

Keyboard shortcuts

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