Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ Changes

In next release ...

- ...
- In `fast_translate` don't try to translate a message which is not
hashable (i.e., typically a list or dict).
(`#441 <https://github.com/malthe/chameleon/issues/441>`_)

4.6.0 (2024-12-31)
------------------
Expand Down
3 changes: 2 additions & 1 deletion src/chameleon/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ def fast_translate(
if msgid is None:
return None

if target_language is not None or context is not None:
if (target_language is not None or context is not None) and \
msgid.__hash__ is not None:
result: str = translate(
msgid, domain=domain, mapping=mapping, context=context,
target_language=target_language, default=default)
Expand Down