Jump to content

EMailPreSend Hook Language Translation


HancoEuropa

Recommended Posts

Hello!

I'm using Lang::trans within a php hook for EMailPreSend.

I set 'credited' in each language override file:

$_LANG['locale'] = "en_GB";
$_LANG['credited'] = "has been credited";

and

$_LANG['locale'] = "ro_RO";
$_LANG['credited'] = ": tranzacția a fost creditată";


Then, in the hook:
 

$merge_fields = [];
$paymentMethodTitle = "Bank Transfer";
$newSubject = $paymentMethodTitle.' '.Lang::trans('credited');
$merge_fields['custom_subject'] = $newSubject;
$vars = array_merge( $vars, $merge_fields );
return $vars;

In the Email Template, the subject is {$custom_subject}, which shows $newSubject variable just fine.

But I guess Lang::trans doesn't use the client's language.

The email template (body) uses the client's language without issue, but ... how in the world do I get Lang::trans in EMailPreSend to use the client's language?

I just want the client's language to be used when sending the client an email (call me silly!). 

Thanks for any clues!

 

 

Edited by HancoEuropa
removed redundant sentence
Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated