v0.248.0: i18n slice 1 release A — apps and settings in English, Hungarian byte-identical (R-556)
gates / gates (push) Successful in 20s
gates / gates (push) Successful in 20s
Ten pages converted against fixtures captured from unconverted templates (6be55a0); marker
coverage test; English page mask narrowed; English retrieval-promise stems; common keys;
title keys and infraMeta from the bundle; old wording tests read the Hungarian expansion.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
@@ -156,6 +156,15 @@ func TestLocaleFuncsHungarianBundleMatchesFuncMap(t *testing.T) {
|
||||
if got, want := b.Msg("hu", "func.time.yesterday"), timeAgo(now.Add(-30*time.Hour)); got != want {
|
||||
t.Errorf("yesterday: %q vs %q", got, want)
|
||||
}
|
||||
// infraMeta (slice 1): the Hungarian bundle carries the same curated words as inframeta.go.
|
||||
for name, m := range infraMetaMap {
|
||||
if got := b.Msg("hu", "func.infra."+name+".description"); got != m.Description {
|
||||
t.Errorf("infra %s description: hu.json %q, inframeta.go %q", name, got, m.Description)
|
||||
}
|
||||
if k := "func.infra." + name + ".display"; b.Has("hu", k) && b.Msg("hu", k) != m.DisplayName {
|
||||
t.Errorf("infra %s display: hu.json %q, inframeta.go %q", name, b.Msg("hu", k), m.DisplayName)
|
||||
}
|
||||
}
|
||||
// And the English funcs really are English.
|
||||
en := s.localeFuncs("en")
|
||||
if got := en["timeAgo"].(func(time.Time) string)(now.Add(-time.Minute - time.Second)); got != "1 minute ago" {
|
||||
@@ -238,3 +247,19 @@ func TestLanguageSwitch_EndToEnd(t *testing.T) {
|
||||
t.Error("back on Hungarian: the page must be Hungarian with no switch")
|
||||
}
|
||||
}
|
||||
|
||||
// huTemplateSource returns an embedded template AS THE HUNGARIAN SET PARSES IT — markers expanded. Tests
|
||||
// that assert on a template's Hungarian wording read this, never the raw file: since slice 1 the
|
||||
// wording lives in hu.json, and a raw read would find a marker where the sentence used to be.
|
||||
func huTemplateSource(name string) ([]byte, error) {
|
||||
raw, err := templateFS.ReadFile(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b, err := i18n.Shared()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out, _ := b.Expand(i18n.Default, string(raw))
|
||||
return []byte(out), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user