But Django 2.0.2 does not recognize it when it tries to extract
translations into PO file.
Demo:
{{{
# views.py
from django.utils.translation import ugettext_lazy as _
header = f'{_("Header")}'
header_old = '{}'.format(_("Header old"))
}}}
Run:
{{{
./manage.py makemessages -a
}}}
PO file would contain only "Header old".
--
Ticket URL: <https://code.djangoproject.com/ticket/29174>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: Artem Skoretskiy (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/29174#comment:1>
Comment (by Tim Graham):
I don't have much expertise about translations but is this a Python or
xgettext issue rather than something Django can solve?
--
Ticket URL: <https://code.djangoproject.com/ticket/29174#comment:2>
* component: Internationalization => Documentation
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
Yes, I guess the best we can do for now is documenting that current
gettext limitation.
--
Ticket URL: <https://code.djangoproject.com/ticket/29174#comment:3>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"c3437f734d03d93f798151f712064394652cabed" c3437f73]:
{{{
#!CommitTicketReference repository=""
revision="c3437f734d03d93f798151f712064394652cabed"
Fixed #29174, #29175 -- Doc'd that f-strings and JavaScript template
strings can't be translated.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29174#comment:4>
Comment (by Carlton Gibson <carlton.gibson@…>):
In [changeset:"8b4798c8d31b3cd9faab4caf11fca000b07f0181" 8b4798c]:
{{{
#!CommitTicketReference repository=""
revision="8b4798c8d31b3cd9faab4caf11fca000b07f0181"
[1.11.x] Fixed #29174, #29175 -- Doc'd that f-strings and JavaScript
template strings can't be translated.
Backport of c3437f734d03d93f798151f712064394652cabed from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29174#comment:5>
Comment (by Carlton Gibson <carlton.gibson@…>):
In [changeset:"0d2ec8db483a900c27b8fada30688ef8f25cecfa" 0d2ec8d]:
{{{
#!CommitTicketReference repository=""
revision="0d2ec8db483a900c27b8fada30688ef8f25cecfa"
[2.0.x] Fixed #29174, #29175 -- Doc'd that f-strings and JavaScript
template strings can't be translated.
Backport of c3437f734d03d93f798151f712064394652cabed from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29174#comment:6>
Comment (by Carlton Gibson <carlton.gibson@…>):
In [changeset:"a5d1fe59c59fa716918b6cec5e8ab747720b74fc" a5d1fe5]:
{{{
#!CommitTicketReference repository=""
revision="a5d1fe59c59fa716918b6cec5e8ab747720b74fc"
Revert "[1.11.x] Fixed #29174, #29175 -- Doc'd that f-strings and
JavaScript template strings can't be translated."
This reverts commit 8b4798c8d31b3cd9faab4caf11fca000b07f0181.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29174#comment:7>