15

I had 12 languages in my Django app, if I run the command:

python manage.py makemessages --all

It would create all the 12 .po files for the languages, now I added 3 more languages:

LANGUAGES = (
    ...
    ('th', gettext('Thai')),
    ('tl', gettext('Tagalog')),
    ('vi', gettext('Vietnamese')),
)

When I run the makemessages --all command, it just skips the three new languages. Am I missing something?

Edit: Maybe the documentation is hard to understand:

makemessages

django-admin makemessages

Runs over the entire source tree of the current directory and pulls out all strings marked for translation. It creates (or updates) a message file in the conf/locale (in the Django tree) or locale (for project and application) directory. After making changes to the messages files you need to compile them with compilemessages for use with the builtin gettext support. See the i18n documentation for details.

Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129
PepperoniPizza
  • 8,842
  • 9
  • 58
  • 100

2 Answers2

26

You need to specify the languages you are interested in the first time at the command line.

python manage.py makemessages -l th -l tl -l vi

After that, subsequent calls with --all flag will generate PO files for all languages.

Vinod Kurup
  • 2,676
  • 1
  • 23
  • 18
  • In case it helps someone, I had the opposite problem... I removed an entry from LANGUAGES but I think it generates that language if it discovers any files with that language code. You can use `-x` to not generate/update a particular language. – Tim Tisdall Dec 10 '21 at 14:34
0

You should run the command below. *The command below can create or update one or more django.po:

django-admin makemessages --locale=th --locale=tl --locale=vi

Or:

django-admin makemessages -l th -l tl -l vi

Actually, the command below can only update all django.po but cannot create django.po:

django-admin makemessages --all

Or:

django-admin makemessages -a
Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129