Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log error and continue on parsing issues of translated strings #110046

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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(

Check warning on line 279 in homeassistant/helpers/translation.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/helpers/translation.py#L278-L279

Added lines #L278 - L279 were not covered by tests
("Error while parsing localized (%s) string %s"), language, key
)
continue

Check warning on line 282 in homeassistant/helpers/translation.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/helpers/translation.py#L282

Added line #L282 was not covered by tests
updated_placeholders = {tup[1] for tup in tuples if tup[1] is not None}

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