mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 22:37:29 +00:00
fix(i18n): keep letter-digit names like S3 and OAuth2 whole
PROTECTED masked identifiers with an underscore and bare numbers, so S3, OAuth2, POP3 and HTML5 went to the engines as a word plus a separately protected digit. Engines tore them ('Amazon S ilə uyğun ...' for 'S3-compatible') or glued the digit onto another word ('Distribuid3-compatible'); the masking audit over core found 159 such entries.
A letter-digit token is now one protected span, ahead of the bare-number alternative. The client masks it whole, and damage.reason() condemns a translation that lost or moved it, so prune and retranslation pick those entries up.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d6f76007d9
commit
de29b99a89
3 files changed
+24
No files matched your search
@@ -62,6 +62,24 @@ class TestAddedLines(unittest.TestCase):
|
||||
)
|
||||
|
||||
|
||||
class TestLetterDigitTokens(unittest.TestCase):
|
||||
"""A name that carries its version digit is one token the translation must keep whole."""
|
||||
|
||||
SOURCE: ClassVar[str] = "S3-compatible object storage shared by the roles"
|
||||
|
||||
def test_a_token_torn_from_its_digit_is_condemned(self) -> None:
|
||||
answer = "Amazon S ilə uyğun obyekt saxlama, rollar arasında paylaşılan"
|
||||
self.assertEqual(reason(self.SOURCE, answer, "az"), "protected-span")
|
||||
|
||||
def test_a_token_moved_onto_another_word_is_condemned(self) -> None:
|
||||
answer = "Distribuid3-compatible obyekt stora agaaniin share"
|
||||
self.assertEqual(reason(self.SOURCE, answer, "aa"), "protected-span")
|
||||
|
||||
def test_a_rendering_keeping_the_token_is_kept(self) -> None:
|
||||
answer = "S3-kompatibler Objektspeicher, den die Rollen teilen"
|
||||
self.assertEqual(reason(self.SOURCE, answer, "de"), "")
|
||||
|
||||
|
||||
class TestWrongNonLatinScript(unittest.TestCase):
|
||||
"""A language written in a non-Latin script came back in another non-Latin one."""
|
||||
|
||||
|
||||
@@ -152,6 +152,11 @@ class TestIdentifiersStayIntact(unittest.TestCase):
|
||||
|
||||
self.assertIn("{% if enabled %}", masked.spans)
|
||||
|
||||
def test_a_letter_digit_token_is_masked_whole(self):
|
||||
masked = mask("Serves OAuth2 and POP3 over an S3-compatible store in HTML5.")
|
||||
|
||||
self.assertEqual(masked.spans, ("OAuth2", "POP3", "S3", "HTML5"))
|
||||
|
||||
def test_prose_without_an_underscore_stays_translatable(self):
|
||||
source = "The deploy writes a file to the host and then restarts it."
|
||||
|
||||
|
||||
Reference in new issue
Block a user