Ask Your Question
1

Does jinja2_makemessages miss some messages?!

asked 2012-04-20 00:10:04 -0500

Basel Shishani gravatar image

According to this question jinja2_makemessages is supposed to work fine with templates. But in my latest update from the Github repo I'm noticing that some strings are being skipped. For example the sort by button labels on questions page: 'by date', 'by activity', 'by answers', 'by votes'.

Am I doing something wrong?! I'm just doing the same thing I used to do before:

python /path/to/manage.py jinja2_makemessages -l xx -e html,py,txt
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2012-04-20 03:35:23 -0500

Evgeny gravatar image

It does miss those messages when used in a specific way in the jinja2 templates. To work around this problem, the messages are added to file askbot/const/messages.py there is only about a dozen of messages like these.

At some point I've changed "votes" -> "by votes" etc, to make them different from simply "votes" (sometimes you need both in the language files) and forgot to update the askbot/const/messages.py.

So now they are not missed.

edit flag offensive delete link more

Comments

Evgeny, thanks for the answer and I really appreciate the time you're devoting to this. May I ask, is this some dormant bug in (jinja2_)makemessage to be addressed at some point in the future, or is it a known/understood inherent issue in the way makemessages - gettext - templates interact together. If you have a pointer on this it will do me.

Basel Shishani gravatar imageBasel Shishani ( 2012-04-20 04:07:41 -0500 )edit

Maybe there is a fix to this, but I could not find it easily, the issue is with {{ gettext('somemessage') }} type of calls in the template. Possibly some regexes in the jinja2_makemessages could be fixed.

Evgeny gravatar imageEvgeny ( 2012-04-20 04:14:43 -0500 )edit

And just a small correction on askbot/const/message_keys.py

Basel Shishani gravatar imageBasel Shishani ( 2012-04-20 09:02:23 -0500 )edit
0

answered 2012-04-21 07:48:29 -0500

zaf gravatar image

I have the same issue, posted here, and I work around this by deleting, inside .po file, all #~ that actually comment out my useful, translated pairs. May that would work for you two.

edit flag offensive delete link more

Comments

I think that was accidental for you. If you run makemessages again it will comment out your translations once more. The workaround explained by Evgeny works fine for now. The issue he mentioned is explained in detail in the jinja2_makemessages module doc.

Basel Shishani gravatar imageBasel Shishani ( 2012-04-21 20:30: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

Stats

Asked: 2012-04-20 00:10:04 -0500

Seen: 165 times

Last updated: Apr 21 '12