0

Weblate 有一个名为“更新 PO 文件以匹配 POT (msgmerge)”的附加组件。我想将文件的创建委托.po给 Weblate,并且仅用于manage.py makemessages创建.pot文件。

manage.py makemessages有一个--keep-pot选项,它将.pot文件添加到输出中。不幸的是,没有选择保留.pot文件。

4

1 回答 1

0

.po可以通过覆盖命令的write_po_file方法来跳过文件的创建makemessages。为此,请在(如Django 文档makemessages.py中所述)中创建一个文件:management/commands

# 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
于 2021-10-15T12:12:35.003 回答