Improve logic for detecting unused ignore translations (#128441)

This commit is contained in:
epenet
2024-10-18 17:59:06 +02:00
committed by GitHub
parent 42e6ac4f6d
commit 120e17fa1e
9 changed files with 7 additions and 39 deletions

View File

@@ -475,14 +475,14 @@ async def _ensure_translation_exists(
) -> None:
"""Raise if translation doesn't exist."""
full_key = f"component.{component}.{category}.{key}"
if full_key in ignore_translations:
ignore_translations[full_key] = "used"
return
translations = await async_get_translations(hass, "en", category, [component])
if full_key in translations:
return
if full_key in ignore_translations:
ignore_translations[full_key] = "used"
return
key_parts = key.split(".")
# Ignore step data translations if title or description exists
if (