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 -1
View File
@@ -140,7 +140,43 @@ func (b *Bundle) Msg(lang, key string) string {
// compares the verbs with the indexes stripped, so a reordered English still has to use the same
// verbs on the same values.
func (b *Bundle) Msgf(lang, key string, a ...interface{}) string {
return fmt.Sprintf(b.Msg(lang, key), a...)
return fmt.Sprintf(b.form(lang, key, a), a...)
}
// form picks the message a Msgf call should use, applying ONE plural rule, stated here and nowhere
// else (v0.253.0, slice 2 release B):
//
// A KEY THAT CARRIES `.one`/`.other` FORMS IN A LANGUAGE IS A PLURAL KEY, AND ITS FIRST PARAMETER
// IS THE COUNT.
//
// Hungarian never carries those forms — it does not inflect a noun after a numeral — so a Hungarian
// render is `Msg(key)` exactly as before, byte for byte, whatever the count. English carries them
// where the noun changes ("1 app is", "3 apps are"), and gets them with no change at any call site:
// a handler, an alert and an error all go through Msgf.
//
// Deliberately not a per-call-site flag. A flag would have to be set at every producer of every
// count message, in three packages, and the one that was forgotten would read "3 app is not running"
// with nothing to catch it. The bundle is where a translator works, so the bundle is where the fact
// that English needs two forms belongs. TestPluralFirstArgIsNumeric pins the other half of the rule:
// every `.one`/`.other` value's first verb is a numeric one, so "first parameter is the count" is
// true of the values as written and not only of the ones anybody happened to check.
func (b *Bundle) form(lang, key string, a []interface{}) string {
lang = Normalize(lang)
if len(a) == 0 {
return b.Msg(lang, key)
}
n, ok := a[0].(int)
if !ok {
return b.Msg(lang, key)
}
suffix := ".other"
if n == 1 {
suffix = ".one"
}
if v, found := b.msgs[lang][key+suffix]; found {
return v
}
return b.Msg(lang, key)
}
// Plural picks a count-dependent form and formats n into it (%d). Hungarian does not inflect a noun