Index: trunk/engines/engine.go
===================================================================
--- trunk/engines/engine.go	(revision 22)
+++ trunk/engines/engine.go	(revision 23)
@@ -9,10 +9,8 @@
 
 type Engine interface {
-	InternalName() string
 	DisplayName() string
 	SourceLanguages() (Language, error)
 	TargetLanguages() (Language, error)
 	Translate(text string, from, to string) (TranslationResult, error)
-	DetectLanguage(text string) (string, error)
 	Tts(text, lang string) (string, error)
 }
@@ -22,5 +20,5 @@
 var Engines = map[string]Engine{
 	"google": &GoogleTranslate{},
-	// "icibia":   &ICIBA{},
+	// "icibia": &ICIBA{},
 	// "libre":    &LibreTranslate{},
 	"reverseo": &Reverso{},
Index: trunk/engines/google.go
===================================================================
--- trunk/engines/google.go	(revision 22)
+++ trunk/engines/google.go	(revision 23)
@@ -16,6 +16,4 @@
 type GoogleTranslate struct{}
 
-func (_ *GoogleTranslate) InternalName() string { return "google" }
-
 func (_ *GoogleTranslate) DisplayName() string { return "Google" }
 
@@ -30,5 +28,5 @@
 
 	default:
-		panic(fmt.Errorf("getLangs was passed an invalid language type: %s", langsType))
+		return nil, fmt.Errorf("Invalid language type: %s", langsType)
 	}
 
@@ -94,6 +92,4 @@
 	return requestURL.String(), nil
 }
-
-func (_ *GoogleTranslate) DetectLanguage(text string) (string, error) { return "", nil }
 
 func (_ *GoogleTranslate) Translate(text string, from, to string) (TranslationResult, error) {
@@ -276,4 +272,8 @@
 			}
 		}
+
+		if len(json_) > 0 && json_[0] != nil && len(json_[0].([]interface{})) > 2 && json_[0].([]interface{})[2] != nil {
+			from = json_[0].([]interface{})[2].(string)
+		}
 	}
 
Index: trunk/engines/iciba.go
===================================================================
--- trunk/engines/iciba.go	(revision 22)
+++ trunk/engines/iciba.go	(revision 23)
@@ -12,6 +12,4 @@
 // ICIBA is an engine that fetches data from https://www.iciba.com.
 type ICIBA struct{}
-
-func (_ *ICIBA) InternalName() string { return "iciba" }
 
 func (_ *ICIBA) DisplayName() string { return "iCIBA" }
@@ -216,13 +214,4 @@
 func (_ *ICIBA) TargetLanguages() (Language, error) { return icibaLanguages, nil }
 
-func (_ *ICIBA) DetectLanguage(text string) (string, error) { return "", nil }
-
-type icibaTranslateResponse struct {
-	Content struct {
-		From string `json:"from"`
-		Out  string `json:"out"`
-	} `json:"content"`
-}
-
 func (_ *ICIBA) Translate(text string, from, to string) (TranslationResult, error) {
 	requestURL, _ := url.Parse("https://ifanyi.iciba.com/index.php")
@@ -255,5 +244,10 @@
 	}
 
-	var responseJSON icibaTranslateResponse
+	var responseJSON struct {
+		Content struct {
+			From string `json:"from"`
+			Out  string `json:"out"`
+		} `json:"content"`
+	}
 
 	if err := json.NewDecoder(response.Body).Decode(&responseJSON); err != nil {
Index: trunk/engines/libretranslate.go
===================================================================
--- trunk/engines/libretranslate.go	(revision 22)
+++ trunk/engines/libretranslate.go	(revision 23)
@@ -23,6 +23,4 @@
 	APIKey string
 }
-
-func (_ *LibreTranslate) InternalName() string { return "libre" }
 
 func (_ *LibreTranslate) DisplayName() string { return "LibreTranslate" }
@@ -71,5 +69,5 @@
 }
 
-func (e *LibreTranslate) DetectLanguage(text string) (string, error) {
+func (e *LibreTranslate) detectLanguage(text string) (string, error) {
 	formData := map[string]string{"q": text}
 
@@ -125,8 +123,4 @@
 }
 
-type libreTranslateResponse struct {
-	TranslatedText string `json:"translatedText"`
-}
-
 func (e *LibreTranslate) Translate(text string, from, to string) (TranslationResult, error) {
 	formData := map[string]string{
@@ -158,5 +152,7 @@
 	}
 
-	var responseJSON libreTranslateResponse
+	var responseJSON struct {
+		TranslatedText string `json:"translatedText"`
+	}
 
 	if err := json.NewDecoder(response.Body).Decode(&responseJSON); err != nil {
@@ -164,4 +160,11 @@
 	}
 
-	return TranslationResult{TranslatedText: responseJSON.TranslatedText}, nil
+	if r, err := e.detectLanguage(text); err == nil {
+		from = r
+	}
+
+	return TranslationResult{
+		TranslatedText: responseJSON.TranslatedText,
+		SourceLanguage: from,
+	}, nil
 }
Index: trunk/engines/reverso.go
===================================================================
--- trunk/engines/reverso.go	(revision 22)
+++ trunk/engines/reverso.go	(revision 23)
@@ -10,6 +10,4 @@
 // Reverso is an engine that fetches data from https://reverso.net.
 type Reverso struct{}
-
-func (_ *Reverso) InternalName() string { return "reverso" }
 
 func (_ *Reverso) DisplayName() string { return "Reverso" }
@@ -84,5 +82,4 @@
 
 	request.Header.Set("Content-Type", "application/json")
-	// Returns 403 with empty or no user agent.
 	request.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; rv:110.0) Gecko/20100101 Firefox/110.0")
 
@@ -110,50 +107,28 @@
 }
 
-func (e *Reverso) DetectLanguage(text string) (string, error) {
-	// Any language pair works here, does not affect result
-	r, err := e.callAPI(text, "ara", "chi")
-
-	if err != nil {
-		return "", err
+func (e *Reverso) Translate(text string, from, to string) (TranslationResult, error) {
+	if from == "auto" || from == "" {
+		from = "eng"
 	}
 
+	var translation string
+
+	r, err := e.callAPI(text, from, to)
+	if err != nil {
+		return TranslationResult{}, err
+	}
+
+	translation = r.Translation[0]
 	langCode := r.LanguageDetection.DetectedLanguage
 
 	for code := range reversoLangs {
 		if code == langCode {
-			return code, nil
+			from = code
 		}
-	}
-
-	return "", fmt.Errorf("language code \"%s\" is not in Reverso's language list", langCode)
-}
-
-func (e *Reverso) Translate(text string, from, to string) (TranslationResult, error) {
-	if from == "auto" {
-		from_, err := e.DetectLanguage(text)
-
-		if err != nil {
-			return TranslationResult{}, err
-		}
-
-		from = from_
-	}
-
-	var translation string
-
-	if from == to {
-		translation = text
-	} else {
-		r, err := e.callAPI(text, from, to)
-
-		if err != nil {
-			return TranslationResult{}, err
-		}
-
-		translation = r.Translation[0]
 	}
 
 	return TranslationResult{
 		TranslatedText: translation,
+		SourceLanguage: from,
 	}, nil
 }
