#29175: makemessages does parse ES6 template strings
-----------------------------------------+------------------------
Reporter: tonnzor | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
ECMAScript 6 introduced template strings, that are easy to use
https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Template_literals
But Django 2.0.2 does not recognize it when it tries to extract
translations into PO file. It also gives you a warning in some cases.
Demo:
{{{
# main.js
let header = `${_("Header")}`;
const get_url = id => `/my_user/${id}/`;
let header_old = _("Header old");
}}}
Run:
{{{
./manage.py makemessages -d djangojs -a
}}}
PO file would contain only "Header old".
This is a synthetic example, you could see real-life file attached. It
would generate following warnings:
{{{
api.js:90: warning: unterminated string
api.js:139: warning: RegExp literal terminated too early
}}}
As far as I get, it ignores back-ticks and treats content as regular
expression here.
--
Ticket URL: <https://code.djangoproject.com/ticket/29175>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.a2a0d187c47469ba953ccb61bd2e3cb9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.