types

package
v0.0.0-...-3420d2a Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FeatureNotSupportedError = errors.New("FeatureNotSupportedError")

Functions

This section is empty.

Types

type TranslationEngine

type TranslationEngine interface {
	// Engine name for tagging/logging
	Name() string

	// Load config such as API key, authentication token, etc.
	LoadConfig(conf config.Config) error

	// Return supported source languages supported by the module
	SupportedSourceLanguages() ([]language.Tag, error)

	// Return supported target languages supported by the module,
	// for a given source language
	SupportedTargetLanguages(srcLang language.Tag) ([]language.Tag, error)

	// Check if the source string is within the size limit
	IsSourceSizeOK(src string) bool

	// Do the translation
	Translate(ctx context.Context, srcLang language.Tag, tgtLang language.Tag, src string) (string, error)

	// Set an endpoint for testing, etc
	// Expecting a URL at this moment, but allowing string
	SetEndpoint(endpoint string) error
}

Jump to

Keyboard shortcuts

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