pliciweb_stephane Posted December 3, 2018 Share Posted December 3, 2018 (edited) Hi, I have a specific class in override directory that send a specific email with a Prestashop 1.7.4.2 That is my code : Mail::Send( (int) Context::getContext()->language->id, 'my_specific_template', Context::getContext()->getTranslator()->trans( 'My email subject', array(), 'Emails.Subject', Context::getContext()->language->id ), array('{param}' => $param), $this->email ) When i want to translate in International -> Translations-> Translate Email / Subject / English, my subject "My email subject" is not visible. If i add an entry in "app/Resources/translations/default/EmailsSubject.xlf" I can see my subject. But when i translate it in Back office, an entry is created in database ps_translation but my email subject is not translate. How i can translate my subject ? Thank for your response. Hope, it'll be useful for other people. Best regards Stéphane Edited December 7, 2018 by pliciweb_stephane Solved (see edit history) Link to comment Share on other sites More sharing options...
Haumea Posted December 5, 2018 Share Posted December 5, 2018 Try with Mail::l('Text here', (int)$id_lang), as the third parameter of the function. Link to comment Share on other sites More sharing options...
pliciweb_stephane Posted December 7, 2018 Author Share Posted December 7, 2018 Hi Haumea, I try with your code, but subject is still in english, it's not translate. I begin to get run out of idea.... Link to comment Share on other sites More sharing options...
pliciweb_stephane Posted December 7, 2018 Author Share Posted December 7, 2018 I realize my mistake, the fourthy parameter of Context::getContext()->getTranslator()->trans get locale "en-US" instead of id_lang (Context::getContext()->language->id). So if i change my code to Mail::Send( (int) Context::getContext()->language->id, 'my_specific_template', Context::getContext()->getTranslator()->trans( 'My email subject', array(), 'Emails.Subject' ), array('{param}' => $param), $this->email ) It's work. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now