v0.247.0: i18n spike — the dashboard can speak English, Hungarian byte-identical
gates / gates (push) Successful in 19s
gates / gates (push) Successful in 19s
Message bundles (internal/i18n) expanded into templates before parsing, one template set per language. Launcher, /backups, /apps/<slug> and the layout converted; household language setting, POST /settings/language, ?lang= override, report field. Parity test against fixtures captured from unconverted templates; copy gates read templates expanded; new i18n_missing_gate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package settings
|
||||
|
||||
import (
|
||||
"io"
|
||||
"log"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// i18n (v0.247.0): the household language. Default Hungarian; only a supported value is stored; the
|
||||
// choice survives a restart (it is what the hub report and every page read).
|
||||
func TestLanguageSetting(t *testing.T) {
|
||||
lg := log.New(io.Discard, "", 0)
|
||||
p := filepath.Join(t.TempDir(), "settings.json")
|
||||
s, err := Load(p, lg)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got := s.GetLanguage(); got != "hu" {
|
||||
t.Fatalf("a box that never chose must read Hungarian, got %q", got)
|
||||
}
|
||||
if err := s.SetLanguage("de"); err == nil || s.GetLanguage() != "hu" {
|
||||
t.Fatalf("unsupported language must be refused and change nothing (err=%v, lang=%q)", err, s.GetLanguage())
|
||||
}
|
||||
if err := s.SetLanguage("en"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
again, err := Load(p, lg)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got := again.GetLanguage(); got != "en" {
|
||||
t.Fatalf("language did not survive a reload: %q", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user