~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export_pot.py

  • Committer: Patch Queue Manager
  • Date: 2011-09-08 11:01:15 UTC
  • mfrom: (6123.1.16 gpg-typo)
  • Revision ID: pqm@cupuasso-20110908110115-gbb9benwkdksvzk5
(jelmer) Fix a typo (invalid format identifier) in an error message in
 bzrlib.gpg. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    mutter,
35
35
    note,
36
36
    )
37
 
from bzrlib.i18n import gettext
38
37
 
39
38
 
40
39
def _escape(s):
120
119
        if getattr(opt, 'title', None):
121
120
            lineno = offsets.get(opt.title, 9999)
122
121
            if lineno == 9999:
123
 
                note(gettext("%r is not found in bzrlib/option.py") % opt.title)
 
122
                note("%r is not found in bzrlib/option.py" % opt.title)
124
123
            _poentry(outf, path, lineno, opt.title,
125
124
                     'title of %r option' % name)
126
125
        if getattr(opt, 'help', None):
127
126
            lineno = offsets.get(opt.help, 9999)
128
127
            if lineno == 9999:
129
 
                note(gettext("%r is not found in bzrlib/option.py") % opt.help)
 
128
                note("%r is not found in bzrlib/option.py" % opt.help)
130
129
            _poentry(outf, path, lineno, opt.help,
131
130
                     'help of %r option' % name)
132
131
 
169
168
    _command_options(outf, path, cmd)
170
169
 
171
170
 
172
 
def _command_helps(outf, plugin_name=None):
 
171
def _command_helps(outf):
173
172
    """Extract docstrings from path.
174
173
 
175
174
    This respects the Bazaar cmdtable/table convention and will
182
181
        command = _mod_commands.get_cmd_object(cmd_name, False)
183
182
        if command.hidden:
184
183
            continue
185
 
        if plugin_name is not None:
186
 
            # only export builtins if we are not exporting plugin commands
187
 
            continue
188
 
        note(gettext("Exporting messages from builtin command: %s"), cmd_name)
 
184
        note("Exporting messages from builtin command: %s", cmd_name)
189
185
        _write_command_help(outf, command)
190
186
 
191
187
    plugin_path = plugin.get_core_plugin_path()
192
188
    core_plugins = glob(plugin_path + '/*/__init__.py')
193
189
    core_plugins = [os.path.basename(os.path.dirname(p))
194
190
                        for p in core_plugins]
195
 
    # plugins
 
191
    # core plugins
196
192
    for cmd_name in _mod_commands.plugin_command_names():
197
193
        command = _mod_commands.get_cmd_object(cmd_name, False)
198
194
        if command.hidden:
199
195
            continue
200
 
        if plugin_name is not None and command.plugin_name() != plugin_name:
201
 
            # if we are exporting plugin commands, skip plugins we have not specified.
202
 
            continue
203
 
        if plugin_name is None and command.plugin_name() not in core_plugins:
 
196
        if command.plugin_name() not in core_plugins:
204
197
            # skip non-core plugins
205
198
            # TODO: Support extracting from third party plugins.
206
199
            continue
207
 
        note(gettext("Exporting messages from plugin command: {0} in {1}").format(
208
 
             cmd_name, command.plugin_name() ))
 
200
        note("Exporting messages from plugin command: %s in %s",
 
201
             cmd_name, command.plugin_name())
209
202
        _write_command_help(outf, command)
210
203
 
211
204
 
229
222
            continue
230
223
        fmt = getattr(klass, "_fmt", None)
231
224
        if fmt:
232
 
            note(gettext("Exporting message from error: %s"), name)
 
225
            note("Exporting message from error: %s", name)
233
226
            _poentry(outf, 'bzrlib/errors.py',
234
227
                     offsets.get(fmt, 9999), fmt)
235
228
 
252
245
            _poentry(outf, 'dummy/help_topics/'+key+'/summary.txt',
253
246
                     1, summary)
254
247
 
255
 
def export_pot(outf, plugin=None):
 
248
def export_pot(outf):
256
249
    global _FOUND_MSGID
257
250
    _FOUND_MSGID = set()
258
 
    if plugin is None:
259
 
        _standard_options(outf)
260
 
        _command_helps(outf)
261
 
        _error_messages(outf)
262
 
        _help_topics(outf)
263
 
    else:
264
 
        _command_helps(outf, plugin)
 
251
    _standard_options(outf)
 
252
    _command_helps(outf)
 
253
    _error_messages(outf)
 
254
    _help_topics(outf)