Use the new localization syntax for all ES6 JavaScript.
Review Request #11001 — Created April 10, 2020 and submitted
This makes use of the new babel-plugin-django-gettext template literal
support in our ES6 JavaScript files, giving us much more readable code,
especially when long strings are concerned.We can now use the new
_
prefix and break strings into multiple lines,
and the plugin will take care to clean up the whitespace and turn them
back into single-linegettext()
calls. We can also reference variables
in template literals, and the plugin will turn them intointerpolate()
calls (though we don't make use of that currently int his codebase).There are still files that aren't converted to ES6 in this codebase, and
there are likely a lot of unlocalized strings, but this change doesn't
tackle either. It's really the changes that were being tested during the
development of the plugin.
Built a package and compared the generated code to the source code.
Saw that each and every new-style localization was converted to an
old-fashionedgettext()
, with the expected strings.
Description | From | Last Updated |
---|---|---|
Can you just quickly double-check that the generated code is correct here? |
david |
- Change Summary:
-
Updated one more string localization.
- Commit:
-
028289fbb2edc81f94a0c926b44dd1261090eb0280df8c18bf59529dea1e9d2ffb303e02b78c98a0
- Diff:
-
Revision 2 (+30 -15)
Checks run (2 succeeded)
- Change Summary:
-
Switched an inline localization to use
${_.escape(...)}
. - Commit:
-
80df8c18bf59529dea1e9d2ffb303e02b78c98a0c5f0f6c5491ed28bc7aa23e5062080da285a146b
- Diff:
-
Revision 3 (+30 -15)