First time here? Check out the FAQ!
1

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

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?

rosettas's avatar
23
rosettas
asked 2017-02-09 10:01:17 -0500
Evgeny's avatar
13.2k
Evgeny
updated 2017-02-11 09:37:10 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

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
Evgeny's avatar
13.2k
Evgeny
answered 2017-02-11 09:36:30 -0500
edit flag offensive 0 remove flag delete link

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's avatar rosettas (2017-02-12 15:44:05 -0500) edit

sorry to update like this, but any solution?

rosettas's avatar rosettas (2017-03-10 10:33:22 -0500) edit

@Evgeny -- if question is worth answering, it would be good practice to upvote it so new user can gain some karma and become able to do more things on this askbot site.

slelievre's avatar slelievre (2018-04-06 14:25:10 -0500) edit
add a comment see more comments