wp/wp-includes/class-wp-locale-switcher.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
   271 	 * all post type labels.
   271 	 * all post type labels.
   272 	 *
   272 	 *
   273 	 * @since 4.7.0
   273 	 * @since 4.7.0
   274 	 *
   274 	 *
   275 	 * @global WP_Locale $wp_locale WordPress date and time locale object.
   275 	 * @global WP_Locale $wp_locale WordPress date and time locale object.
       
   276 	 * @global PHPMailer\PHPMailer\PHPMailer $phpmailer
   276 	 *
   277 	 *
   277 	 * @param string $locale The locale to change to.
   278 	 * @param string $locale The locale to change to.
   278 	 */
   279 	 */
   279 	private function change_locale( $locale ) {
   280 	private function change_locale( $locale ) {
   280 		global $wp_locale;
   281 		global $wp_locale, $phpmailer;
   281 
   282 
   282 		$this->load_translations( $locale );
   283 		$this->load_translations( $locale );
   283 
   284 
   284 		$wp_locale = new WP_Locale();
   285 		$wp_locale = new WP_Locale();
   285 
   286 
   286 		WP_Translation_Controller::get_instance()->set_locale( $locale );
   287 		WP_Translation_Controller::get_instance()->set_locale( $locale );
       
   288 
       
   289 		if ( $phpmailer instanceof WP_PHPMailer ) {
       
   290 			$phpmailer->SetLanguage();
       
   291 		}
   287 
   292 
   288 		/**
   293 		/**
   289 		 * Fires when the locale is switched to or restored.
   294 		 * Fires when the locale is switched to or restored.
   290 		 *
   295 		 *
   291 		 * @since 4.7.0
   296 		 * @since 4.7.0