diff options
Diffstat (limited to 'internal/web/handlers_sections.go')
| -rw-r--r-- | internal/web/handlers_sections.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/internal/web/handlers_sections.go b/internal/web/handlers_sections.go index 1239545..325192e 100644 --- a/internal/web/handlers_sections.go +++ b/internal/web/handlers_sections.go @@ -76,16 +76,16 @@ func (s *Server) handleSectionSave(w http.ResponseWriter, r *http.Request) { img, err := s.readUpload(r, "inline_image") switch { case err != nil: - fail("Image not added: " + err.Error()) + fail(s.tr(r, "Image not added:") + " " + err.Error()) return case len(sec.Title) > 120: - fail("Title is too long (max 120 characters).") + fail(s.tr(r, "Title is too long (max 120 characters).")) return case strings.TrimSpace(sec.BodyMD) == "" && img == nil: - fail("Write some text for the announcement.") + fail(s.tr(r, "Write some text for the announcement.")) return case len(sec.BodyMD) > maxSectionBytes: - fail("Announcement is too long (20 KB max).") + fail(s.tr(r, "Announcement is too long (20 KB max).")) return } sec.BodyMD = appendImageMD(sec.BodyMD, img) @@ -99,7 +99,7 @@ func (s *Server) handleSectionSave(w http.ResponseWriter, r *http.Request) { s.serverError(w, err) return } - redirectOK(w, r, s.sectionsURL(r)+"/"+strconv.FormatInt(sec.ID, 10)+"/edit", "Saved. Refresh your blog to see it.") + redirectOK(w, r, s.sectionsURL(r)+"/"+strconv.FormatInt(sec.ID, 10)+"/edit", s.tr(r, "Saved. Refresh your blog to see it.")) } func (s *Server) handleSectionDeleteConfirm(w http.ResponseWriter, r *http.Request) { @@ -107,9 +107,9 @@ func (s *Server) handleSectionDeleteConfirm(w http.ResponseWriter, r *http.Reque if sec == nil { return } - what := "this announcement" + what := s.tr(r, "this announcement") if sec.Title != "" { - what = "the announcement \"" + sec.Title + "\"" + what = s.trf(r, "the announcement ā%sā", sec.Title) } s.render(w, r, "dashboard/confirm.html", map[string]any{"what": what, "action": r.URL.Path, "back": s.sectionsURL(r)}) } @@ -123,7 +123,7 @@ func (s *Server) handleSectionDelete(w http.ResponseWriter, r *http.Request) { s.serverError(w, err) return } - redirectOK(w, r, s.sectionsURL(r), "Announcement deleted.") + redirectOK(w, r, s.sectionsURL(r), s.tr(r, "Announcement deleted.")) } func (s *Server) handleSectionMove(w http.ResponseWriter, r *http.Request) { @@ -152,9 +152,9 @@ func (s *Server) handleSectionToggle(w http.ResponseWriter, r *http.Request) { s.serverError(w, err) return } - msg := "Announcement hidden." + msg := s.tr(r, "Announcement hidden.") if !sec.Enabled { - msg = "Announcement shown. Refresh your blog to see it." + msg = s.tr(r, "Announcement shown. Refresh your blog to see it.") } redirectOK(w, r, s.sectionsURL(r), msg) } |
