예제 #1
0
파일: poget.py 프로젝트: syslabcom/potools
 def _generate_pofile(self, entries):
     outpo = polib.POFile()
     secondpo = polib.pofile(self.args[1])
     # Copy header and metadata
     outpo.header = secondpo.header
     for (key, val) in secondpo.metadata.items():
         outpo.metadata.update({key: val})
     for e in entries:
         default_msgstr = self.options.prefill and utils.get_default(e) or None
         outpo = utils.append_entry(outpo, e, default_msgstr)
     return outpo
예제 #2
0
    def _populate(self, infile, outfile):
        pofile = polib.pofile(infile)

        modified = False
        for entry in pofile:
            if self.options.fuzzy and 'fuzzy' in entry.flags:
                entry.msgstr = ""
            if not entry.msgstr:
                self.untranslated += 1
                # Empty message string, try to find an update
                default = get_default(entry)
                if not default:
                    self.missing += 1
                else:
                    self.updated += 1
                    modified = True
                    entry.msgstr = default
                    if not 'fuzzy' in entry.flags:
                        entry.flags.append('fuzzy')

        if self.options.update and not modified:
            # Don't save if this is an inplace update and there was no modifications.
            return
        pofile.save(outfile)
예제 #3
0
파일: poget.py 프로젝트: syslabcom/potools
 def is_dirty(self, old_entry, new_entry):
     default_old = utils.get_default(old_entry)
     default_new = utils.get_default(new_entry)
     if default_old != default_new:
         return True
     return False