From 09d26de216cd53eee15cc2014234c3359babe8a4 Mon Sep 17 00:00:00 2001 From: audrasjb Date: Thu, 2 Feb 2023 21:31:18 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@55196 git-svn-id: http://core.svn.wordpress.org/trunk@54729 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/l10n.php | 10 ++++++---- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index e83706df66..f3dbc282bb 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -725,12 +725,14 @@ function load_textdomain( $domain, $mofile, $locale = null ) { * Filters whether to override the .mo file loading. * * @since 2.9.0 + * @since 6.2.0 Added the `$locale` parameter. * - * @param bool $override Whether to override the .mo file loading. Default false. - * @param string $domain Text domain. Unique identifier for retrieving translated strings. - * @param string $mofile Path to the MO file. + * @param bool $override Whether to override the .mo file loading. Default false. + * @param string $domain Text domain. Unique identifier for retrieving translated strings. + * @param string $mofile Path to the MO file. + * @param string|null $locale Locale. */ - $plugin_override = apply_filters( 'override_load_textdomain', false, $domain, $mofile ); + $plugin_override = apply_filters( 'override_load_textdomain', false, $domain, $mofile, $locale ); if ( true === (bool) $plugin_override ) { unset( $l10n_unloaded[ $domain ] ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 5d3eeeba43..a9d3e474e5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-alpha-55195'; +$wp_version = '6.2-alpha-55196'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.