# HG changeset patch # User paulb # Date 1133574731 0 # Node ID 0095469d53a231a875019cdfe53f01d4d298c7d1 # Parent 6d38898e4c4ad57330dd1517bf718c3edebb68c3 [project @ 2005-12-03 01:52:11 by paulb] Fixed the i18n function to handle node lists as well as strings. diff -r 6d38898e4c4a -r 0095469d53a2 XSLForms/Output.py --- a/XSLForms/Output.py Fri Dec 02 23:33:36 2005 +0000 +++ b/XSLForms/Output.py Sat Dec 03 01:52:11 2005 +0000 @@ -324,10 +324,20 @@ Exposed as {template:i18n(value)}. Provides a translation of the given 'value' using the 'translations' and - 'locale' variables defined in the output stylesheet. + 'locale' variables defined in the output stylesheet. The 'value' may be a + string or a collection of nodes, each having a textual value, where such + values are then concatenated to produce a single string value. """ - value = unicode(value, libxml2_encoding) + if isinstance(value, str): + value = unicode(value, libxml2_encoding) + else: + l = [] + for node in value: + s = libxml2dom.Node(node).nodeValue + l.append(s) + value = "".join(l) + context = libxml2mod.xmlXPathParserGetContext(context) transform_context = libxsltmod.xsltXPathGetTransformContext(context) translations_var = libxsltmod.xsltVariableLookup(transform_context, "translations", None)