Solved a problem with counting untranslated entries in po.

* po/check_po


svn: r11882
This commit is contained in:
Kees Bakker 2009-02-06 10:08:24 +00:00
parent 65a68911ad
commit 47be81a5c1

View File

@ -283,12 +283,8 @@ class Msgid:
if not self.is_tips_xml and self.tips_xml_pat.search( line ): if not self.is_tips_xml and self.tips_xml_pat.search( line ):
self.is_tips_xml = 1 self.is_tips_xml = 1
msgs = [] def create_new_Msgid( msgs, lineno ):
msgnr = 0 # This is the message number of the next message to read. The first real message is 1. msg = Msgid( len(msgs), lineno )
def create_new_Msgid( lineno ):
global msgnr
msg = Msgid( msgnr, lineno )
msgnr += 1
msgs.append( msg ) msgs.append( msg )
return msg return msg
@ -317,6 +313,7 @@ def read_msgs( fname ):
state = NONE state = NONE
msg = None msg = None
msgs = []
for ix, line in enumerate( lines ): # Use line numbers for messages for ix, line in enumerate( lines ): # Use line numbers for messages
lineno = ix + 1 lineno = ix + 1
@ -346,12 +343,12 @@ def read_msgs( fname ):
# expect msgid or comment or old stuff # expect msgid or comment or old stuff
if next_state == CMNT: if next_state == CMNT:
state = CMNT state = CMNT
msg = create_new_Msgid( lineno ) # Start with an empty new item msg = create_new_Msgid( msgs, lineno ) # Start with an empty new item
msg.add_cmnt( line ) msg.add_cmnt( line )
elif next_state == MSGID: elif next_state == MSGID:
state = MSGID state = MSGID
msg = create_new_Msgid( lineno ) # Start with an empty new item msg = create_new_Msgid( msgs, lineno ) # Start with an empty new item
msg.add_msgid( line, lineno ) msg.add_msgid( line, lineno )
elif next_state == MSGIDP: elif next_state == MSGIDP:
@ -360,7 +357,7 @@ def read_msgs( fname ):
elif next_state == MSGSTR: elif next_state == MSGSTR:
print 'WARNING: Wild msgstr at %(fname)s:%(lineno)d' % vars() print 'WARNING: Wild msgstr at %(fname)s:%(lineno)d' % vars()
state = MSGSTR state = MSGSTR
msg = create_new_Msgid( lineno ) # Start with an empty new item msg = create_new_Msgid( msgs, lineno ) # Start with an empty new item
msg.add_new_msgstr( line, lineno ) msg.add_new_msgstr( line, lineno )
elif next_state == STR: elif next_state == STR:
@ -385,7 +382,7 @@ def read_msgs( fname ):
elif next_state == MSGID: elif next_state == MSGID:
state = MSGID state = MSGID
if not msg: if not msg:
msg = create_new_Msgid( lineno ) # Start with an empty new item msg = create_new_Msgid( msgs, lineno ) # Start with an empty new item
msg.add_msgid( line, lineno ) msg.add_msgid( line, lineno )
elif next_state == MSGIDP: elif next_state == MSGIDP:
@ -394,7 +391,7 @@ def read_msgs( fname ):
elif next_state == MSGSTR: elif next_state == MSGSTR:
print 'WARNING: Wild msgstr at %(fname)s:%(lineno)d' % vars() print 'WARNING: Wild msgstr at %(fname)s:%(lineno)d' % vars()
state = MSGSTR state = MSGSTR
msg = create_new_Msgid( lineno ) # Start with an empty new item msg = create_new_Msgid( msgs, lineno ) # Start with an empty new item
msg.add_new_msgstr( line, lineno ) msg.add_new_msgstr( line, lineno )
elif next_state == STR: elif next_state == STR:
@ -467,12 +464,12 @@ def read_msgs( fname ):
if next_state == CMNT: if next_state == CMNT:
# A comment probably starts a new item # A comment probably starts a new item
state = CMNT state = CMNT
msg = create_new_Msgid( lineno ) msg = create_new_Msgid( msgs, lineno )
msg.add_cmnt( line ) msg.add_cmnt( line )
elif next_state == MSGID: elif next_state == MSGID:
state = MSGID state = MSGID
msg = create_new_Msgid( lineno ) msg = create_new_Msgid( msgs, lineno )
msg.add_msgid( line, lineno ) msg.add_msgid( line, lineno )
elif next_state == MSGIDP: elif next_state == MSGIDP: