~ubuntu-branches/ubuntu/wily/gramps/wily

« back to all changes in this revision

Viewing changes to po/check_po

  • Committer: Package Import Robot
  • Author(s): Ross Gammon
  • Date: 2015-05-16 11:49:41 UTC
  • mfrom: (39.1.17 sid)
  • Revision ID: package-import@ubuntu.com-20150516114941-hiku87mi6p7wbjba
Tags: 4.1.3~dfsg-1
* New upstream release
* Fixes manpage desription of import function (LP: #1427444)
* Fixes crash when closing detatched gramplet (Closes: #785393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
                        msgstr = msg.msgstr[1]
117
117
                        self.__process( msg, msgid, msgstr )
118
118
 
 
119
class Check_mapping_fmt( Check ):
 
120
        # A pattern to find all {}
 
121
        find_map_pat = re.compile('\{ \w+ \}', re.VERBOSE)
 
122
 
 
123
        def __init__( self ):
 
124
                Check.__init__( self )
 
125
                self.diag_header = "-------- {} name mismatches --------------"
 
126
                self.summary_text = "{} name mismatches:"
 
127
 
 
128
        def __process( self, msg, msgid, msgstr ):
 
129
                # Same number of named formats?
 
130
                fmts1 = self.find_map_pat.findall( msgid )
 
131
                fmts2 = self.find_map_pat.findall( msgstr )
 
132
                if len( fmts1 ) != len( fmts2 ):
 
133
                        self.msgs.append( msg )
 
134
                else:
 
135
                        # Do we have the same named formats?
 
136
                        fmts1.sort()
 
137
                        fmts2.sort()
 
138
                        if fmts1 != fmts2:
 
139
                                self.msgs.append( msg )
 
140
 
 
141
        def process( self, msg ):
 
142
                msgid = msg.msgid
 
143
                msgstr = msg.msgstr[0]
 
144
                self.__process( msg, msgid, msgstr )
 
145
 
 
146
                if msg.msgidp and len(msg.msgstr) >= 2:
 
147
                        msgid = msg.msgidp
 
148
                        msgstr = msg.msgstr[1]
 
149
                        self.__process( msg, msgid, msgstr )
 
150
 
119
151
class Check_missing_sd( Check ):
120
152
        # A pattern to find %() without s or d
121
153
        # Here is a command to use for testing
513
545
        checks.append( Check_fmt( '%s' ) )
514
546
        checks.append( Check_fmt( '%d' ) )
515
547
        checks.append( Check_named_fmt() )
 
548
        checks.append( Check_mapping_fmt() )
516
549
        checks.append( Check_missing_sd() )
517
550
        checks.append( Check_runaway() )
518
551
        checks.append( Check_xml_chars() )