comparison env/lib/python3.9/site-packages/docutils/parsers/rst/languages/__init__.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 # $Id: __init__.py 8376 2019-08-27 19:49:29Z milde $
2 # Author: David Goodger <goodger@python.org>
3 # Copyright: This module has been placed in the public domain.
4
5 # Internationalization details are documented in
6 # <http://docutils.sf.net/docs/howto/i18n.html>.
7
8 """
9 This package contains modules for language-dependent features of
10 reStructuredText.
11 """
12
13 __docformat__ = 'reStructuredText'
14
15 import sys
16
17 from docutils.utils import normalize_language_tag
18
19
20 _languages = {}
21
22 def get_language(language_code):
23 for tag in normalize_language_tag(language_code):
24 tag = tag.replace('-', '_') # '-' not valid in module names
25 if tag in _languages:
26 return _languages[tag]
27 try:
28 module = __import__(tag, globals(), locals(), level=1)
29 except ImportError:
30 try:
31 module = __import__(tag, globals(), locals(), level=0)
32 except ImportError:
33 continue
34 _languages[tag] = module
35 return module
36 return None