~ubuntu-branches/ubuntu/quantal/python-docutils/quantal

« back to all changes in this revision

Viewing changes to docutils/languages/__init__.py

  • Committer: Package Import Robot
  • Author(s): Jakub Wilk
  • Date: 2011-09-16 20:53:45 UTC
  • Revision ID: package-import@ubuntu.com-20110916205345-p0brv4kliyjz8ymf
* Remove needless comments from debian/rules.
* Restore historical behavior of languages.get_language() taking only a
  single argument (languages-get_language-2nd-arg-optional.diff). Thanks to
  Sergio Talens-Oliag for the bug report.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
_languages = {}
17
17
 
18
 
def get_language(language_code, reporter):
 
18
def get_language(language_code, reporter=None):
19
19
    """Return module with language localizations.
20
20
 
21
21
    `language_code` is a "BCP 47" language tag.
31
31
            continue
32
32
        _languages[tag] = module
33
33
        return module
34
 
    reporter.warning(
35
 
        'language "%s" not supported: ' % language_code +
36
 
        'Docutils-generated text will be in English.')
 
34
    if reporter is not None:
 
35
        reporter.warning(
 
36
            'language "%s" not supported: ' % language_code +
 
37
            'Docutils-generated text will be in English.')
37
38
    module = __import__('en', globals(), locals())
38
39
    _languages[tag] = module # warn only one time!
39
40
    return module