Make WordPress Core

Changes between Initial Version and Version 3 of Ticket #45103


Ignore:
Timestamp:
10/17/2018 08:33:10 PM (5 years ago)
Author:
ocean90
Comment:

Moving to 5.0 since this is required for the new editor.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #45103

    • Property Focuses javascript added
    • Property Summary changed from Automatically load JavaScript language packs when scripts are enqueued if these exist. to Automatically load JavaScript translations when scripts are enqueued if these exist.
    • Property Priority changed from normal to high
    • Property Milestone changed from Awaiting Review to 5.0
    • Property Severity changed from normal to critical
  • Ticket #45103 – Description

    initial v3  
    1 In order to support javascript language packs and allow these to be selectively loaded as described in https://meta.trac.wordpress.org/ticket/3875 WordPress should load language packs for a given JS file when that file is enqueued and the appropriate language pack exists.
     1In order to support javascript translations and allow these to be selectively loaded as described in #Meta3875 WordPress should load translations for a given JS file when that file is enqueued and the appropriate language pack exists.
    22
    3 Language packs for JS files should be generated when https://meta.trac.wordpress.org/ticket/3876 is resolved. This will mean that there will be separate language packs for every JS file present.
     3Translations for JS files should be generated when #Meta3876 is resolved. This will mean that there will be separate language packs for every JS file present.
    44
    5 When a script is enqueued WordPress should check if a language pack for that specific script exists and, if so, use `wp_localize_script` to load all these translations. An additional script should also be added to then load these translation using `wp.i18n.setLocaleData` ( see [[https://github.com/WordPress/gutenberg/tree/master/packages/i18n|@wordpress/i18n]]. Note that `setLocaleData` will only create a new `Jed` instance if none exist, otherwise the new domain will be merged into any existing domains ).
     5When a script is enqueued WordPress should check if a translation file for that specific script exists and, if so, use `wp_localize_script` to load all these translations. An additional script should also be added to then load these translation using `wp.i18n.setLocaleData` ( see [[https://github.com/WordPress/gutenberg/tree/master/packages/i18n|@wordpress/i18n]]. Note that `setLocaleData` will only create a new `Jed` instance if none exist, otherwise the new domain will be merged into any existing domains ).
    66
    7 Because we do not know in advance which domains a script uses we should load all domains for which files exist, likely using `glob` to find all language packs for the given filename and current locale ).
     7Because we do not know in advance which domains a script uses we should load all domains for which files exist, likely using `glob` to find all translation files for the given filename and current locale ).
    88
    99Doing this would ensure that all translations a JS file uses are loaded into `wp.i18n` before that script is run and that only the translations that might possibly be used are loaded instead of every single translation.