misc: make makemessages remove obsolete strings by default (#66289)

This commit is contained in:
Frédéric Péters 2022-06-17 19:55:01 +02:00
parent 4a5ba9efda
commit b215fb35af
1 changed files with 5 additions and 0 deletions

View File

@ -18,7 +18,12 @@ from django.core.management.commands import makemessages
class Command(makemessages.Command):
def add_arguments(self, parser):
super().add_arguments(parser)
parser.add_argument('--keep-obsolete', action='store_true', help='Keep obsolete message strings.')
def handle(self, *args, **options):
if not options.get('add_location') and self.gettext_version >= (0, 19):
options['add_location'] = 'file'
options['no_obsolete'] = not (options.get('keep_obsolete'))
return super().handle(*args, **options)