translation

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRequestFailed       = errors.New("request failed")
	ErrTranslationNotMatch = errors.New("translation result length not match")
)

Functions

This section is empty.

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine is the config of translation server

func New

func New(apiKey string) *Engine

New create a new TranslateConfig

func (*Engine) TranslateBatchPlain

func (c *Engine) TranslateBatchPlain(src []string, from, to language.Tag) ([]string, error)

TranslateBatchSeq translate a series of sequences of text

func (*Engine) TranslateMarkdown

func (c *Engine) TranslateMarkdown(src []byte, from, to language.Tag) (ret []byte, err error)

TranslateMarkdown translate markdown with bytes

func (*Engine) TranslateMarkdownText

func (c *Engine) TranslateMarkdownText(src string, from, to language.Tag) (ret string, err error)

TranslateMarkdown translate markdown text

func (*Engine) TranslatePlain

func (c *Engine) TranslatePlain(src []byte, from, to language.Tag) (ret []byte, err error)

Translate translate sequence of bytes

func (*Engine) TranslatePlainText

func (c *Engine) TranslatePlainText(src string, from, to language.Tag) (ret string, err error)

Translate translate sequence of text

Jump to

Keyboard shortcuts

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