Added a new check to find shortcut in translation when there is no

shortcut in the program text.


svn: r7662
This commit is contained in:
Kees Bakker 2006-11-21 07:17:45 +00:00
parent 3b52a960e9
commit 9093c8679c

View File

@ -21,7 +21,6 @@
#
# TODO
#
# * commandline options (for example, "suppress fuzzies in report")
# * Check for HTML text in msgstr when there is none in msgid
# * Check for matching HTML tag/endtag in msgstr
# * Check for shortcut key (_) presence in both msgid and msgstr
@ -168,6 +167,18 @@ class Check_last_char( Check ):
elif (msgid_last == '.') != (msgstr_last == '.'):
self.msgs.append( msg )
class Check_shortcut_trans( Check ):
def __init__( self ):
Check.__init__( self )
self.diag_header = "-------- shortcut key in translation ---------"
self.summary_text = "Shortcut in msgstr:"
def process( self, msg ):
msgid = msg.msgid()
msgstr = msg.msgstr()
if msgid.count('_') == 0 and msgstr.count('_') > 0:
self.msgs.append( msg )
class Msgid:
fuzzy_pat = re.compile( 'fuzzy' )
tips_xml_pat = re.compile( r'tips\.xml' )
@ -403,6 +414,7 @@ def analyze_msgs( options, fname, msgs, nr_templates = None, nth = 0 ):
checks.append( Check_runaway() )
checks.append( Check_xml_chars() )
checks.append( Check_last_char() )
checks.append( Check_shortcut_trans() )
for msg in msgs:
msgid = msg.msgid()