комментарии и сообщения переведены на английский

- комментарии, тексты ошибок, вывод CLI и сообщения тестов теперь на английском
- по-русски остались только литералы словаря ru и содержимое фикстур: это
  данные под проверкой, а не текст инструмента
- согласование числительных в итоге упростилось до английского plural
This commit is contained in:
av
2026-07-27 10:04:27 +03:00
parent 0b8cc125b3
commit b2d07ae55d
17 changed files with 548 additions and 524 deletions
+17 -16
View File
@@ -7,7 +7,7 @@ import (
"git.vakhrushev.me/av/convy/internal/suite"
)
// Suite прогоняет все проверки набора и возвращает отчёт.
// Suite runs every check of a suite and returns the report.
func Suite(s *suite.Suite) *Report {
rep := &Report{}
checkManifest(s, rep)
@@ -23,17 +23,18 @@ func Suite(s *suite.Suite) *Report {
return rep
}
// checkManifest проверяет сам манифест: форму префиксов, непересечение живого
// с выбывшим, наличие объявленных файлов и отсутствие незарегистрированных.
// checkManifest checks the manifest itself: the shape of prefixes, live and
// retired not overlapping, the declared files being present and no undeclared
// ones lying around.
func checkManifest(s *suite.Suite, rep *Report) {
m := s.Manifest
for _, key := range m.Undecoded {
rep.Warnf(Manifest, manifest.Name, 0, "ключ %s инструменту неизвестен", key)
rep.Warnf(Manifest, manifest.Name, 0, "the key %s is unknown to the tool", key)
}
for _, name := range []string{m.Language.Description, m.Language.Reading} {
if name != "" && !s.Exists(name) {
rep.Errorf(Manifest, manifest.Name, 0, "секция [language] объявляет документ %q, а файла нет", name)
rep.Errorf(Manifest, manifest.Name, 0, "the [language] section declares the document %q, and the file is missing", name)
}
}
@@ -44,7 +45,7 @@ func checkManifest(s *suite.Suite, rep *Report) {
}
if m.PrefixRetired(prefix) {
rep.Errorf(Manifest, manifest.Name, 0,
"префикс %s значится и среди живых, и среди выбывших: выбывший не выдаётся повторно", prefix)
"prefix %s is listed both live and retired: a retired one is never reissued", prefix)
}
path := m.Prefixes.Live[prefix]
byPath[path] = append(byPath[path], prefix)
@@ -53,22 +54,22 @@ func checkManifest(s *suite.Suite, rep *Report) {
if prefixes := byPath[path]; len(prefixes) > 1 {
sort.Strings(prefixes)
rep.Errorf(Manifest, manifest.Name, 0,
"на файл %q объявлено несколько префиксов (%v): префикс принадлежит файлу", path, prefixes)
"the file %q has several prefixes declared for it (%v): a prefix belongs to one file", path, prefixes)
}
}
for prefix := range m.Prefixes.Retired {
if err := manifest.ValidPrefix(prefix); err != nil {
rep.Errorf(Manifest, manifest.Name, 0, "среди выбывших: %s", err)
rep.Errorf(Manifest, manifest.Name, 0, "among the retired ones: %s", err)
}
}
for _, prefix := range sortedKeys(s.Missing) {
rep.Errorf(Manifest, manifest.Name, 0,
"префикс %s объявлен за файлом %q, а файла в наборе нет", prefix, s.Missing[prefix])
"prefix %s is assigned to the file %q, which the suite does not hold", prefix, s.Missing[prefix])
}
for _, path := range s.Unregistered {
rep.Errorf(Manifest, path, 1,
"файл записан языком конвенций, но в манифесте набора не объявлен: для набора его нет")
"the file is written in the conventions language yet not declared in the suite manifest: for the suite it does not exist")
}
for _, err := range s.Broken {
rep.Errorf(Manifest, manifest.Name, 0, "%s", err)
@@ -77,18 +78,18 @@ func checkManifest(s *suite.Suite, rep *Report) {
for _, topic := range m.LiveTopics() {
if m.TopicRetired(topic) {
rep.Errorf(Manifest, manifest.Name, 0,
"тема %q значится и среди живых, и среди выбывших", topic)
"topic %q is listed both live and retired", topic)
}
if len(s.Layers(topic)) == 0 {
rep.Errorf(Manifest, manifest.Name, 0,
"тема %q объявлена живой, а слоёв у неё в наборе нет: тема живёт, пока есть хотя бы один слой", topic)
"topic %q is declared live while the suite holds no layer of it: a topic lives as long as at least one layer does", topic)
}
}
}
// checkBaseLayers проверяет, что у темы не больше одного слоя без ключей оси.
// Базовый слой единственный: он попадает в копию всегда, и второй такой
// означал бы два базовых текста в одном собранном файле.
// checkBaseLayers checks that a topic holds no more than one layer without axis
// keys. The base layer is the only one of its kind: it reaches every copy, and a
// second such layer would mean two base texts in one assembled file.
func checkBaseLayers(s *suite.Suite, rep *Report) {
for _, topic := range s.Manifest.LiveTopics() {
var base []string
@@ -101,7 +102,7 @@ func checkBaseLayers(s *suite.Suite, rep *Report) {
sort.Strings(base)
for _, path := range base[1:] {
rep.Errorf(Spread, path, 1,
"у темы %q больше одного слоя без ключей оси: базовый слой единственный, остальные — %v",
"topic %q holds more than one layer without axis keys: the base layer is the only one of its kind, and the candidates are %v",
topic, base)
}
}