translate gemini.go
This commit is contained in:
+4
-3
@@ -22,6 +22,7 @@ import (
|
||||
|
||||
"git.sr.ht/~adnano/go-gemini"
|
||||
"github.com/mmcdole/gofeed"
|
||||
"golang.nytpu.com/comitium/localizations"
|
||||
|
||||
"golang.nytpu.com/comitium/core"
|
||||
)
|
||||
@@ -35,7 +36,7 @@ func fetchGemini(remote string) (*gemini.Response, error) {
|
||||
return nil, err
|
||||
}
|
||||
if resp.Status != gemini.StatusSuccess {
|
||||
return nil, fmt.Errorf("Unexpected Gemini response: %d %s", resp.Status, resp.Meta)
|
||||
return nil, fmt.Errorf(core.Localizer.Get("errors.gem_bad_response", &localizations.Replacements{"code": resp.Status, "meta": resp.Meta}))
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
@@ -52,7 +53,7 @@ func geminiFeed(data *core.FullData, remote string, title string) error {
|
||||
|
||||
mimetype, _, err := mime.ParseMediaType(resp.Meta)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unintelligible content type: %s", resp.Meta)
|
||||
return fmt.Errorf(core.Localizer.Get("errors.bad_content_type", &localizations.Replacements{"mime": resp.Meta}))
|
||||
}
|
||||
|
||||
reader := io.LimitReader(resp.Body, 1073741824) // 1 GiB
|
||||
@@ -120,7 +121,7 @@ func geminiFeed(data *core.FullData, remote string, title string) error {
|
||||
data.InsertFeed(feed, remote)
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("Cannot interpret %s as a feed", resp.Meta)
|
||||
return fmt.Errorf(core.Localizer.Get("errors.bad_feed", &localizations.Replacements{"meta": resp.Meta}))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user