src/Hyyan/WPI/Emails.php
/**
     * Translate to the order language, the email subject of new order email notifications to the admin.
     *
     * @param string   $subject Email subject in default language
     * @param WC_Order $order   Order object
     *
     * @return string Translated subject
     */
Translate to the order language, the email subject of new order email notifications to the admin.
@param string   $subject Email subject in default language
@param WC_Order $order   Order object

@return string Translated subject
Translate to the order language the email subject of new order email notifications to the admin . @param string $subject Email subject in default language @param WC_Order $order Order object @return string Translated subject
public function translateCommonString( $email_string ) {
	     if ( ! function_exists( 'pll_register_string' ) ) {
		     return $email_string;
	     }
	     if ( is_admin() ) {
             global $post;
             if ( $post ) {
                 $locale = pll_get_post_language( $post->ID );
                 return pll_translate_string( $email_string, $locale );
             } else { 
				$ID = false;
				if ( ! isset( $_REQUEST[ 'ipn_track_id' ] ) ) {
					$search = array( 'post', 'post_ID', 'pll_post_id', 'order_id' );
					foreach ( $search as $value ) {
						if ( isset( $_REQUEST[ $value ] ) ) {
							$ID = esc_attr( $_REQUEST[ $value ] );
							break;
						}
					}
				} else {
					$ID = $this->getOrderIDFromIPNRequest();
				}
				if ( $ID ) {
					$locale = pll_get_post_language( $ID );
					return pll_translate_string( $email_string, $locale );
				}
             }
	     }
	     $trans = pll__( $email_string );
	     if ( $trans ) {
		     return $trans;
	     }
	     return $email_string;
     }
public function translateCommonString ( $ email_string ) { if ( ! function_exists ( 'pll_register_string' ) ) { return $ email_string ; } if ( is_admin ( ) ) { global $ post ; if ( $ post ) { $ locale = pll_get_post_language ( $ post -> ID ) ; return pll_translate_string ( $ email_string , $ locale ) ; } else { $ ID = false ; if ( ! isset ( $ _REQUEST [ 'ipn_track_id' ] ) ) { $ search = array ( 'post' , 'post_ID' , 'pll_post_id' , 'order_id' ) ; foreach ( $ search as $ value ) { if ( isset ( $ _REQUEST [ $ value ] ) ) { $ ID = esc_attr ( $ _REQUEST [ $ value ] ) ; break ; } } } else { $ ID = $ this -> getOrderIDFromIPNRequest ( ) ; } if ( $ ID ) { $ locale = pll_get_post_language ( $ ID ) ; return pll_translate_string ( $ email_string , $ locale ) ; } } } $ trans = pll__ ( $ email_string ) ; if ( $ trans ) { return $ trans ; } return $ email_string ; }
Translate to the order language, the email subject of new order email notifications to the admin.
Translate to the order language the email subject of new order email notifications to the admin .
//#435 allow the possibility of other screens sending email, including where current_screen is not defined //$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false; //if ( $screen && $screen->id == 'shop_order' ) { //moved from correctLocal