Translates the text of element plus the text of all child
elements.
If 'attr' is present this is used to provide the locale name; if not
then the value provided by 'get_locale' is used. For example:
<div lang="">
this is a test
<a href="de">testing</a>
</div>
The string 'this is a test' is rendered by the locale provided by
'get_locale', the string 'testing' by the German locale.
Possible use in Kid template:
<?python
from turbogears.i18n import translate
?>
<translate xmlns:py="http://purl.org/kid/ns#"
py:match="'lang' in item.attrib"
py:replace="translate(item)" />
<h1 lang="">Welcome!</h1>
- Parameters:
item (ElementTree element) - element to be translated
attr (str) - attribute name used to store locale, if any
|