def __init__(self, translate=NullTranslations(), ignore_tags=IGNORE_TAGS,
include_attrs=INCLUDE_ATTRS, extract_text=True):
"""Initialize the translator.
:param translate: the translation function, for example ``gettext`` or
``ugettext``.
:param ignore_tags: a set of tag names that should not be localized
:param include_attrs: a set of attribute names should be localized
:param extract_text: whether the content of text nodes should be
extracted, or only text in explicit ``gettext``
function calls
:note: Changed in 0.6: the `translate` parameter can now be either
a ``gettext``-style function, or an object compatible with the
``NullTransalations`` or ``GNUTranslations`` interface
"""
self.translate = translate
self.ignore_tags = ignore_tags
self.include_attrs = include_attrs
self.extract_text = extract_text
评论列表
文章目录