@@ -480,6 +480,25 @@ def _get_language_checker(self, po_file, reports):
480480 checker = []
481481 return checker
482482
483+ def check_msg (self , po_file , checker , msg , reports ):
484+ """Check one message."""
485+ if self .checks ['extract' ]:
486+ for mid , mstr in msg .messages :
487+ if mid and mstr :
488+ reports .append (PoReport (mstr , 'extract' ))
489+ else :
490+ if self .checks ['lines' ]:
491+ reports += msg .check_lines ()
492+ if self .checks ['punct' ]:
493+ reports += msg .check_punct (po_file .props ['language' ])
494+ if self .checks ['whitespace' ]:
495+ reports += msg .check_whitespace ()
496+ if self .checks ['whitespace_eol' ]:
497+ reports += msg .check_whitespace_eol ()
498+ if self .spelling :
499+ reports += msg .check_spelling (self .spelling , checker +
500+ self .extra_checkers )
501+
483502 def check_pofile (self , po_file ):
484503 """
485504 Check translations in one PO file.
@@ -499,22 +518,7 @@ def check_pofile(self, po_file):
499518 continue
500519 if msg .fuzzy and not check_fuzzy :
501520 continue
502- if self .checks ['extract' ]:
503- for mid , mstr in msg .messages :
504- if mid and mstr :
505- reports .append (PoReport (mstr , 'extract' ))
506- else :
507- if self .checks ['lines' ]:
508- reports += msg .check_lines ()
509- if self .checks ['punct' ]:
510- reports += msg .check_punct (po_file .props ['language' ])
511- if self .checks ['whitespace' ]:
512- reports += msg .check_whitespace ()
513- if self .checks ['whitespace_eol' ]:
514- reports += msg .check_whitespace_eol ()
515- if self .spelling :
516- reports += msg .check_spelling (
517- self .spelling , checker + self .extra_checkers )
521+ self .check_msg (po_file , checker , msg , reports )
518522
519523 return reports
520524
0 commit comments