Fix hassfest validation: move URLs from translations to placeholders#249
Conversation
Home Assistant PR #154224 (merged Jan 27, 2026) introduced validation that prevents URLs from being directly embedded in translation strings. This commit implements the proper solution using description placeholders: - Created strings.json with URL placeholders for form steps - Added URL constants and placeholder functions in config_flow.py - Updated SchemaFlowFormStep instances to inject URLs via description_placeholders - Removed URLs from menu step descriptions (SchemaFlowMenuStep doesn't support placeholders) This keeps the URLs maintainable in code while allowing translators to work with clean, locale-agnostic strings. Fixes hassfest validation failures reported in issue #154226 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Home Assistant now requires the hass parameter when creating Template objects (will be mandatory in 2025.10). Updated three failing tests to pass coordinator.hass to Template constructor. Fixes test_start_with_counter, test_start_with_source, and test_start_with_time. All 126 tests now passing. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Home Assistant now uses strings.json as the primary translation file. The old translations/en.json with embedded URLs is no longer needed. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
strings.json is for core HA integrations. Custom integrations use translations/en.json at runtime. URLs are removed from translations and injected via description_placeholders in config_flow.py. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The placeholders {buymeacoffee_url}, {device_class_url}, and
{state_class_url} are now in the translation strings and will be
replaced with actual URLs by the description_placeholders functions
at runtime.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis PR updates the development container configuration with new features (Node 24, GitHub CLI, and Claude Code), refactors the MeasureIt component's config flow to use URL placeholders instead of hardcoded links, updates corresponding translations, bumps a test dependency version, and fixes template initialization in unit tests. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
✨ Finishing touches
🧪 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 |
Summary
Fixes hassfest validation failures caused by URLs in translation strings.
Home Assistant PR #154224 (merged Jan 27, 2026) introduced validation that prevents URLs from being directly embedded in translation strings.
Changes
translations/en.jsonto use placeholders ({buymeacoffee_url},{device_class_url},{state_class_url}) instead of hardcoded URLsconfig_flow.pyto inject URLs at runtime viadescription_placeholderstest_coordinator.pyto passhassparameter to Template constructor (now required in newer HA versions)Testing
Related
🤖 Generated with Claude Code
Summary by CodeRabbit
Chores
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.