WordPress.org

Making WordPress.org

Changes between Initial Version and Version 9 of Ticket #3876


Ignore:
Timestamp:
10/18/2018 11:18:34 AM (8 months ago)
Author:
herregroen
Comment:

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. to Update 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.
     1In 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.
    22
    3 Currently a single language pack is generated in the `Language_Pack` class during the `build_language_packs` function.
     3Currently a single translation file is generated ( in both po and mo format ) in the `Language_Pack` class during the `build_language_packs` function.
    44
    55Translation entries are retrieved from GlotPress and all of these are always added to the PO file.
     
    99Before 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.
    1010
    11 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.
     11For 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.
    1212
    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.~~
    1414
    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.
     15The 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
     17Doing this will ensure all translation files are ready to be included selectively in WordPress and only translations that are needed will be loaded.