I'm afraid I must be doing something wrong, but with the following setup, I cannot get makemessages to parse anything in {% trans %}...{% enddtrans %} blocks:
Then a sample template file in /subapp/templates/subapp/index.jinja:
{{ _("This works") }}
{% trans %}This gets ignored{% endtrans %}
{% blocktrans %}This also works{% endblocktrans %}
I then run poetry run python manage.py makemessages -l en -e html,txt,py,jinja which produces this .po file:
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-14 16:41+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: .\subapp\templates\subapp\index.jinja:1
msgid "This works"
msgstr ""
#: .\subapp\templates\subapp\index.jinja:5
msgid "This also works"
msgstr ""
My problem is that I would like to use {% trans %}... for more complex strings, and I cannot use blocktrans because then Jinja complains about an unknown tag. Any idea what could be wrong? If required, I'll upload a whole sample project.
Hi,
I'm afraid I must be doing something wrong, but with the following setup, I cannot get
makemessages
to parse anything in{% trans %}...{% enddtrans %}
blocks:pyproject.toml:
settings.py:
Then a sample template file in
/subapp/templates/subapp/index.jinja
:I then run
poetry run python manage.py makemessages -l en -e html,txt,py,jinja
which produces this .po file:My problem is that I would like to use
{% trans %}...
for more complex strings, and I cannot useblocktrans
because then Jinja complains about an unknown tag. Any idea what could be wrong? If required, I'll upload a whole sample project.