# How to translate mail from Photo Reviews for WooCommerce

```php
use Weglot\Parser\Parser;
use Weglot\Parser\ConfigProvider\ServerConfigProvider;

function wg_viwcpr_email_reminder_get_content( $content, $order_id ){ 
	global $woocommerce, $post;
	
    	$option_services   = weglot_get_service( 'Option_Service_Weglot' );
	$parser_services   = weglot_get_service( 'Parser_Service_Weglot' );
	$language_services = weglot_get_service( 'Language_Service_Weglot' );
	$original_language = $language_services->get_original_language()->getInternalCode();

	$woocommerce_order_language = get_post_meta( $order_id, 'weglot_language', true ); // phpcs:ignore
	
	if ( $woocommerce_order_language == weglot_get_original_language() ) {
		return $content;
	}
	
	$config             = new ServerConfigProvider();
	$client             = $parser_services->get_client();
	$parser             = new Parser( $client, $config, [] );
	$content = $parser->translate( $content, $original_language, $woocommerce_order_language ); //phpcs:ignore
   
    return $content;
} 

function viwcpr_email_reminder_get_subject( $subject, $order_id ){ 
	global $woocommerce, $post;
	
    $option_services   = weglot_get_service( 'Option_Service_Weglot' );
	$parser_services   = weglot_get_service( 'Parser_Service_Weglot' );
	$language_services = weglot_get_service( 'Language_Service_Weglot' );
	$original_language = $language_services->get_original_language()->getInternalCode();

	$woocommerce_order_language = get_post_meta( $order_id, 'weglot_language', true ); // phpcs:ignore
	
	if ( $woocommerce_order_language == weglot_get_original_language() ) {
		return $content;
	}
	
	$config             = new ServerConfigProvider();
	$client             = $parser_services->get_client();
	$parser             = new Parser( $client, $config, [] );
	$subject = $parser->translate( $subject, $original_language, $woocommerce_order_language ); //phpcs:ignore
   
    return $subject;
} 

//add the action 
add_filter('viwcpr_email_reminder_get_content', 'wg_viwcpr_email_reminder_get_content', 10, 2);
add_filter('viwcpr_email_reminder_get_subject', 'viwcpr_email_reminder_get_subject', 10, 2);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.weglot.com/wordpress/use-cases/how-to-translate-mail-from-photo-reviews-for-woocommerce.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
