R-575: the overcommit warning follows the reader's language

memoryVerdict returns the warning's bundle KEY (KeyMemoryOvercommitWarning)
and DeployStack hands it on; the API renders it per request
(deployWarningData). msgHU, whose only use this was, is gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
2026-10-05 22:42:21 +02:00
parent b36a85ac04
commit b05be0ac11
5 changed files with 81 additions and 26 deletions
+5 -20
View File
@@ -2,8 +2,6 @@ package stacks
import (
"errors"
"gitea.dooplex.hu/admin/felhom-controller/internal/i18n"
)
// R-553 — the deploy path's refusals carry a KIND, so the API can pick its status code without
@@ -32,21 +30,8 @@ var (
ErrStackDeploying = errors.New("stack is being deployed")
)
// msgHU renders a bundle message in Hungarian.
//
// It exists for the few strings this package returns as TEXT rather than as an error — the soft
// overcommit warning is the only one today. Those are display strings with no error to carry a key,
// so the copy lives in the bundle (a translator sees it, and scripts/i18n_go_parity.py pins it) while
// the value handed back is still Hungarian. **The consequence, stated rather than hidden: such a
// string renders Hungarian on an English page.** Filed as R-575; the fix is for the caller to carry
// the key the way Alert and UpdateRefusal do, not for this helper to guess a language it cannot know.
func msgHU(key string, args ...interface{}) string {
b, err := i18n.Shared()
if err != nil {
return key
}
if len(args) == 0 {
return b.Msg(i18n.Default, key)
}
return b.Msgf(i18n.Default, key, args...)
}
// KeyMemoryOvercommitWarning is the soft overcommit warning's bundle key. It travels as a KEY from
// memoryVerdict through DeployStack to the API, which renders it in the request's language (R-575 —
// it used to be rendered here in Hungarian, so an English page showed a Hungarian line). Pinned by
// TestR575_OvercommitWarningFollowsTheLanguage.
const KeyMemoryOvercommitWarning = "err.stacks.memory_overcommit_warning"