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
This commit is contained in:
audrasjb 2023-02-02 21:31:18 +00:00
parent bc802e7b51
commit 09d26de216
2 changed files with 7 additions and 5 deletions

View File

@ -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 ] );

View File

@ -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.