#29174 closed Cleanup/optimization (fixed)
makemessages does not find translations in Python 3.6 formatted string literals
Reported by: | Artem Skoretskiy | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 2.0 |
Severity: | Normal | Keywords: | |
Cc: | Artem Skoretskiy | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Python 3.6 introduced formatted string literals, that are easy to use https://docs.python.org/3/reference/lexical_analysis.html#f-strings
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".
Change History (7)
comment:1 by , 7 years ago
Cc: | added |
---|
comment:2 by , 7 years ago
comment:3 by , 7 years ago
Component: | Internationalization → Documentation |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Bug → Cleanup/optimization |
Yes, I guess the best we can do for now is documenting that current gettext limitation.
Note:
See TracTickets
for help on using tickets.
I don't have much expertise about translations but is this a Python or xgettext issue rather than something Django can solve?