Closed canassa closed 4 years ago
I'm working on a change to get this to work, but tests are showing my regex-fu is coming up short. I'll let you know if I can get this working.
@canassa actually, i got the test suite's i18n template working, as well as makemessages to output.
It appears that, at least for this example, {% trans %} and {% trans trimmed %} blocks both get scanned correctly:
Do you have any other insight into your real world example that could make it not work?
Hmm, that's weird, I can reproduce the error even with your test template. I pasted your i18n_test.jinja in my project and it didn't generate the trimmed messages. Could it be due to some configuration on my project?
Note: the problem happens even without the plularize:
<p>
{% trans %}
trans test
{% endtrans %}
</p>
</p>
{% trans trimmed %}
trans test trimmed
{% endtrans %}
</p>
I did another test and I found out that it generates the message if I set the tag to {% trans trimmed=1 %}
instead of {% trans trimmed %}
(but the message is generated untrimmed of course)
I pushed a regex change in 95e1f9 that relaxes the key=value
bit. It doesn't change anything in my template test. Can you install that branch and let me know if it fixes it for you?
pip install -e git+https://github.com/wizpig64/django-jinja.git@95e1f91af7d28771e8f2ec90592bb64430903bd2#egg=django_jinja
Thanks! I will try it tonight and I let you know!
@canassa were you able to verify that the above branch fixed your {% trans trimmed %}
block issues? I'd like to submit a pull request with the changes, if they indeed fixed makemessages, before the next django-jinja release.
Thanks for your time.
Hey!
Sorry! I ended up forgetting to reply to you 😞
I tested the following scenarios:
{% trans %}
teste 123
{% endtrans %}
{% trans trimmed=1 %}
teste 123
{% endtrans %}
{% trans trimmed %}
teste 123
{% endtrans %}
All are being detected now! And {% trans trimmed %}
is correctly trimming the string.
Thanks!
That's alright, thanks for your help!
Hello,
When I execute the
makemessages
command, it seems to be unable to detecttrans
tags that have thetrimmed
option in it. e.g.:If I remove the
trimmed
it works: