From d3d0416b45698b9d40700b2196400542dc77c9ce Mon Sep 17 00:00:00 2001 From: Elvis Claros Castro Date: Thu, 1 Oct 2026 18:21:23 -0300 Subject: Translate the CLI, the HTML page and the tests to English Everything the user sees is now in English: help text and examples, table headers, messages and errors, month names and relative dates, and every string in the generated page. Tests, fixtures, workflow comments and .gitignore follow. README.es.md stays as a Spanish translation of the docs. Visible changes: - --html writes sessions.html by default (sesiones.html stays ignored). - The delete prompt is [y/N] and no longer accepts "s"/"si". - The page stores the theme under cl-theme, so it is chosen again once. - --check report keys and the --html summary keys are now English. The --json format is unchanged. Version 1.2.0. --- tests/test_webpage.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'tests/test_webpage.py') diff --git a/tests/test_webpage.py b/tests/test_webpage.py index 06f2af7..18564cc 100644 --- a/tests/test_webpage.py +++ b/tests/test_webpage.py @@ -9,22 +9,22 @@ from claude_logbook import webpage PAYLOAD_RE = re.compile( r'', re.S) -LOG_NAME = {"id": "abc", "p": "/proj", "u": 1, "c": [{"r": "u", "x": "hola"}]} +LOG_NAME = {"id": "abc", "p": "/proj", "u": 1, "c": [{"r": "u", "x": "hello"}]} class TestPayload(unittest.TestCase): def test_escapes_the_closing_tag(self): - raw = webpage.encode_payload({"s": [{"x": "mirá este de acá"}]}) + raw = webpage.encode_payload({"s": [{"x": "look at this here"}]}) self.assertNotIn(" de acá") + self.assertEqual(json.loads(raw)["s"][0]["x"], "look at this here") def test_does_not_escape_to_ascii(self): - self.assertIn("ñ", webpage.encode_payload({"s": [{"x": "año"}]})) + self.assertIn("é", webpage.encode_payload({"s": [{"x": "café"}]})) def test_separates_sessions_from_memories(self): - payload = webpage.build_payload([LOG_NAME], [{"name": "algo"}]) + payload = webpage.build_payload([LOG_NAME], [{"name": "something"}]) self.assertEqual(payload["s"], [LOG_NAME]) - self.assertEqual(payload["m"], [{"name": "algo"}]) + self.assertEqual(payload["m"], [{"name": "something"}]) def test_no_memories_still_has_the_key(self): self.assertEqual(webpage.build_payload([LOG_NAME])["m"], []) @@ -38,23 +38,23 @@ class TestRender(unittest.TestCase): def test_fails_if_the_template_has_no_marker(self): with self.assertRaises(webpage.TemplateError): - webpage.render([LOG_NAME], template="sin marcador") + webpage.render([LOG_NAME], template="no marker") def test_fails_if_the_marker_is_repeated(self): with self.assertRaises(webpage.TemplateError): - webpage.render([LOG_NAME], template="__DATA__ y __DATA__") + webpage.render([LOG_NAME], template="__DATA__ and __DATA__") def test_transcript_with_html_does_not_cut_the_script(self): # The case that motivates the escape: a session that talked about this very # generator has "" and "__DATA__" inside the text. - dangerous = dict(LOG_NAME, c=[{"r": "u", "x": "poné y __DATA__"}]) + dangerous = dict(LOG_NAME, c=[{"r": "u", "x": "type and __DATA__"}]) html = webpage.render([dangerous]) blocks = PAYLOAD_RE.findall(html) self.assertEqual(len(blocks), 1) round_trip = json.loads(blocks[0]) self.assertEqual(round_trip["s"][0]["c"][0]["x"], - "poné y __DATA__") + "type and __DATA__") class TestTemplate(unittest.TestCase): @@ -65,7 +65,7 @@ class TestTemplate(unittest.TestCase): self.assertEqual(self.html.count(webpage.MARKER), 1) def test_is_a_complete_document(self): - # Sin doctype ni charset, un file:// se abre en quirks mode y con la + # Without doctype and charset, a file:// opens in quirks mode with the # system encoding: accents come out broken. self.assertTrue(self.html.lstrip().startswith("")) self.assertIn('', self.html) @@ -73,27 +73,27 @@ class TestTemplate(unittest.TestCase): self.assertTrue(self.html.rstrip().endswith("")) def test_makes_no_network_requests(self): - for atributo in ("src=\"http", "href=\"http", "@import"): - self.assertNotIn(atributo, self.html) + for attribute in ("src=\"http", "href=\"http", "@import"): + self.assertNotIn(attribute, self.html) def test_another_template_can_be_passed(self): with tempfile.NamedTemporaryFile("w", suffix=".html", delete=False, encoding="utf-8") as f: - f.write("propio __DATA__") + f.write("custom __DATA__") path_str = f.name self.addCleanup(os.unlink, path_str) - self.assertTrue(webpage.template_text(path_str).startswith("propio")) + self.assertTrue(webpage.template_text(path_str).startswith("custom")) class TestWrite(unittest.TestCase): - def test_escribe_y_resume(self): + def test_writes_and_summarizes(self): with tempfile.TemporaryDirectory() as d: out = os.path.join(d, "s.html") stats = webpage.write( - [LOG_NAME, dict(LOG_NAME, id="def", p="/otro", u=2)], out) - self.assertEqual(stats, {"sesiones": 2, "proyectos": 2, - "mensajes": 3, "bloques": 2, - "memorias": 0}) + [LOG_NAME, dict(LOG_NAME, id="def", p="/other", u=2)], out) + self.assertEqual(stats, {"sessions": 2, "projects": 2, + "messages": 3, "blocks": 2, + "memories": 0}) with open(out, encoding="utf-8") as f: self.assertEqual(len(PAYLOAD_RE.findall(f.read())), 1) -- cgit v1.2.3