• Priority: 0
  • Status: Closed
  • Theme: Alysum
  • Assigned To: Marek
  • Private: No
  • Open Date: 23.09.19, 09:40
  • Opened by: Walter Fontana
  • Closed by: Marek
  • Closed on: 21.10.19, 20:19
  • Reason: Closed
  • Comment: Glad to help!

Ticket #15654 - Translate Newsletter e-mail subject

I have to translate newsletter e-mail subject (img01)
But I don’t find where i can translate it
In translations section it was already translated but the translation does not work. (img02)

Comments

Marek 23 Sep 2019, 10:12

Hi, Walter.
It should be here https://take.ms/4AWvO

Walter Fontana 23 Sep 2019, 10:27

I’ve already translated that but it doesn’t work
As you can see in img02.

Marek 23 Sep 2019, 10:39

Strange, it should work.
Try to make translation directly in the .html files in the folder /modules/ps_emailsubscription/mails/it

Walter Fontana 23 Sep 2019, 10:59

In your theme the emails are in /themes/alysum/modules/ps_emailsubscription/mails/it
I have already edited the mails, but inside them there is not the subject!

where could it be?

Marek 23 Sep 2019, 11:45

I’m not sure that’s related to the theme. I have found similar issue https://github.com/PrestaShop/PrestaShop/issues/9599

Walter Fontana 24 Sep 2019, 09:23

Hi Marek,
the problem is only for emailsubscription. All other subjects are translated correctly.
I found in /modules/ps_emailsubscription/ps_emailsubscription.php this lines:

/**
     * Send a confirmation email.
     *
     * @param string $email
     *
     * @return bool
     */
    protected function sendConfirmationEmail($email)
    {
        $language = new Language($this->context->language->id);
        return Mail::Send(
            $this->context->language->id,
            'newsletter_conf',
            $this->trans(
                '**Newsletter confirmation**',
                array(),
                'Emails.Subject',
                $language->locale
            ),
            array(),
            pSQL($email),
            null,
            null,
            null,
            null,
            null,
            dirname(__FILE__).'/mails/',
            false,
            $this->context->shop->id
        );
    }
---------------------------------------

 /**
     * Send an email containing a voucher code.
     *
     * @param $email
     * @param $code
     *
     * @return bool|int
     */
    protected function sendVoucher($email, $code)
    {
        $language = new Language($this->context->language->id);
        return Mail::Send(
            $this->context->language->id,
            'newsletter_voucher',
            $this->trans(
                '**Newsletter voucher**',
                array(),
                'Emails.Subject',
                $language->locale
            ),
            array(
                '{discount}' => $code,
            ),
            $email,
            null,
            null,
            null,
            null,
            null,
            dirname(__FILE__).'/mails/',
            false,
            $this->context->shop->id
        );
    }

I can change directly the code, but then if i want to translate it in other languages is not possible.
Really you can’t help me?, because is very important!

Marek 24 Sep 2019, 10:14

ps_emailsubscription is a native prestashop module. As I can see the subject should be available for translation under “Emails.Subject” domain - https://take.ms/gHnwF

You can try to change the domain to “Modules.Emailsubscription.Shop”

Walter Fontana 25 Sep 2019, 09:16

If i do that, where i change the translation? Always in Email-Subject?

Marek 25 Sep 2019, 10:24

you will add a new domain “Modules.Emailsubscription.Shop” so translation should be available in the modules > Emailsubscription > Shop

Walter Fontana 25 Sep 2019, 11:59

No, does not add the two translations!
I realized that it is not possible to translate the subject…

even changing the code directly does not work. It’s normal?

Walter Fontana 26 Sep 2019, 09:41

Can you keep this ticket open? I’ll ask to Alex if he can help me when he has time, so I pay him all the work together.

Marek 26 Sep 2019, 10:18

ok

Alex 06 Oct 2019, 21:59

Unfortunately I didn’t found fast solution how to make translation work as it should via back-oofice
but for now you can translate the subject text directly in the file modules/pspagebuilder/classes/widget/newsletter.php
;)

Alex 07 Oct 2019, 13:22

Hi. Is it important for you to have ability translate it with the Back-office? If yes I will try to find the solution but for that I need a time to go deeper in the code :)

Walter Fontana 07 Oct 2019, 13:30

Hi alex, i received your e-mail with the prices, but I didn’t know you had seen the newsletter problem. If i can translate the subject directly it’s ok for now.
So i have to go to modules/pspagebuilder/classes/widget/newsletter.php and replace Newsletter voucher and Newsletter confirmation with my custom text?

Walter Fontana 11 Oct 2019, 12:31

ok, I understand how to translate the subject
Thanks