[1.7.x] Fixed #22336 -- Added path matching for makemessages ignore option

This fixes a regression introduced by 9012a9e200.
Backport of 8fe406864c from master.