Re: [Django] #33554: Only first translation being found in Jinja handlebars when multiple strings are defined

7 views
Skip to first unread message

Django

unread,
Mar 5, 2022, 6:22:14 AM3/5/22
to django-...@googlegroups.com
#33554: Only first translation being found in Jinja handlebars when multiple
strings are defined
-------------------------------------+-------------------------------------
Reporter: Alex Ford | Owner: nobody
Type: Bug | Status: closed
Component: Utilities | Version: 3.2
Severity: Normal | Resolution: duplicate
Keywords: translations, | Triage Stage:
makemessages, jinja, handlebars, | Unreviewed
multiple strings |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* status: new => closed
* resolution: => duplicate


Comment:

Looks like this is a duplicate of #24167 — Please follow-up Alex if
investigation there reveals not.

--
Ticket URL: <https://code.djangoproject.com/ticket/33554#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 5, 2022, 6:22:14 AM3/5/22
to django-...@googlegroups.com
#33554: Only first translation being found in Jinja handlebars when multiple
strings are defined
-------------------------------------+-------------------------------------
Reporter: Alex Ford | Owner: nobody
Type: Bug | Status: new

Component: Utilities | Version: 3.2
Severity: Normal | Resolution:
Keywords: translations, | Triage Stage:
makemessages, jinja, handlebars, | Unreviewed
multiple strings |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

Hi Alex. Hmmm...

So, question, why is this not an issue for Jinga? (Or, equally, what could
Django do about this?) 🤔

--
Ticket URL: <https://code.djangoproject.com/ticket/33554#comment:1>

Django

unread,
Mar 5, 2022, 6:22:15 AM3/5/22
to django-...@googlegroups.com
#33554: Only first translation being found in Jinja handlebars when multiple
strings are defined
-------------------------------------+-------------------------------------
Reporter: Alex Ford | Owner: nobody
Type: Bug | Status: new
Component: Utilities | Version: 3.2
Severity: Normal | Keywords: translations,
| makemessages, jinja, handlebars,
Triage Stage: | multiple strings
Unreviewed | Has patch: 0

Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
When running makemessages on our project we found some strings were
missing from translations in our Jinja files. After diving into
''utils/translation/template.py'' we found examples of where the
translations were going wrong.

Below is an example of it working:

`{{ _('Hello World') }}` - This works fine and `'Hello World'` is added to
the translatable strings. This example has a token type VAR.


Below are 3 examples of it not working:

`{{ _('Hello World') + _('Foobar') }}` - `'Hello World'` is added to the
translatable strings but `'Foobar'` is not. This example has a token type
VAR. Seems to be only trying to find one word to match with and that's it,
should be finding all possible words.

`{{ foo(_('Hello World'), _('Foobar')) }}` - Exact same as above example.
This is our common use case of this bug.

{{{
{{ _('Hello World') +
_('Foobar') }}
}}}
This example is a bit different as this doesn't find any of the words as
this is seen as a token type TEXT which gets ignored.

--
Ticket URL: <https://code.djangoproject.com/ticket/33554>

Reply all
Reply to author
Forward
0 new messages