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

Last change on this file since 69 was 67, checked in by yakumo.izuru, 16 months ago

Fix bugs, many other changes

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

File size: 773 bytes
RevLine 
[9]1package engines
2
[60]3import (
4 "os"
5)
6
[9]7type TranslationResult struct {
[21]8 SourceLanguage string `json:"source_language"`
9 Definitions interface{} `json:"definitions"`
10 Translations interface{} `json:"translations"`
11 TranslatedText string `json:"translated_text"`
[9]12}
13
[10]14type Engine interface {
[9]15 DisplayName() string
[15]16 SourceLanguages() (Language, error)
17 TargetLanguages() (Language, error)
18 Translate(text string, from, to string) (TranslationResult, error)
[20]19 Tts(text, lang string) (string, error)
[9]20}
[15]21
22type Language map[string]string
23
24var Engines = map[string]Engine{
[20]25 "google": &GoogleTranslate{},
[27]26 "reverso": &Reverso{},
[60]27 "libretranslate": &LibreTranslate{
28 InstanceURL: os.Getenv("MAI_LIBRETRANSLATE_INSTANCE"),
29 APIKey: os.Getenv("MAI_LIBRETRANSLATE_API"),
30 },
[15]31}
Note: See TracBrowser for help on using the repository browser.