#!/usr/bin/python import polib import sys po_old=polib.pofile(sys.argv[1]) po_new=polib.pofile(sys.argv[2]) for entry_new in po_new: found = False for entry_old in po_old: if entry_new.msgid != "" and entry_new.msgid == entry_old.msgid: found = True if not found: print entry_new.msgid if 'fuzzy' not in entry_new.flags: entry_new.flags.append('fuzzy') po_old.append(entry_new) po_old.save()