File: __init__.py

package info (click to toggle)
python-docutils 0.8.1-8
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 7,604 kB
  • sloc: python: 38,189; lisp: 7,807; sh: 142; makefile: 136; xml: 6
file content (29 lines) | stat: -rw-r--r-- 800 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# $Id: __init__.py 6423 2010-09-17 21:38:29Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.

# Internationalization details are documented in
# <http://docutils.sf.net/docs/howto/i18n.html>.

"""
This package contains modules for language-dependent features of
reStructuredText.
"""

__docformat__ = 'reStructuredText'

from docutils.utils import normalize_language_tag

_languages = {}

def get_language(language_code):
    for tag in normalize_language_tag(language_code):
        if tag in _languages:
            return _languages[tag]
        try:
            module = __import__(tag, globals(), locals())
        except ImportError:
            continue
        _languages[tag] = module
        return module
    return None