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
@@ -4,6 +4,7 @@ import (
"net/http"
"net/http/httptest"
"net/url"
"strconv"
"strings"
"testing"
@@ -163,3 +164,56 @@ func flashSentence(t *testing.T, location string) string {
}
return ""
}
// TestPluralEnglish — localisation slice 2 release B (R-557), scenario S4.
//
// English needs two forms where the noun or the verb changes with the count; Hungarian does not
// inflect after a numeral and therefore has ONE form, which is the form it already had. So this test
// asserts two different things about the same message: that English changes with the count, and that
// Hungarian does NOT — the second is the parity half, and it is the one that would fail silently.
//
// It goes through the real producer (buildDeadAppAlerts → GetAlerts), not through the bundle, so it
// also pins that the alert path carries the count as its first parameter, which is what the plural
// rule in i18n.Bundle.form depends on.
func TestPluralEnglish(t *testing.T) {
dead := func(n int) []DeadApp {
out := make([]DeadApp, 0, n)
for i := 0; i < n; i++ {
out = append(out, DeadApp{Name: "app" + strconv.Itoa(i), DisplayName: "App " + strconv.Itoa(i)})
}
return out
}
// Above deadAppGroupThreshold the banner collapses to ONE counted sentence — that is the message
// with a count in it. 4 and 7 are both "other"; there is no "one" case for the grouped banner by
// construction, so the singular is checked on the bundle directly below.
am := NewAlertManager(nil)
am.SetDeadAppAlerts(dead(4))
hu4 := am.GetAlerts("hu")[0].Message
en4 := am.GetAlerts("en")[0].Message
am.SetDeadAppAlerts(dead(7))
hu7 := am.GetAlerts("hu")[0].Message
en7 := am.GetAlerts("en")[0].Message
if hu4 != "4 telepített alkalmazás nem fut — nézze meg a rendszermonitort" {
t.Errorf("the Hungarian sentence moved: %q", hu4)
}
if hu7 != "7 telepített alkalmazás nem fut — nézze meg a rendszermonitort" {
t.Errorf("the Hungarian sentence moved: %q", hu7)
}
if !strings.Contains(en4, "4 installed apps are not running") {
t.Errorf("English plural: %q", en4)
}
if !strings.Contains(en7, "7 installed apps are not running") {
t.Errorf("English plural: %q", en7)
}
// The singular, straight off the bundle: same key, count 1.
b := flashServer(t).i18n
if got := b.Msgf("en", "alert.deadapp.group", 1); !strings.Contains(got, "1 installed app is not running") {
t.Errorf("English singular: %q", got)
}
// And Hungarian at 1 is the SAME single form — no .one, no change.
if got := b.Msgf("hu", "alert.deadapp.group", 1); got != "1 telepített alkalmazás nem fut — nézze meg a rendszermonitort" {
t.Errorf("Hungarian must have one form at every count: %q", got)
}
}