Skip to content

Remove the translation loading.#22245

Merged
leonidasmi merged 3 commits intotrunkfrom
496-remove-load_plugin_textdomain-from-all-our-plugins-since-its-now-redundant-for-all-add-ons-too-since-wp-68
Jan 20, 2026
Merged

Remove the translation loading.#22245
leonidasmi merged 3 commits intotrunkfrom
496-remove-load_plugin_textdomain-from-all-our-plugins-since-its-now-redundant-for-all-add-ons-too-since-wp-68

Conversation

@thijsoo
Copy link
Copy Markdown
Contributor

@thijsoo thijsoo commented May 8, 2025

Context

  • Since 6.7 we don't need to add our own translation domain loading.

Summary

This PR can be summarized in the following changelog entry:

  • Modernizes how translations of the plugin work by removing the unneeded load_plugin_textdomain() calls.

Relevant technical choices:

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Smoke test our plugin in another language than English and do the same for a multisite install.
mu-plugin use
  • In a fresh non-english site, use Yoast SEO as a mu-plugin and gain confirm that non-english translations work. The way you would do that is:
  • Install but not activate this RC
  • Add a yoast-seo-loader.php in wp-content/mu-plugins with the following code:
 <?php
/**
 * MU-Plugin loader for Yoast SEO.
 * This simply requires the real plugin file from the plugins directory.
 */

$yoast_main = WP_PLUGIN_DIR . '/wordpress-seo/wp-seo.php';

if ( file_exists( $yoast_main ) ) {
    require_once $yoast_main;
}
  • In Dashboard->Updates, go and update the translations
  • Go to a Yoast admin page and confirm that you see translations.
Translated option defaults
  • Now install the RC in a completely fresh site, that's in non-english language. Once you activate it, go to the db and find the wpseo-titles entry
    • Confirm that the entries that contain strings are translated. For example, the title-404-wpseo title is not Page not found but its translation.

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes #

@thijsoo thijsoo added the changelog: other Needs to be included in the 'Other' category in the changelog label May 8, 2025
@coveralls
Copy link
Copy Markdown

coveralls commented May 8, 2025

Pull Request Test Coverage Report for Build ff91b585ee46a916601f5f9e6cc1e564a5cfe186

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall first build on 496-remove-load_plugin_textdomain-from-all-our-plugins-since-its-now-redundant-for-all-add-ons-too-since-wp-68 at 49.861%

Totals Coverage Status
Change from base Build 1c98b1bb816ef353eae4ee35766c1370dee834f0: 49.9%
Covered Lines: 17952
Relevant Lines: 36004

💛 - Coveralls

Copy link
Copy Markdown
Contributor

@igorschoester igorschoester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AT 🚫

I got a fatal activating the plugin. We still call this function here.

…e-load_plugin_textdomain-from-all-our-plugins-since-its-now-redundant-for-all-add-ons-too-since-wp-68
@leonidasmi leonidasmi added this to the 27.0 milestone Jan 20, 2026
Copy link
Copy Markdown
Contributor

@leonidasmi leonidasmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR + Acceptance is ✅

Comment thread wp-seo-main.php
$mu_path = str_replace( '\\', '/', WPMU_PLUGIN_DIR );

if ( stripos( $wpseo_path, $mu_path ) !== false ) {
load_muplugin_textdomain( 'wordpress-seo', dirname( WPSEO_BASENAME ) . '/languages/' );
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the relevant dev note, load_muplugin_textdomain() is also not needed anymore. I'm adding a technical decision note in the PR, for future reference (plus some test instructions for it)

Comment thread wp-seo-main.php
require_once WPSEO_PATH . 'inc/wpseo-functions.php';
require_once WPSEO_PATH . 'inc/class-wpseo-installation.php';

wpseo_load_textdomain(); // Make sure we have our translations available for the defaults.
Copy link
Copy Markdown
Contributor

@leonidasmi leonidasmi Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only on a second glance I was able to realize what this was for (aka, being able to have translations available for the translate_defaults() function of wpseo options). I have added an explicit step about it in the test instructions.

@leonidasmi leonidasmi merged commit b101649 into trunk Jan 20, 2026
34 checks passed
@leonidasmi leonidasmi deleted the 496-remove-load_plugin_textdomain-from-all-our-plugins-since-its-now-redundant-for-all-add-ons-too-since-wp-68 branch January 20, 2026 15:45
@thijsoo thijsoo mentioned this pull request Jan 21, 2026
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: other Needs to be included in the 'Other' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants