2024-08-13 16:14:50 -03:00
|
|
|
package translator
|
|
|
|
|
|
2024-08-13 21:06:07 -03:00
|
|
|
import "dislate/internals/translator/lang"
|
2024-08-13 16:14:50 -03:00
|
|
|
|
|
|
|
|
type Translator interface {
|
|
|
|
|
// Translate a text from a language to another language
|
|
|
|
|
Translate(from, to lang.Language, text string) (string, error)
|
|
|
|
|
// Detects the language of the text
|
|
|
|
|
Detect(text string) (lang.Language, error)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type MockTranslator struct{}
|
|
|
|
|
|
|
|
|
|
func NewMockTranslator() MockTranslator {
|
|
|
|
|
return MockTranslator{}
|
|
|
|
|
}
|
2024-08-28 10:04:55 -03:00
|
|
|
|
2024-08-13 16:14:50 -03:00
|
|
|
func (t MockTranslator) Translate(from, to lang.Language, text string) (string, error) {
|
|
|
|
|
return text, nil
|
|
|
|
|
}
|
2024-08-28 10:04:55 -03:00
|
|
|
|
2024-08-13 16:14:50 -03:00
|
|
|
func (t MockTranslator) Detect(text string) (lang.Language, error) {
|
|
|
|
|
return lang.EN, nil
|
|
|
|
|
}
|