File indexing completed on 2024-10-13 08:07:52
0001 # -*- coding: UTF-8 -*- 0002 0003 """ 0004 Remove obsolete messages from catalogs. 0005 0006 Documented in C{doc/user/sieving.docbook}. 0007 0008 @author: Chusslove Illich (Часлав Илић) <caslav.ilic@gmx.net> 0009 @license: GPLv3 0010 """ 0011 0012 from pology import _, n_ 0013 from pology.report import report 0014 0015 0016 def setup_sieve (p): 0017 0018 p.set_desc(_("@info sieve discription", 0019 "Remove obsolete messages from catalogs." 0020 )) 0021 0022 0023 class Sieve (object): 0024 0025 def __init__ (self, params): 0026 0027 self.nmatch = 0 0028 0029 0030 def process (self, msg, cat): 0031 0032 if msg.obsolete: 0033 cat.remove_on_sync(msg) 0034 self.nmatch += 1 0035 0036 0037 def finalize (self): 0038 0039 if self.nmatch > 0: 0040 msg = n_("@info:progress", 0041 "Removed %(num)d obsolete message.", 0042 "Removed %(num)d obsolete messages.", 0043 num=self.nmatch) 0044 report("===== " + msg) 0045