docs: make English binding for everything written into this repository - #48
Merged
Conversation
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).
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
marked this pull request as ready for review
August 20, 2026 04:22
This was referenced Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Companion to the same policy in violet-hass#411.
What was German
This package is on PyPI and consumed by
violet-hassand by third parties. Parts of it were German:API für Violet Pool Controllerutils_sanitizer.pyutils_rate_limiter.pyRaises:lineThe two exception messages are the ones that actually leaked out of the library:
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.mdgets a## Language Policysection: 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 Englishdocs/*.md, and test names — all English.The two exceptions, kept deliberately
ERROR_CODESinconst_api.pyreproduces 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.mdalready hinted at this ("German error messages from the controller are preserved as-is"); it is now stated properly with the reason.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:für,über,nicht,wird, …; deliberately notin/die/der, which collide with English and identifiers)AGENTS.mdmust actually carry the policyThe 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:
The new tests found the German in
utils_sanitizer.pyandutils_rate_limiter.pyon 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 durchgehentoreadings.py:Not touched
README.md,SECURITY.mdandCODE_OF_CONDUCT.mdare already English.CHANGELOG.mdwas already English too — the policy just makes it binding.Generated by Claude Code