Skip to content

Commit

Permalink
Log error and continue on parsing issues of translated strings (#110046)
Browse files Browse the repository at this point in the history
  • Loading branch information
mib1185 authored and frenck committed Feb 9, 2024
1 parent 56ff767 commit e4382a4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion homeassistant/helpers/translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,13 @@ def _validate_placeholders(
for key, value in updated_resources.items():
if key not in cached_resources:
continue
tuples = list(string.Formatter().parse(value))
try:
tuples = list(string.Formatter().parse(value))
except ValueError:
_LOGGER.error(
("Error while parsing localized (%s) string %s"), language, key
)
continue
updated_placeholders = {tup[1] for tup in tuples if tup[1] is not None}

tuples = list(string.Formatter().parse(cached_resources[key]))
Expand Down

0 comments on commit e4382a4

Please sign in to comment.