Changes between Initial Version and Version 9 of Ticket #3876
- Timestamp:
- 10/18/2018 11:18:34 AM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #3876
- Property Keywords has-patch added
-
Property
Summary
changed from
Update wporg-gp-customizations to generate language packs for each JS file.
toUpdate wporg-gp-customizations to generate translation files for each JS file.
-
Ticket #3876 – Description
initial v9 1 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.1 In order to support seperate javascript translation files and allow these to be selectively loaded as described in #3875 wordpress.org will need to be able to generate translation files for each JS file. 2 2 3 Currently a single language pack is generatedin the `Language_Pack` class during the `build_language_packs` function.3 Currently a single translation file is generated ( in both po and mo format ) in the `Language_Pack` class during the `build_language_packs` function. 4 4 5 5 Translation entries are retrieved from GlotPress and all of these are always added to the PO file. … … 9 9 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. 10 10 11 For each entry in this mapping a different PO and MOfile should be created. These should all be added to the same ZIP the current PO and MO files are added to.11 For each entry in this mapping a different translation file should be created. These should all be added to the same ZIP the current PO and MO files are added to. 12 12 13 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. 13 ~~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.~~ 14 14 15 Doing this will ensure all language packs are ready to be included selectively in WordPress and only translations that are needed will be loaded. 15 The filenames of the generated files for each JS file should be in the format of `{$domain}-{$locale}-{$md5_of_path}`. Where `$md5_of_path` is based on the full path to the JS file. For example, the file `js/src/script.js` containing translations in the `example` domain would resolve to the filename `example-nl_NL-c3d772dafc117eeef45013ceb21629ed` for translations of the `nl_NL` locale. 16 17 Doing this will ensure all translation files are ready to be included selectively in WordPress and only translations that are needed will be loaded.