Make WordPress Core

Changeset 55196


Ignore:
Timestamp:
02/02/2023 09:29:53 PM (13 months ago)
Author:
audrasjb
Message:

I18N: Pass $locale parameter to override_load_textdomain filter.

In [53874] the $locale parameter was added to load_textdomain() so it can be used to properly fill WP_Textdomain_Registry. Since $locale may not be the same value as determine_locale() returns (e.g. when filtered by plugin_locale in load_plugin_textdomain()) this changeset also passes the $locale parameter to the filter so custom file loading implementations are using the same locale as load_textdomain() got.

Follow-up to [53874].

Props ocean90, cadic, SergeyBiryukov, swissspidy, costdev.
Fixes #57056.

File:
1 edited

Legend:

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

    r55161 r55196  
    726726     *
    727727     * @since 2.9.0
    728      *
    729      * @param bool   $override Whether to override the .mo file loading. Default false.
    730      * @param string $domain   Text domain. Unique identifier for retrieving translated strings.
    731      * @param string $mofile   Path to the MO file.
    732      */
    733     $plugin_override = apply_filters( 'override_load_textdomain', false, $domain, $mofile );
     728     * @since 6.2.0 Added the `$locale` parameter.
     729     *
     730     * @param bool        $override Whether to override the .mo file loading. Default false.
     731     * @param string      $domain   Text domain. Unique identifier for retrieving translated strings.
     732     * @param string      $mofile   Path to the MO file.
     733     * @param string|null $locale   Locale.
     734     */
     735    $plugin_override = apply_filters( 'override_load_textdomain', false, $domain, $mofile, $locale );
    734736
    735737    if ( true === (bool) $plugin_override ) {
Note: See TracChangeset for help on using the changeset viewer.