Chameleon Translate Function SupportΒΆ
translationstring.ChameleonTranslate() is a function which
returns a callable suitable for use as the translate argument to
various PageTemplate* constructors.
1from chameleon.zpt.template import PageTemplate
2from translationstring import ChameleonTranslate
3from translationstring import Translator
4import gettext
5
6translations = gettext.translations(...)
7translator = Translator(translations)
8translate = ChameleonTranslate(translate)
9pt = PageTemplate('<html></html>', translate=translate)
The translator provided should be a callable which accepts a
single argument translation_string ( a
translationstring.TranslationString instance) which returns a
unicode object as a translation; usually the result of calling
translationstring.Translator(). translator may also
optionally be None, in which case no translation is performed (the
msgid or default value is returned untranslated).