~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export_pot.py

(gz) Keep duplicates till later in the translation template generation for
 added context (Martin Packman)

Show diffs side-by-side

added added

removed removed

Lines of Context:
130
130
class _PotExporter(object):
131
131
    """Write message details to output stream in .pot file format"""
132
132
 
133
 
    def __init__(self, outf):
 
133
    def __init__(self, outf, include_duplicates=False):
134
134
        self.outf = outf
135
 
        self._msgids = set()
 
135
        if include_duplicates:
 
136
            self._msgids = None
 
137
        else:
 
138
            self._msgids = set()
136
139
        self._module_contexts = {}
137
140
 
138
141
    def poentry(self, path, lineno, s, comment=None):
139
 
        if s in self._msgids:
140
 
            return
141
 
        self._msgids.add(s)
 
142
        if self._msgids is not None:
 
143
            if s in self._msgids:
 
144
                return
 
145
            self._msgids.add(s)
142
146
        if comment is None:
143
147
            comment = ''
144
148
        else:
305
309
                     1, summary)
306
310
 
307
311
 
308
 
def export_pot(outf, plugin=None):
309
 
    exporter = _PotExporter(outf)
 
312
def export_pot(outf, plugin=None, include_duplicates=False):
 
313
    exporter = _PotExporter(outf, include_duplicates)
310
314
    if plugin is None:
311
315
        _standard_options(exporter)
312
316
        _command_helps(exporter)