~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Vincent Ladeuil
  • Date: 2011-06-27 15:08:26 UTC
  • mto: (5993.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 5994.
  • Revision ID: v.ladeuil+lp@free.fr-20110627150826-lfdrvg65lqzn33f9
Fix test failures and make sure we don't rely on a default translation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    cmdline,
37
37
    debug,
38
38
    errors,
 
39
    i18n,
39
40
    option,
40
41
    osutils,
41
42
    trace,
44
45
""")
45
46
 
46
47
from bzrlib.hooks import Hooks
47
 
from bzrlib.i18n import (
48
 
    gettext,
49
 
    gettext_per_paragraph,
50
 
    install as i18n_install,
51
 
    )
 
48
from bzrlib.i18n import gettext
52
49
# Compatibility - Option used to be in commands.
53
50
from bzrlib.option import Option
54
51
from bzrlib.plugin import disable_plugins, load_plugins
491
488
            usage help (e.g. Purpose, Usage, Options) with a
492
489
            message explaining how to obtain full help.
493
490
        """
 
491
        if self.l10n and not i18n.installed():
 
492
            i18n.install()  # Install i18n only for get_help_text for now.
494
493
        doc = self.help()
495
494
        if doc:
496
495
            # Note: If self.gettext() translates ':Usage:\n', the section will
498
497
            # translate the usage string.
499
498
            # Though, bzr export-pot don't exports :Usage: section and it must
500
499
            # not be translated.
501
 
            if self.l10n:
502
 
                i18n_install()  # Install i18n only for get_help_text for now.
503
 
                doc = self.gettext(doc)
 
500
            doc = self.gettext(doc)
504
501
        else:
505
502
            doc = gettext("No help for this command.")
506
503
 
515
512
 
516
513
        # The header is the purpose and usage
517
514
        result = ""
518
 
        result += gettext(':Purpose: %s\n') % (purpose,)
 
515
        result += i18n.gettext(':Purpose: %s\n') % (purpose,)
519
516
        if usage.find('\n') >= 0:
520
517
            result += gettext(':Usage:\n%s\n') % (usage,)
521
518
        else:
768
765
        Commands provided by plugins should override this to use their
769
766
        own i18n system.
770
767
        """
771
 
        return gettext_per_paragraph(message)
 
768
        return i18n.gettext_per_paragraph(message)
772
769
 
773
770
    def name(self):
774
771
        """Return the canonical name for this command.