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