debugdiscovery: small internal refactoring
The part of the code displaying statistic is made independant from the one
running the discovery. In the same do, the declaration of the discovery
function is a bit simplified.
#require docutils gettext $ $TESTDIR/check-gendoc zh_CN checking for parse errors