wp/wp-includes/class-wp-locale-switcher.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
--- a/wp/wp-includes/class-wp-locale-switcher.php	Fri Sep 05 18:40:08 2025 +0200
+++ b/wp/wp-includes/class-wp-locale-switcher.php	Fri Sep 05 18:52:52 2025 +0200
@@ -273,11 +273,12 @@
 	 * @since 4.7.0
 	 *
 	 * @global WP_Locale $wp_locale WordPress date and time locale object.
+	 * @global PHPMailer\PHPMailer\PHPMailer $phpmailer
 	 *
 	 * @param string $locale The locale to change to.
 	 */
 	private function change_locale( $locale ) {
-		global $wp_locale;
+		global $wp_locale, $phpmailer;
 
 		$this->load_translations( $locale );
 
@@ -285,6 +286,10 @@
 
 		WP_Translation_Controller::get_instance()->set_locale( $locale );
 
+		if ( $phpmailer instanceof WP_PHPMailer ) {
+			$phpmailer->SetLanguage();
+		}
+
 		/**
 		 * Fires when the locale is switched to or restored.
 		 *