Warning, file /sdk/pology/lang/fr/sieve/setApostrophe.py was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 # -*- coding: UTF-8 -*- 0002 0003 """ 0004 Replace apostrophe (’) with the ' according to the French rules. 0005 0006 Documented in C{doc/user/sieving.docbook}. 0007 0008 @author: Johnny Jazeix <jazeix@gmail.com> 0009 @license: GPLv3""" 0010 0011 import re 0012 0013 from pology import _, n_ 0014 from pology.report import report 0015 0016 0017 def setup_sieve (p): 0018 0019 p.set_desc(_("@info sieve description", 0020 "Replace apostrophe (’) with the ' symbol.")) 0021 0022 0023 class Sieve (object): 0024 """Replace ’ by ' when needed""" 0025 0026 def __init__ (self, params): 0027 self.nmatch = 0 0028 0029 def process (self, msg, cat): 0030 0031 oldcount=msg.modcount 0032 0033 for i in range(len(msg.msgstr)): 0034 msg.msgstr[i]=self.setApostrophe(msg.msgstr[i]) 0035 0036 if oldcount<msg.modcount: 0037 self.nmatch+=1 0038 0039 def finalize (self): 0040 0041 if self.nmatch > 0: 0042 report(n_("@info", 0043 "Apostrophes updated in %(num)d message.", 0044 "Apostrophes updated in %(num)d messages.", 0045 num=self.nmatch)) 0046 0047 def setApostrophe(self, text): 0048 """Set correctly apostrophes""" 0049 text=text.replace("’", "'") 0050 0051 return text