Repository navigation
Add a consistency test over the translation files - #64
Merged
Merged
Conversation
PR #63 added the first non-English language file since fr.json, and nothing in CI looks at those files: hassfest validates strings.json and the English side only. A missing key falls back to English silently, and a placeholder renamed in translation renders the raw token to the user. The test asserts that strings.json and translations/en.json are identical, and that every other translations/*.json has the same leaf keys, the same {placeholder} tokens per key, and no blank strings. It picks up new languages automatically through a glob, guarded by a test that the glob is non-empty. Resolving paths from __file__ rather than importing the integration keeps the test free of the homeassistant dependency. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Mincka
added a commit
that referenced
this pull request
Jul 25, 2026
German translation (#63, thanks @vlntnwbr) and a consistency test over the translation files (#64). Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.
Description
Follow-up to #63, which added the first non-English language file since
fr.json.Nothing in CI currently validates the non-English translation files. hassfest checks
strings.jsonand the English side, and stops there. That means:{placeholder}renamed or dropped during translation renders the raw token to the user;strings.jsonandtranslations/en.jsonare maintained as byte-identical copies by hand, with nothing enforcing it.test/test_translations_consistency.pycloses all three. It asserts thatstrings.jsonandtranslations/en.jsonparse to the same content, and for every othertranslations/*.json: identical leaf-key sets, identical placeholder tokens per key, and no blank strings. New languages are picked up automatically through a glob, with a guard test so an empty glob cannot make the rest pass vacuously.Paths are resolved from
__file__rather than by importing the integration, so the test needs nohomeassistantimport and runs in milliseconds.It follows the shape of the existing
test/test_options_consistency.py, which guards the same class of silent drift on the options side.Scope note: this catches structural drift, not translation quality. The five content errors corrected in #63 (a leftover English fragment, a typo, a mistranslation, two casing errors) were all key-parity-clean and no automated check would have caught them.
Type of Change
Checklist
🤖 Generated with Claude Code