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

This commit is contained in:
Frédéric Péters 2022-06-17 19:13:11 +02:00
parent ab21e6d94e
commit a3eb7db627
1 changed files with 5 additions and 0 deletions

View File

@ -20,7 +20,12 @@ from django.core.management.commands import makemessages
class Command(makemessages.Command):
xgettext_options = makemessages.Command.xgettext_options + ['--keyword=N_']
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)