~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export_pot.py

  • Committer: Martin
  • Date: 2011-05-21 16:29:38 UTC
  • mto: This revision was merged to the branch mainline in revision 5907.
  • Revision ID: gzlist@googlemail.com-20110521162938-1vrw3hp0197l3vrl
Add tests for non-ascii conflict serialisation

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
           'msgid %s\n' % _normalize(s) +
77
77
           'msgstr ""\n')
78
78
 
79
 
def _poentry_per_paragraph(outf, path, lineno, msgid, filter=lambda x: False):
 
79
def _poentry_per_paragraph(outf, path, lineno, msgid):
80
80
    # TODO: How to split long help?
81
81
    paragraphs = msgid.split('\n\n')
82
82
    for p in paragraphs:
83
 
        if filter(p):
84
 
            continue
85
83
        _poentry(outf, path, lineno, p)
86
84
        lineno += p.count('\n') + 2
87
85
 
147
145
                     'help of %r option of %r command' % (name, cmd.name()))
148
146
 
149
147
 
150
 
def _write_command_help(outf, cmd):
 
148
def _write_command_help(outf, cmd_name, cmd):
151
149
    path = inspect.getfile(cmd.__class__)
152
150
    if path.endswith('.pyc'):
153
151
        path = path[:-1]
157
155
    lineno = offsets[cmd.__doc__]
158
156
    doc = inspect.getdoc(cmd)
159
157
 
160
 
    def filter(p):
161
 
        # ':Usage:' has special meaning in help topics.
162
 
        # This is usage example of command and should not be translated.
163
 
        if p.splitlines()[0] == ':Usage:':
164
 
            return True
165
 
 
166
 
    _poentry_per_paragraph(outf, path, lineno, doc, filter)
 
158
    _poentry_per_paragraph(outf, path, lineno, doc)
167
159
    _command_options(outf, path, cmd)
168
160
 
169
 
 
170
161
def _command_helps(outf):
171
162
    """Extract docstrings from path.
172
163
 
181
172
        if command.hidden:
182
173
            continue
183
174
        note("Exporting messages from builtin command: %s", cmd_name)
184
 
        _write_command_help(outf, command)
 
175
        _write_command_help(outf, cmd_name, command)
185
176
 
186
177
    plugin_path = plugin.get_core_plugin_path()
187
178
    core_plugins = glob(plugin_path + '/*/__init__.py')
198
189
            continue
199
190
        note("Exporting messages from plugin command: %s in %s",
200
191
             cmd_name, command.plugin_name())
201
 
        _write_command_help(outf, command)
 
192
        _write_command_help(outf, cmd_name, command)
202
193
 
203
194
 
204
195
def _error_messages(outf):