class documentation

class InternationalizationExtension(Extension):

View In Hierarchy

This extension adds gettext support to Jinja.
Method __init__ Undocumented
Method ​_extract Undocumented
Method ​_install Undocumented
Method ​_install​_callables Undocumented
Method ​_install​_null Undocumented
Method ​_make​_node Generates a useful node from the data provided.
Method ​_parse​_block Parse until the next block tag with a given name.
Method ​_trim​_whitespace Undocumented
Method ​_uninstall Undocumented
Method parse Parse a translatable tag.
Class Variable tags Undocumented

Inherited from Extension:

Method attr Return an attribute node for the current extension. This is useful to pass constants on extensions to generated template code.
Method call​_method Call a method of the extension. This is a shortcut for attr + jinja2.nodes.Call.
Method filter​_stream No summary
Method preprocess This method is called before the actual lexing and can be used to preprocess the source. The filename is optional. The return value must be the preprocessed source.
Class Variable identifier Undocumented
Method __init​_subclass__ Undocumented
Method bind Create a copy of this extension bound to another environment.
Class Variable priority Undocumented
Instance Variable environment Undocumented
def __init__(self, environment):

Undocumented

Parameters
environment:EnvironmentUndocumented
def _extract(self, source, gettext_functions=GETTEXT_FUNCTIONS):

Undocumented

Parameters
source:t.Union[str, nodes.Template]Undocumented
gettext​_functions:t.Sequence[str]Undocumented
Returns
t.Iterator[t.Tuple[int, str, t.Union[t.Optional[str], t.Tuple[t.Optional[str], ...]]]]Undocumented
def _install(self, translations, newstyle=None):

Undocumented

Parameters
translations:_SupportedTranslationsUndocumented
newstyle:t.Optional[bool]Undocumented
def _install_callables(self, gettext, ngettext, newstyle=None, pgettext=None, npgettext=None):

Undocumented

Parameters
gettext:t.Callable[[str], str]Undocumented
ngettext:t.Callable[[str, str, int], str]Undocumented
newstyle:t.Optional[bool]Undocumented
pgettext:t.Optional[t.Callable[[str, str], str]]Undocumented
npgettext:t.Optional[t.Callable[[str, str, str, int], str]]Undocumented
def _install_null(self, newstyle=None):

Undocumented

Parameters
newstyle:t.Optional[bool]Undocumented
def _make_node(self, singular, plural, variables, plural_expr, vars_referenced, num_called_num):
Generates a useful node from the data provided.
Parameters
singular:strUndocumented
plural:t.Optional[str]Undocumented
variables:t.Dict[str, nodes.Expr]Undocumented
plural​_expr:t.Optional[nodes.Expr]Undocumented
vars​_referenced:boolUndocumented
num​_called​_num:boolUndocumented
Returns
nodes.OutputUndocumented
def _parse_block(self, parser, allow_pluralize):
Parse until the next block tag with a given name.
Parameters
parser:ParserUndocumented
allow​_pluralize:boolUndocumented
Returns
t.Tuple[t.List[str], str]Undocumented
def _trim_whitespace(self, string, _ws_re=_ws_re):

Undocumented

Parameters
string:strUndocumented
​_ws​_re:t.Pattern[str]Undocumented
Returns
strUndocumented
def _uninstall(self, translations):

Undocumented

Parameters
translations:_SupportedTranslationsUndocumented
def parse(self, parser):
Parse a translatable tag.
Parameters
parser:ParserUndocumented
Returns
t.Union[nodes.Node, t.List[nodes.Node]]Undocumented
tags: set[str] =

Undocumented