o gJ^V ã@sBdZdZddlZddlmZddlmZGdd„deƒZeƒZ dS)zL This package contains modules for language-dependent features of Docutils. ÚreStructuredTextéN)Ú import_module)Únormalize_language_tagc@s@eZdZdZdZdZdZdd„Zddd „Zd d „Z dd d „Z dS)Ú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. )zdocutils.languages.ÚzHLanguage "%s" not supported: Docutils-generated text will be in English.ÚencCs i|_dS©N)Úcache)Úself©r ú=/usr/lib/python3/dist-packages/docutils/languages/__init__.pyÚ__init__#s zLanguageImporter.__init__Nc Csvd}|jD]3}zt||ƒ}| |¡W|Sttfy8|r+|r+| d|¡n |r6| d||¡Yqw|S)z/Try loading module `name` from `self.packages`.Nz+%s is no complete Docutils language module.zModule "%s" not found.)ÚpackagesrÚ check_contentÚ ImportErrorÚAttributeErrorÚinfo)r ÚnameÚreporterÚmoduleÚpackager r r Úimport_from_packages&s"   øÿúz%LanguageImporter.import_from_packagescCs,t|jtƒrt|jtƒrt|jtƒst‚dS)z+Check if we got a Docutils language module.N)Ú isinstanceÚlabelsÚdictÚbibliographic_fieldsÚauthor_separatorsÚlistr)r rr r r r7s  ÿ þýzLanguageImporter.check_contentcCs¤z|j|WStyYnwt|ƒD]}| dd¡}| ||¡}|dur(nq|r3| |j|¡|jr<| |j¡}|rK|dkrK| d||f¡||j|<|S)Nú-Ú_rzUsing %s for language "%s".) r ÚKeyErrorrÚreplacerÚwarningÚwarn_msgÚfallbackr)r Ú language_coderÚtagrr r r Ú__call__>s&  ÿ   ÿ   zLanguageImporter.__call__r) Ú__name__Ú __module__Ú __qualname__Ú__doc__rr#r$r rrr'r r r r rs r) r+Ú __docformat__ÚsysÚ importlibrÚdocutils.utilsrÚobjectrÚ get_languager r r r Ús   ?