Fix translated placeholders in translations#1280
Conversation
📝 WalkthroughWalkthroughThis PR corrects translation placeholder mismatches across ten language files and adds automated validation to prevent future inconsistencies. Placeholder keys are standardized to match English templates, malformed placeholders are fixed, and selected translation texts are updated to English equivalents. A new test validates all translations maintain consistent placeholders with the English source. ChangesTranslation placeholder fixes and validation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1280 +/- ##
=======================================
Coverage 62.38% 62.38%
=======================================
Files 123 123
Lines 3126 3126
Branches 402 402
=======================================
Hits 1950 1950
Misses 1128 1128
Partials 48 48 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
custom_components/spook/translations/sk.json (1)
225-226: 💤 Low valueNote: Mixed language state in issue entry.
The description (line 225) is now in English while the title (line 226) remains in Slovak. According to the AI summary, this fixes a malformed placeholder (
ententity_id}→{entity_id}). The English fallback ensures placeholder correctness but creates temporary language inconsistency.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@custom_components/spook/translations/sk.json` around lines 225 - 226, The description string under the "description" key is in English while the "title" remains Slovak, creating a mixed-language entry; replace the English description with a correct Slovak translation (preserving all placeholders: {automation}, {edit}, {entity_id}, {areas}) so the entry is consistent and the fixed placeholder `{entity_id}` stays intact; update only the "description" value for the same keys shown to Slovak and leave "title" as-is.custom_components/spook/translations/nb.json (1)
249-250: 💤 Low valueNote: Mixed language state in issue entries.
Both
group_unknown_membersandintegration_unknown_sourcenow have English descriptions (lines 249, 253) while their titles (lines 250, 254) remain in Norwegian. This ensures placeholder correctness but creates temporary language inconsistency within each issue entry.Also applies to: 253-254
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@custom_components/spook/translations/nb.json` around lines 249 - 250, The JSON entries for group_unknown_members and integration_unknown_source have English "description" values while their "title" values are Norwegian, causing mixed-language UI text; update the "description" strings for the keys group_unknown_members and integration_unknown_source in custom_components/spook/translations/nb.json so they are fully translated into Norwegian (preserve placeholders like {group}, {entity_id}, {entities}, etc.), or alternatively translate the "title" to English if the intent is English—ensure both title and description are in the same language and that all placeholders remain unchanged.custom_components/spook/translations/ja.json (1)
285-286: 💤 Low valueNote: Partial English fallback.
The description (line 285) was updated to English, but the title (line 286) remains in Japanese:
"未知の実体: {script}". While the placeholder{script}is correct, this creates an inconsistency within the same issue entry.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@custom_components/spook/translations/ja.json` around lines 285 - 286, The JSON entry has mixed-language values: the "description" value was changed to English but the "title" remains Japanese ("未知の実体: {script}"), causing an inconsistent translation; update the "title" string to an English equivalent such as "Unknown entity: {script}" (preserve the {script} placeholder exactly) so both "description" and "title" use English and remain consistent.custom_components/spook/translations/da.json (1)
242-242: 💤 Low valueNote: Mixed language state in issue entry.
The title is now in English while the description (line 241) remains in Danish. This creates a temporary inconsistency within the
automation_unknown_label_referencesissue entry, though it ensures the placeholder contract is correct.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@custom_components/spook/translations/da.json` at line 242, The "title" value for the translation entry automation_unknown_label_references is in English while the rest of that entry is Danish; update the "title" string in custom_components/spook/translations/da.json (automation_unknown_label_references.title) to the correct Danish translation and preserve the placeholder {automation} exactly as-is so the placeholder contract remains unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@custom_components/spook/translations/da.json`:
- Line 242: The "title" value for the translation entry
automation_unknown_label_references is in English while the rest of that entry
is Danish; update the "title" string in
custom_components/spook/translations/da.json
(automation_unknown_label_references.title) to the correct Danish translation
and preserve the placeholder {automation} exactly as-is so the placeholder
contract remains unchanged.
In `@custom_components/spook/translations/ja.json`:
- Around line 285-286: The JSON entry has mixed-language values: the
"description" value was changed to English but the "title" remains Japanese
("未知の実体: {script}"), causing an inconsistent translation; update the "title"
string to an English equivalent such as "Unknown entity: {script}" (preserve the
{script} placeholder exactly) so both "description" and "title" use English and
remain consistent.
In `@custom_components/spook/translations/nb.json`:
- Around line 249-250: The JSON entries for group_unknown_members and
integration_unknown_source have English "description" values while their "title"
values are Norwegian, causing mixed-language UI text; update the "description"
strings for the keys group_unknown_members and integration_unknown_source in
custom_components/spook/translations/nb.json so they are fully translated into
Norwegian (preserve placeholders like {group}, {entity_id}, {entities}, etc.),
or alternatively translate the "title" to English if the intent is
English—ensure both title and description are in the same language and that all
placeholders remain unchanged.
In `@custom_components/spook/translations/sk.json`:
- Around line 225-226: The description string under the "description" key is in
English while the "title" remains Slovak, creating a mixed-language entry;
replace the English description with a correct Slovak translation (preserving
all placeholders: {automation}, {edit}, {entity_id}, {areas}) so the entry is
consistent and the fixed placeholder `{entity_id}` stays intact; update only the
"description" value for the same keys shown to Slovak and leave "title" as-is.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7f6d74b3-0fbd-49e4-8807-c2b5b3eb3107
📒 Files selected for processing (11)
custom_components/spook/translations/af.jsoncustom_components/spook/translations/da.jsoncustom_components/spook/translations/he.jsoncustom_components/spook/translations/hr.jsoncustom_components/spook/translations/ja.jsoncustom_components/spook/translations/nb.jsoncustom_components/spook/translations/pt-BR.jsoncustom_components/spook/translations/sk.jsoncustom_components/spook/translations/th.jsoncustom_components/spook/translations/tr.jsontests/test_translations.py



Description
Fixes all translation strings where placeholders no longer match the English source strings.
This touches 39 strings across 10 locale files. Clear placeholder renames, like
{titel}and{uređaji}, are corrected in place. Strings that were missing or badly mangled now fall back to the English source string so runtime formatting gets the exact placeholder contract again.It also adds a regression test that compares placeholders in every locale file with
en.json, so translated placeholder names are caught before merge.Motivation and Context
Placeholders are runtime format keys, not translatable prose. If a locale changes
{title}to{titel}, or drops{entity_id}, Home Assistant cannot format the repair text correctly.We already saw this in a few PRs. This cleans up the remaining cases in one pass and adds a guard for future translation changes.
How has this been tested?
pythonplaceholder parity probe against all locale filesuv run check-json custom_components/spook/translations/<locale>.jsonfor all translation filesuv run pytest tests/test_translations.py -quv run ruff check tests/test_translations.pyuv run ruff format --check tests/test_translations.pyuv run pylint tests/test_translations.pyScreenshots (if appropriate):
Not applicable.
Types of changes
Checklist