[wp-trac] [WordPress Trac] #45103: Automatically load JavaScript translations when scripts are enqueued if these exist.
WordPress Trac
noreply at wordpress.org
Fri Oct 19 13:15:15 UTC 2018
#45103: Automatically load JavaScript translations when scripts are enqueued if
these exist.
-------------------------+-------------------------
Reporter: herregroen | Owner: (none)
Type: enhancement | Status: new
Priority: high | Milestone: 5.0
Component: I18N | Version: trunk
Severity: critical | Resolution:
Keywords: needs-patch | Focuses: javascript
-------------------------+-------------------------
Comment (by nerrad):
Ya it looks like the right approach. However:
This assumes that translation files will always be in a specific format
and have a specific filename. So its very oriented towards (I'm assuming)
files built by Glotpress (in most cases via wp.org I'm assuming). Will
there be allowance for plugins not hosted on wp.org and/or prepare their
own translation files? In other words:
- Will core only be handling .json files (which I'm okay with, just want
to clarify)? If so, we should document the expected shape of the json
object.
- Is the shape of the json object what jed expects? I know in the work I
did for the GB pull I had to coerce locale data into an object jed
expected. I'm not familiar with what glotpress outputs so I just thought
I'd raise this as a point to investigate if its not already known.
- I'm assuming the filename will be expected to be this explicit format
(md5 hashed script name etc, and no provision for providing the name of
the file)? If so, we'll need to document the expected filename structure.
- Along those lines, at the beginning of `print_inline_translations` we
could maybe have a shortcut filter registered to `$filename`. And if that
has a non empty value then the usual filename logic could be skipped.
This could provide plugins the option to provide their own expected
filename for a translation file? Or add a `$filename` argument?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45103#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list