Files
aego/engine/docs/translate_dedup_test.go
sanspie c3c6efdc71
ci / release (push) Skipped
ci-platforms / darwin amd64 smoke (push) Skipped
ci-platforms / windows amd64 smoke (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
github-native / gitea-pending (push) Skipped
github-native / darwin amd64 native (push) Skipped
github-native / linux amd64 native (push) Skipped
github-native / windows amd64 native (push) Skipped
github-native / darwin arm64 native (push) Skipped
github-native / gitea-result (push) Skipped
GitHub / darwin amd64 native GitHub-hosted native CI: success
GitHub / windows amd64 native GitHub-hosted native CI: failure
GitHub / darwin arm64 native GitHub-hosted native CI: success
GitHub / linux amd64 native GitHub-hosted native CI: success
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 18m33s
ci / checks (push) Failing after 59m31s
fix: synchronize localization catalogs
2026-11-10 01:57:44 +03:00

34 lines
1.3 KiB
Go

//go:build !aego_runtime
package docs
import "testing"
func TestLocalizeValueTypeKeepsAuthoredProseWithoutDuplication(t *testing.T) {
for _, tc := range []struct {
name, catalog, file, want string
}{
{"same body", "Тип материала.", "Тип материала.", "Тип материала."},
{"same body with whitespace", " Тип материала.\n", "Тип материала.", "Тип материала."},
{"complementary bodies", "Тип материала.", "Дополнительное описание.", "Тип материала.\n\nДополнительное описание."},
{"file only", "", "Описание из файла.", "Описание из файла."},
{"catalog only", "Описание из каталога.", "", "Описание из каталога."},
} {
t.Run(tc.name, func(t *testing.T) {
r := &Registry{entries: []Entry{{
ID: "engine.MaterialParameter", Kind: Type, Body: "Material parameter.",
Translations: map[string]Translation{"ru": {Body: tc.file}},
}}}
r.Localize("ru", func(key, en string) string {
if key == APIKey("engine.MaterialParameter") {
return tc.catalog
}
return en
})
if got := r.entries[0].Translations["ru"].Body; got != tc.want {
t.Fatalf("localized body = %q, want %q", got, tc.want)
}
})
}
}