mai/engines/engine.go
fattalion 41fff3c53b Make some identifiers more concise
See https://go.dev/doc/effective_go#package-names, specifically:

> The importer of a package will use the name to refer to its contents,
> so exported names in the package can use that fact to avoid
> repetition.

For example, `engines.GoogleTranslateEngine` needlessly repeats
"engine," so just get rid of that duplication by renaming it to
`engines.GoogleTranslate`.

Renaming `engines.TranslationEngine` to `engines.Engine` may be
debatable, so if somebody disagrees, feel free to leave a comment
stating your disagreement and with an explanation of why you disagree.

git-svn-id: file:///srv/svn/repo/mai/trunk@10 e410bdd4-646f-c54f-a7ce-fffcc4f439ae
2022-09-30 20:16:23 +00:00

17 lines
402 B
Go

package engines
type TranslationResult struct {
SourceLanguage Language
TranslatedText string
}
type Engine interface {
InternalName() string
DisplayName() string
SourceLanguages() ([]Language, error)
TargetLanguages() ([]Language, error)
Translate(text string, from Language, to Language) (TranslationResult, error)
SupportsAutodetect() bool
DetectLanguage(text string) (Language, error)
}