﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36010	compilemessages reports errors only once	Balazs Endresz	Claude Paroz	"When calling `compilemessages` for a locale that has invalid entries it prints out the errors correctly first. 
But any subsequent calls just say that it's `already compiled and up to date`.
This is because `msgfmt` updates the last modified date of the mo file even if it's invalid, and then django will skip that locale afterwards: 
https://github.com/django/django/blob/main/django/core/management/commands/compilemessages.py#L153

This can reproduced by calling compilemessages twice in `django/tests/i18n/test_compilation.py`:

{{{#!python
class CompilationErrorHandling(MessageCompilationTests):
    def test_error_reported_by_msgfmt(self):
        # po file contains wrong po formatting.
        with self.assertRaises(CommandError):
            call_command(""compilemessages"", locale=[""ja""], verbosity=0)

        # subsequent calls should still fail
        with self.assertRaises(CommandError):
            call_command(""compilemessages"", locale=[""ja""], verbosity=0)  # currently this doesn't raise CommandError
}}}

One way of fixing this is perhaps doing the validation separately first, e.g. with `mo_path = ""NUL"" if os.name == ""nt"" else ""/dev/null""` and then calling `msgfmt` again with the actual `mo_path` only if that passes. "	Bug	closed	Internationalization	dev	Normal	fixed		Balazs Endresz	Ready for checkin	1	0	0	0	0	0
