Make WordPress Core


Ignore:
Timestamp:
03/15/2022 03:57:57 PM (4 years ago)
Author:
ocean90
Message:

I18N, Script Loader: Don't register empty locale data objects.

For wp.i18n the library Jed was initially used which was throwing an error if a domain was not registered but used in a translate function. Later, the library was replaced by Tannin which no longer requires the domain to be registered and thus we can avoid printing an empty-ish translations script that doesn't add any translations.

Props jsnajdr.
Fixes #55250.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class.wp-scripts.php

    r52610 r52937  
    600600
    601601        if ( ! $json_translations ) {
    602             // Register empty locale data object to ensure the domain still exists.
    603             $json_translations = '{ "locale_data": { "messages": { "": {} } } }';
     602            return false;
    604603        }
    605604
Note: See TracChangeset for help on using the changeset viewer.