简体   繁体   中英

Django makemessages fails both with django-admin and manage.py

I have a fresh Django project with no third-party apps installed. I'm trying to create a multilingual setup, with from django.utils.translation import gettext_lazy as _ in my Python files and {% translate %} in my templates.

When I try to extract the messages, I get an error.

(venv) d:\dev\py\filfak\src>py manage.py makemessages -l es
processing locale es 
CommandError: errors happened while running msgmerge 
msgmerge: unrecognized option `--previous' 
Try `(null) --help' for more information.

Somebody has an idea why does this happen? And, more important, how to solve it? If it helps somehow, I'm using Python 3.9.6 and Django 3.2.8 on Windows.

That sounds like perhaps your version of gettext might be out of date and not yet have support for the '--previous' option.

You can get the latest precompiled binary from https://mlocati.github.io/articles/gettext-iconv-windows.html (as linked from the Django docs here ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM