Do some minor cleanup
git-svn-id: file:///srv/svn/repo/mai/trunk@12 e410bdd4-646f-c54f-a7ce-fffcc4f439ae
This commit is contained in:
parent
a872b63b2f
commit
306e58d5af
@ -10,7 +10,7 @@ type Engine interface {
|
||||
DisplayName() string
|
||||
SourceLanguages() ([]Language, error)
|
||||
TargetLanguages() ([]Language, error)
|
||||
Translate(text string, from Language, to Language) (TranslationResult, error)
|
||||
Translate(text string, from, to Language) (TranslationResult, error)
|
||||
SupportsAutodetect() bool
|
||||
DetectLanguage(text string) (Language, error)
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ func (_ *GoogleTranslate) SupportsAutodetect() bool { return true }
|
||||
|
||||
func (_ *GoogleTranslate) DetectLanguage(text string) (Language, error) { return Language{}, nil }
|
||||
|
||||
func (_ *GoogleTranslate) Translate(text string, from Language, to Language) (TranslationResult, error) {
|
||||
func (_ *GoogleTranslate) Translate(text string, from, to Language) (TranslationResult, error) {
|
||||
requestURL, err := url.Parse("https://translate.google.com/m")
|
||||
|
||||
if err != nil {
|
||||
|
@ -226,7 +226,7 @@ type icibaTranslateResponse struct {
|
||||
} `json:"content"`
|
||||
}
|
||||
|
||||
func (_ *ICIBA) Translate(text string, from Language, to Language) (TranslationResult, error) {
|
||||
func (_ *ICIBA) Translate(text string, from, to Language) (TranslationResult, error) {
|
||||
requestURL, err := url.Parse("https://ifanyi.iciba.com/index.php")
|
||||
|
||||
if err != nil {
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
// LibreTranslate is an engine that interfaces with any
|
||||
// [LibreTranslate](https://github.com/LibreTranslate/LibreTranslate) instance.
|
||||
type LibreTranslate struct {
|
||||
// InstanceURL is the URL to a LibreTranslate instance, for instance
|
||||
// InstanceURL is the URL to a LibreTranslate instance, for example
|
||||
// "https://libretranslate.com".
|
||||
InstanceURL string
|
||||
// APIKey is the API key for the given instance. If empty, then no API
|
||||
@ -130,7 +130,7 @@ type libreTranslateResponse struct {
|
||||
TranslatedText string `json:"translatedText"`
|
||||
}
|
||||
|
||||
func (e *LibreTranslate) Translate(text string, from Language, to Language) (TranslationResult, error) {
|
||||
func (e *LibreTranslate) Translate(text string, from, to Language) (TranslationResult, error) {
|
||||
formData := map[string]string{
|
||||
"q": text,
|
||||
"source": from.Code,
|
||||
|
Loading…
x
Reference in New Issue
Block a user