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

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