# HG changeset patch # User cmlenz # Date 1213717634 0 # Node ID df2eda814f2d6b354e1c14cca42dd9ea8c15e4a6 # Parent 6a424a74f5be8b2fcd1747d1bc89285c9ac1a69b Fix for I18n filter problem with lazy translation functions. Closes #145. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,10 @@ * Fix problem with nested match templates not being applied when buffering on the outer `py:match` is disabled. Thanks to Erik Bray for reporting the problem and providing a test case! + * Fix problem in `Translator` filter that would cause the translation of + text nodes to fail if the translation function returned an object that was + not directly a string, but rather something like an instance of the + `LazyProxy` class in Babel (ticket #145). Version 0.5 diff --git a/genshi/filters/i18n.py b/genshi/filters/i18n.py --- a/genshi/filters/i18n.py +++ b/genshi/filters/i18n.py @@ -185,7 +185,7 @@ if not msgbuf: text = data.strip() if text: - data = data.replace(text, translate(text)) + data = data.replace(text, unicode(translate(text))) yield kind, data, pos else: msgbuf.append(kind, data, pos)