v0.253.0 — errors carry the key of the sentence they are (R-557 slice 2 release B)
gates / gates (push) Successful in 24s

179 Hungarian sentences were built deep inside a package with fmt.Errorf and printed by
whoever caught them: too late to translate where they are shown, too early where they are
made. Every one now carries its key across that gap. ZERO Hungarian error literals remain.

util.MsgError does three things at once, each earned:
  - Error() is the Hungarian, byte for byte, so every un-converted printer is unchanged;
  - errors.Is answers for the kind AND for a wrapped cause (KindErrorf dropped the cause);
  - an error ARGUMENT renders recursively, so "formázás sikertelen: %w" translates whole.
A foreign error — restic, docker, ssh, the stdlib — prints verbatim. It is not ours.

76 display sites go through errText, and TestNoErrErrorInPageOutput convicts any that do
not. memoryVerdict returns an error rather than a sentence, so the deploy's 409 and the
household's language come from one value; UpdateRefusal gained a Cause to carry it.

Plurals, one rule, stated once: a key with .one/.other takes its COUNT first. Not a
per-call-site flag — the producer somebody forgot would read "3 app is not running". The
guard caught a real key collision (alert.deadapp.one) the day the rule landed.

TWO DEFECTS FOUND IN MY OWN TOOLING, recorded rather than quietly fixed. The bulk converter
silently dropped multi-line concatenations, damaging 7 producers — and the parity gate could
not see it, because every surviving fragment WAS a real base literal while the CALL had lost
text; two behaviour tests caught it. And the counting script was case-sensitive, so it said
"0 left" while five remained.

MinAgent: 0.131.0 (unchanged). No hub release needed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
2026-09-18 11:44:30 +02:00
parent 5270bad76e
commit 7c05b59708
70 changed files with 1853 additions and 377 deletions
+37
View File
@@ -10,6 +10,7 @@ import (
"gitea.dooplex.hu/admin/felhom-controller/internal/i18n"
"gitea.dooplex.hu/admin/felhom-controller/internal/stacks"
"gitea.dooplex.hu/admin/felhom-controller/internal/util"
)
// ── i18n (v0.247.0) — the dashboard in more than one language ──────────────────────────────────
@@ -80,6 +81,27 @@ func (s *Server) msgN(r *http.Request, key string, n int) string {
return b.Plural(s.langFor(r), key, n)
}
// ── Errors on a page (v0.253.0, slice 2 release B) ─────────────────────────────────────────────
//
// An error is MADE deep in a package that has no request, and PRINTED by a handler that has one.
// util.MsgError carries the key across that gap; errText is the handler side of it.
//
// A plain error — restic, docker, ssh, the Go stdlib — prints verbatim, in both languages, because
// that sentence is not ours (10-localisation.md §9). So this is safe to put in front of EVERY
// err.Error() on a display path, converted or not, and that is exactly what release B does.
// errText renders an error in the request's language: its bundle message when it carries one, its own
// text otherwise.
func (s *Server) errText(r *http.Request, err error) string {
return util.ErrText(s.langFor(r), err)
}
// errTextLang is errText for a language already resolved (a background run, or a handler that
// resolved it once).
func (s *Server) errTextLang(lang string, err error) string {
return util.ErrText(lang, err)
}
// ── Flash lines (v0.252.0) ─────────────────────────────────────────────────────────────────────
//
// A flash travels to the page INSIDE THE REDIRECT URL (`?flash=…`), so it is rendered by a DIFFERENT
@@ -93,6 +115,21 @@ func (s *Server) msgN(r *http.Request, key string, n int) string {
// shown verbatim, exactly as it was before. That also covers a hand-typed `?flash=<script>` — which
// html/template escapes, as it always did.
// flashForErr turns an error into what a flash carries: its bundle KEY plus its parameters when it
// has one, and its own text otherwise.
//
// The second half is what makes this safe to use everywhere: a restic, docker or ssh sentence goes
// into the URL as text and is shown verbatim by flashText, exactly as it was before v0.252.0.
func flashForErr(err error) (string, []string) {
if err == nil {
return "", nil
}
if m, ok := util.AsMsg(err); ok {
return m.Key(), m.Args()
}
return err.Error(), nil
}
// flashArgParam is the repeated query parameter carrying a flash message's parameters, in order.
const flashArgParam = "fa"