Make WordPress Core


Ignore:
Timestamp:
10/24/2022 10:01:01 AM (20 months ago)
Author:
swissspidy
Message:

I18N: Change how WP_Textdomain_Registry stores the default languages path.

WP_Textdomain_Registry was introduced in [53874] to store text domains and their language directory paths, addressing issues with just-in-time loading of textdomains when using locale switching and when usingload_*_textdomain() functions.

Said change has inadvertently caused a performance regression exactly when usingload_*_textdomain(), which still often is the case, where the cached information was not further used or even overridden.

This change addresses that issue by storing the default languages paths in a separate way, while at the same time making WP_Textdomain_Registry easier to maintain and adding new tests to catch future regressions.

Props flixos90, spacedmonkey, ocean90, SergeyBiryukov, costdev.
Fixes #39210.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/l10n/loadTextdomain.php

    r53874 r54669  
    2929        global $wp_textdomain_registry;
    3030
    31         $wp_textdomain_registry->reset();
     31        $wp_textdomain_registry = new WP_Textdomain_Registry();
    3232    }
    3333
     
    3737        global $wp_textdomain_registry;
    3838
    39         $wp_textdomain_registry->reset();
     39        $wp_textdomain_registry = new WP_Textdomain_Registry();
    4040
    4141        parent::tear_down();
Note: See TracChangeset for help on using the changeset viewer.