
    ddi                     F    d Z dZddlmZ ddlmZ  G d d      Z e       Zy)zL
This package contains modules for language-dependent features of Docutils.
reStructuredText    )import_module)normalize_language_tagc                   8    e Zd ZdZdZdZdZd Zd
dZd Z	d
d	Z
y)LanguageImportera  Import language modules.

    When called with a BCP 47 language tag, instances return a module
    with localisations from `docutils.languages` or the PYTHONPATH.

    If there is no matching module, warn (if a `reporter` is passed)
    and fall back to English.
    )zdocutils.languages. zHLanguage "%s" not supported: Docutils-generated text will be in English.enc                     i | _         y N)cache)selfs    =/usr/lib/python3/dist-packages/docutils/languages/__init__.py__init__zLanguageImporter.__init__"   s	    
    Nc                     d}| j                   D ]$  }	 t        ||z         }| j                  |        |S  |S # t        t        f$ r6 |r|r|j                  | d       n|r|j                  d||z    d       Y mw xY w)z/Try loading module `name` from `self.packages`.Nz) is no complete Docutils language module.zModule "z" not found.)packagesr   check_contentImportErrorAttributeErrorinfo)r   namereportermodulepackages        r   import_from_packagesz%LanguageImporter.import_from_packages%   s    }} 	G	&wt|4""6* 	   0 MMVH -> #> ?MMHWT\N,"GHs   8AA=<A=c                     t        |j                  t              r4t        |j                  t              rt        |j                  t
              st        y)z+Check if we got a Docutils language module.N)
isinstancelabelsdictbibliographic_fieldsauthor_separatorslistr   )r   r   s     r   r   zLanguageImporter.check_content6   s;    6==$/v::DAv77> ?r   c                    	 | j                   |   S # t        $ r Y nw xY wt        |      D ]*  }|j                  dd      }| j	                  ||      }|* nH |r|j                  | j                  |z         | j                  r| j	                  | j                        }|r|dk7  r|j                  dd|d       | j                   |<   |S )N-_r	   zUsing z for language "z".)	r   KeyErrorr   replacer   warningwarn_msgfallbackr   )r   language_coder   tagr   s        r   __call__zLanguageImporter.__call__=   s    	::m,, 		)-8 		BC++c3'C..sH=F!			B   !>?}}224==A$.MM#]4 5$*

=!s    	r   )__name__
__module____qualname____doc__r   r)   r*   r   r   r   r-    r   r   r   r      s.     +H>HH"r   r   N)r1   __docformat__	importlibr   docutils.utilsr   r   get_languager2   r   r   <module>r7      s,    # # 1= =@  !r   