Files
aego/tests/integration/i18n_test.go
sanspie f22242e5aa
ci / release (push) Successful in 5m5s
ci-platforms / build (amd64, windows, windows-2022) (push) Skipped
ci-platforms / build (arm64, darwin, macos-15) (push) Skipped
ci-platforms / build (amd64, darwin, macos-15-intel) (push) Skipped
ci / checks (push) Successful in 4m41s
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 7m14s
Stage 11g2–11g3: registry texts, CLI and the site in Russian (D348)
The remaining editor strings and undo step names; component, field, enum, setting, diagnostic and Script API texts under schema.*, enum.*, setting.*, diag.* and api.*; the launcher, the in-game Settings View with a Language setting, the CLI and aego schema show --lang. Every documentation page has a .ru.md translation; the site has a full Russian tree with hreflang, a language switch and ru/llms.txt; aego docs check --lang ru. New doc.tutorial and doc.recipe icons. Fix: an animator restored by a rewind prepares its controller before the replayed step.
2026-10-25 15:31:22 +03:00

74 lines
2.1 KiB
Go

package integration
import (
"testing"
"aego/app/assembly"
"aego/app/assembly/builtin"
"aego/engine/i18n"
"aego/engine/settings"
"aego/schema"
"aego/script/bind"
"aego/script/diag"
)
// Built-in modules register their catalogs through Registry.Messages, under i18n.<module>.* (D348).
func TestModuleCatalogsLoad(t *testing.T) {
workspaceSession(t)
b := i18n.Default()
b.SetLanguage(i18n.Russian)
defer b.SetLanguage(i18n.English)
for key, en := range map[string]string{
"i18n.physics.gravity": "Gravity",
"i18n.input.add_action": "Add Action",
"i18n.audio.mixer.title": "Audio Mixer",
} {
if got := i18n.Lookup(key, en); got == en {
t.Errorf("%s has no Russian text after the session loaded the module catalogs", key)
}
}
}
// Component names, field labels, enum values, settings and script diagnostics come from the data catalog (11g2, D348).
func TestRegistryTextsInRussian(t *testing.T) {
types, err := assembly.NewTypes()
if err != nil {
t.Fatal(err)
}
if _, err := builtin.Default().Load(types, bind.New(), assembly.Options{}); err != nil {
t.Fatal(err)
}
body, ok := types.Schema().ByName("physics.Body2D")
if !ok {
t.Fatal("no physics.Body2D")
}
motion, _ := types.Schema().ByName("gameplay.Motion2D")
b := i18n.Default()
b.SetLanguage(i18n.Russian)
defer b.SetLanguage(i18n.English)
typ := &body.Fields[0]
for i := range body.Fields {
if body.Fields[i].Name == "type" {
typ = &body.Fields[i]
}
}
for got, want := range map[string]string{
schema.Title(body): "Тело 2D",
schema.Title(motion): "Движение 2D",
schema.FieldLabel(body, typ): "Тип",
schema.EnumLabel(typ, 0): "статическое",
settings.CategoryText("Display"): "Экран",
} {
if got != want {
t.Errorf("got %q, want %q", got, want)
}
}
if h, _ := diag.Localized("AES2001"); h.What != "Это имя не объявлено в данной области видимости." {
t.Errorf("AES2001 in Russian: %q", h.What)
}
b.SetLanguage(i18n.English)
if schema.Title(body) != "Rigid Body 2D" || schema.EnumLabel(typ, 0) != "static" {
t.Error("English texts changed")
}
}