Ask Your Question
0

Why django makemessages exports only two phrases, while many more are expected?

asked 2017-02-09 10:01:17 -0500

rosettas gravatar image

updated 2017-02-11 09:37:10 -0500

Evgeny gravatar image

I have installed django-rosetta successfully.

But when I was running django-admin makemessages -l de.

I got only two records from django.po:

 #: settings.py:225
msgid "account/"
msgstr ""

#: settings.py:225
msgid "signin/"
msgstr ""

is that anything wrong I did?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-02-11 09:36:30 -0500

Evgeny gravatar image

You are confusing django-rosetta with makemessages. The makemessages is a django's built-in command and it must be run from within an app for which you are trying to build the internationalization file.

Change the current directory to the app, then run the command.

cd <path-to-some-app>
python <path-to-manage.py file> makemessages

Notice that Django's makemessages will extract files from django templates, but won't work with Jinja2 templates. For example Askbot (which uses Jinja2 templates) relies on it's own jinja2_makemessages command.

In my development setup I mostly have the askbot app installed in the root of the Django project, so my manage.py file is one level up from askbot directory, therefore I jump into askbot and run

python ../manage.py jinja2-makemessages -l en -e html,py,txt #for .py files and templates.
python ../manage.py makemessages -d djangojs -l en -e js #this time extract strings from .js files
edit flag offensive delete link more

Comments

thanks. I am running the two commands but same mistake. I got <project>/locale/en/LC_MESSAGES/django.po has still 2 phrases, no any more.

rosettas gravatar imagerosettas ( 2017-02-12 15:44:05 -0500 )edit

sorry to update like this, but any solution?

rosettas gravatar imagerosettas ( 2017-03-10 10:33:22 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-02-09 10:01:17 -0500

Seen: 156 times

Last updated: Feb 11