[wp-meta] [Making WordPress.org] #3876: Update wporg-gp-customizations to generate language packs for each JS file.
Making WordPress.org
noreply at wordpress.org
Wed Oct 17 11:21:21 UTC 2018
#3876: Update wporg-gp-customizations to generate language packs for each JS file.
--------------------------------------+--------------------
Reporter: herregroen | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Translate Site & Plugins | Keywords:
--------------------------------------+--------------------
In order to support javascript language packs and allow these to be
selectively loaded as described in #3875 wordpress.org will need to be
able to generate language packs for each JS file.
Currently a single language pack is generated in the `Language_Pack` class
during the `build_language_packs` function.
Translation entries are retrieved from GlotPress and all of these are
always added to the PO file.
This should be changed so these translation entries are split according to
their references.
Before building PO files all translation entries should be looped over and
a mapping should be created of filenames to an array of translation
entries. In this mapping there should be a single entry for all
translations that occur in PHP files and an entry for every single JS file
present in the translation references containing the appropriate
translations.
For each entry in this mapping a different PO and MO file should be
created. These should all be added to the same ZIP the current PO and MO
files are added to.
The filenames of the generated files for each JS file should be in the
format of `{$domain}-{$path}-{$locale}`. Where `$path` is the full path to
the JS file with path separators replaced by dashes. For example, the file
`js/src/script.js` containing translations in the `example` domain would
resolve to the filename `example-js-src-script-nl_NL` for translations of
the `nl_NL` locale.
Doing this will ensure all language packs are ready to be included
selectively in WordPress and only translations that are needed will be
loaded.
--
Ticket URL: <https://meta.trac.wordpress.org/ticket/3876>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org
More information about the wp-meta
mailing list