Ask Your Question
1

Does jinja2_makemessages miss some messages?!

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

Basel Shishani gravatar image Basel Shishani
197 7 2 14

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
delete close flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
1

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

Evgeny gravatar image Evgeny flag of Chile
11314 50 84 183
http://askbot.org/

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.

link publish delete flag offensive edit

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 ( 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 ( 2012-04-20 04:14:43 -0500 )edit

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

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

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

zaf gravatar image zaf
554 8 9 26

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.

link publish delete flag offensive edit

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 ( 2012-04-21 20:30:22 -0500 )edit

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Reliable Askbot Hosting

Create your Q&A site at askbot.com. Managed Askbot hosting at just $15/mo. Dedicated hosting, support contracts, consulting services.

create your Q&A site
30 days free trial

Question tools

Follow

subscribe to rss feed

Stats

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

Seen: 82 times

Last updated: Apr 21 '12