| @@ -1,8 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace SpringDevs\Subscription\Illuminate\Emails; |
| 4 | 4 | |
| 5 | +use SpringDevs\Subscription\Illuminate\Multilingual; | |
| 5 | 6 | use SpringDevs\Subscription\Traits\Email; |
| 6 | 7 | use WC_Email; |
| 7 | 8 | |
| 8 | 9 | /** |
| @@ -64,11 +65,18 @@ | ||
| 64 | 65 | } |
| 65 | 66 | $this->placeholders['{subscription_id}'] = $subscription_id; |
| 66 | 67 | $this->subscription_id = $subscription_id; |
| 67 | 68 | |
| 69 | + // In the customer's language, not the site's or whoever triggered it. | |
| 70 | + $switched = Multilingual::switch_email_language( $this, $subscription_id ); | |
| 71 | + | |
| 68 | 72 | $this->set_table_data(); |
| 69 | 73 | |
| 70 | 74 | $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); |
| 75 | + | |
| 76 | + if ( $switched ) { | |
| 77 | + Multilingual::restore_email_language( $this ); | |
| 78 | + } | |
| 71 | 79 | } |
| 72 | 80 | |
| 73 | 81 | /** |
| 74 | 82 | * Initialize form fields for settings. |