source: code/trunk/engines/engine.go@ 10

Last change on this file since 10 was 10, checked in by fattalion, 3 years ago

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.

File size: 402 bytes
RevLine 
[9]1package engines
2
3type TranslationResult struct {
4 SourceLanguage Language
5 TranslatedText string
6}
7
[10]8type Engine interface {
[9]9 InternalName() string
10 DisplayName() string
11 SourceLanguages() ([]Language, error)
12 TargetLanguages() ([]Language, error)
13 Translate(text string, from Language, to Language) (TranslationResult, error)
14 SupportsAutodetect() bool
15 DetectLanguage(text string) (Language, error)
16}
Note: See TracBrowser for help on using the repository browser.