B
C]Z @ s8 d Z ddlmZ ddlmZ G dd deZdd ZdS ) z@gettext message extraction via Babel: http://babel.edgewall.org/ )extract_python)MessageExtractorc s, e Zd Z fddZdd Zdd Z ZS )BabelMakoExtractorc s@ || _ || _d||d|dd d| _tt| d S )N Zinput_encodingencoding)zcomment-tagsr )keywordsoptionsjoingetconfigsuperr __init__)selfr comment_tagsr ) __class__ E/opt/alt/python37/lib/python3.7/site-packages/mako/ext/babelplugin.pyr
s zBabelMakoExtractor.__init__c C s
| |S )N)Zprocess_file)r fileobjr r r __call__ s zBabelMakoExtractor.__call__c c sL | j d }x<t|| j|| jD ]&\}}}}||d |||| fV qW d S )Nzcomment-tags )r r r r ) r codeZcode_linenoZtranslator_stringsr linenofuncnameZmessagesZpython_translator_commentsr r r process_python s
z!BabelMakoExtractor.process_python)__name__
__module____qualname__r
r r
__classcell__r r )r r r
s r c c s( t |||}x|| D ]
}|V qW dS )a Extract messages from Mako templates.
:param fileobj: the file-like object the messages should be extracted from
:param keywords: a list of keywords (i.e. function names) that should be
recognized as translation functions
:param comment_tags: a list of translator tags to search for and include
in the results
:param options: a dictionary of additional options (optional)
:return: an iterator over ``(lineno, funcname, message, comments)`` tuples
:rtype: ``iterator``
N)r )r r r r Z extractormessager r r extract, s r N)__doc__Zbabel.messages.extractr Zmako.ext.extractr r r r r r r <module> s