Make WordPress Core


Ignore:
Timestamp:
11/11/2022 02:24:29 AM (20 months ago)
Author:
desrosj
Message:

I18N: Initialize textdomain registry in wp_load_translations_early().

Initialize WP_Textdomain_Registry in wp_load_translations_early(). This ensures the global $wp_textdomain_registry is set up prior to loading the translations.

Props azurseisme, TimothyBlynJacobs, costdev, ocean90, flixos90, swissspidy, peterwilsoncc.
Merges [54803] to the 6.1 branch.
Fixes #57051.

Location:
branches/6.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.1

  • branches/6.1/src/wp-includes/load.php

    r54798 r54806  
    13221322 * @access private
    13231323 *
     1324 * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
    13241325 * @global WP_Locale $wp_locale WordPress date and time locale object.
    13251326 */
    13261327function wp_load_translations_early() {
    1327     global $wp_locale;
     1328    global $wp_locale, $wp_textdomain_registry;
    13281329
    13291330    static $loaded = false;
     
    13431344    require_once ABSPATH . WPINC . '/pomo/mo.php';
    13441345    require_once ABSPATH . WPINC . '/l10n.php';
     1346    require_once ABSPATH . WPINC . '/class-wp-textdomain-registry.php';
    13451347    require_once ABSPATH . WPINC . '/class-wp-locale.php';
    13461348    require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php';
     
    13511353    $locales   = array();
    13521354    $locations = array();
     1355
     1356    if ( ! $wp_textdomain_registry instanceof WP_Textdomain_Registry ) {
     1357        $wp_textdomain_registry = new WP_Textdomain_Registry();
     1358    }
    13531359
    13541360    while ( true ) {
Note: See TracChangeset for help on using the changeset viewer.