Skip to content

docs: make English binding for everything written into this repository - #48

Merged
Xerolux merged 3 commits into
mainfrom
claude/language-policy
Aug 20, 2026
Merged

docs: make English binding for everything written into this repository#48
Xerolux merged 3 commits into
mainfrom
claude/language-policy

Conversation

@Xerolux

@Xerolux Xerolux commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Companion to the same policy in violet-hass#411.

What was German

This package is on PyPI and consumed by violet-hass and by third parties. Parts of it were German:

Where What
All 12 modules Header comment: API für Violet Pool Controller
utils_sanitizer.py 13 lines — module docstring, class docstring, comments, log messages, and two exception messages
utils_rate_limiter.py 6 lines — module docstring, comments, a Raises: line

The two exception messages are the ones that actually leaked out of the library:

msg = "Device-Key darf nicht leer sein"
msg = "API-Parameter darf nicht leer sein"

A consumer passing a bad key got a German error. Both are now English ("Device key must not be empty", "API parameter must not be empty"). Worth knowing if anything downstream matched on the text — nothing in this repo did, and the full suite confirms it.

The rule

AGENTS.md gets a ## Language Policy section: changelog, commit messages, branch names, PR titles and bodies, code comments, docstrings, file headers, library log and exception text, the top-level markdown documents, the English docs/*.md, and test names — all English.

The two exceptions, kept deliberately

  1. Text the controller itself emits. ERROR_CODES in const_api.py reproduces the device's German messages verbatim ("Filterdrucküberwachung (Druck zu niedrig)"), as does the mock server's payload. That is data, not prose — translating it would break the match with what the hardware actually says, and consumers rely on the exact strings. AGENTS.md already hinted at this ("German error messages from the controller are preserved as-is"); it is now stated properly with the reason.
  2. docs/de/*.md — the German half of the bilingual documentation. The English page is written first, the German one translates it.

Tests

tests/test_language_policy.py — otherwise the policy is a comment, not a rule:

  • every Python file outside the two exempt ones is scanned for German function words (für, über, nicht, wird, …; deliberately not in/die/der, which collide with English and identifiers)
  • the changelog is scanned the same way
  • the controller's error strings are asserted to still be German — the exemption is the point, not an oversight, so a well-meant "cleanup" of the error table fails the suite too
  • AGENTS.md must actually carry the policy

The test file exempts itself, since it has to name the German words it looks for.

Verification

This repo's suite runs in this environment (no Home Assistant dependency), so this is measured, not inferred:

249 passed in 1.85s        (221 before)
python -m ruff check .  →  All checks passed!

The new tests found the German in utils_sanitizer.py and utils_rate_limiter.py on their first run — they were not written to match a known list.

And the guard fails when violated — a test that cannot fail is not a guard. Appending # Dieser Kommentar sollte nicht durchgehen to readings.py:

FAILED tests/test_language_policy.py::test_python_sources_are_english[readings.py]
1 failed, 27 passed

Not touched

README.md, SECURITY.md and CODE_OF_CONDUCT.md are already English. CHANGELOG.md was already English too — the policy just makes it binding.


Generated by Claude Code

This package is published on PyPI and consumed by violet-hass and by third
parties, but parts of it were German: the header comment of all 12 modules,
and the comments, docstrings, log messages and exception text of
utils_sanitizer.py and utils_rate_limiter.py. Two of those German strings were
raised to callers - "Device-Key darf nicht leer sein" and "API-Parameter darf
nicht leer sein" - so a consumer's error output was German too.

AGENTS.md now carries the rule as a table, and names the two exceptions
explicitly because both are deliberate:

1. Text the controller itself emits. ERROR_CODES in const_api.py reproduces
   the device's German messages verbatim, as does the mock server's payload.
   That is data, not prose - translating it would break the match with what
   the hardware actually says.
2. docs/de/*.md, the German half of the bilingual documentation. The English
   page is written first and the German one translates it.

tests/test_language_policy.py keeps it from decaying: every Python file
outside the two exempt ones is scanned for German function words, the
changelog is scanned as well, and the controller's error strings are asserted
to still be German - the exemption is the point, not an oversight, so a
well-meant cleanup of the error table fails the suite too.

249 tests pass (221 before).
claude added 2 commits August 20, 2026 04:19
An entry that removes a German exception message has to be able to quote it.
Code spans are quotations, not prose, so the scan skips them - and still
catches German outside them, which the injected line confirms.
@Xerolux
Xerolux marked this pull request as ready for review August 20, 2026 04:22
@Xerolux
Xerolux merged commit 43b03bf into main Aug 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants