fix(i18n): take a catalog's language from its path, not its header

reason() calls itself the single source of truth for both ends of the
pipeline, and the write path honoured that: client.py:228 passes the
directory code into unmask(). Only damaged() read catalog.locale, so
for 50 catalogs the two ends judged against different languages.

44 catalogs carry no locale header, 8 of them non-Latin and therefore
silently past the script check. 6 more name a code their directory
disagrees with, so tl was judged as fil, bh as bho, tw as ak.

The language becomes a required parameter; both production callers
already held the code. Measured over every catalog, header language
against path language, one moves: core/av from 0 to 29. Those 29 hold
pseudo-Norwegian and a degeneration loop in a Cyrillic catalog, and
make i18n-prune has since cleared them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-10-19 12:56:40 +02:00
1 parent 7bd06e6a0b
commit ae06cb4b9b
4 files changed
+14 -7

No files matched your search

@@ -323,7 +323,7 @@ class TestDamagedMarkup(unittest.TestCase):
"Siehe [den Leitfaden]](docs/guide.md) zuerst.",
)
self.assertEqual(len(damaged(catalog)), 1)
self.assertEqual(len(damaged(catalog, "de")), 1)
def test_a_dropped_bracket_is_damage(self):
catalog = self._catalog(
@@ -331,7 +331,7 @@ class TestDamagedMarkup(unittest.TestCase):
"!Logo](assets/img/logo.png)",
)
self.assertEqual(len(damaged(catalog)), 1)
self.assertEqual(len(damaged(catalog, "de")), 1)
def test_an_intact_translation_is_not_damage(self):
catalog = self._catalog(
@@ -339,7 +339,7 @@ class TestDamagedMarkup(unittest.TestCase):
"Siehe [den Leitfaden](docs/guide.md) zuerst.",
)
self.assertEqual(damaged(catalog), [])
self.assertEqual(damaged(catalog, "de"), [])
class TestDuplicateTranslation(unittest.TestCase):