[1.7.x] Ignored STATIC_ROOT and MEDIA_ROOT in makemessages

Also alleviate issues with weird file names typically found in
MEDIA_ROOT directories (#23010).
Thanks Tim Graham for the review.
Backport of 28efafa24c from master.