fix(i18n): apply the name rule to the core domain too

The two domains are built apart: docs passes through sphinx, where the
transform withholds a message that is nothing but a name, while core builds
its template straight from role descriptions, categories and menu labels. A
sphinx extension never reaches it, so the same message could be withheld from
one catalog and carried by the other.

build_template now applies the same predicate.

Its effect today is nil: counted directly, none of core's 421 messages is
withheld, and the extract reports 0 catalogs changed. This is an assurance for
what gets added rather than a repair of what is there - a role description
that is only a product name would have slipped through before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-09-25 21:21:18 +02:00
1 parent a8a752ffc0
commit caee86e168
2 files changed
+28 -2

No files matched your search

@@ -12,6 +12,25 @@ from utils.i18n.catalog import (
from utils.i18n.translate import pending
class TestBuildTemplate(unittest.TestCase):
def test_a_message_that_is_only_a_name_never_enters_the_template(self) -> None:
template = build_template(
[("a", "Mastodon"), ("b", "Mastodon is a federated network.")], "core"
)
self.assertEqual(
[message.id for message in template if message.id],
["Mastodon is a federated network."],
"core never passes through sphinx, so without this the docs domain "
"withholds a name its own catalog still carries",
)
def test_a_message_without_a_word_never_enters_the_template(self) -> None:
template = build_template([("a", "`x`"), ("b", "Real prose.")], "core")
self.assertEqual([message.id for message in template if message.id], ["Real prose."])
class TestMerge(unittest.TestCase):
def test_changed_source_comes_back_empty_for_the_translator(self):
catalog = merge(build_template([("a", "Hello world")], "core"), None, "de")