How to only create .pot files with django manage.py makemessages

658 Views Asked by At

Weblate has an add-on called "Update PO files to match POT (msgmerge)". I want to delegate the creation of .po files to Weblate and only use manage.py makemessages to create the .pot file(s).

manage.py makemessages has a --keep-pot option, which adds .pot files to the output. Unfortunately there is no option to only keep the .pot files.

1

There are 1 best solutions below

0
On

It is possible to skip the creation of .po files by overwriting the write_po_file method of the makemessages command. To do so, create a makemessages.py file in management/commands (as described in the Django docs):

# management/commands/makemessages.py
class Command(makemessages.Command):

    def write_po_file(*args, **kwargs):
        """Overwrite method to do nothing.

        We do not want to interfere with Weblate's
        "Update PO files to match POT (msgmerge)" addon
        """
        pass