Jump to content
thirty bees forum

Recommended Posts

Posted

We are busy with the last translations for emails, for some emails it is possible to translate the email subject but not for all.

Is it possible to make the others with no email subject field translatable in the next release or update?


Screenshot_2019-10-15 Translations • DrankExpert.png

Screenshot_2019-10-15 Translations • DrankExpert(1).png

  • Like 1
Posted

I'm afraid that can't be done at the moment. Email subject translation works strangely - thirtybees is going through all php files on your system and looking for this pattern

Mail::send(1, 'template-name', Mail::l('Subject'))

When it finds this pattern, it notes that email template with name 'template-name' uses subject 'Subject', and offers it for translation (translation is performed within Main::l method during runtime)

Unfortunately, this means that emails subjects and template must be hardcoded in the php code in order for them to be translatable. If there is some code that dynamically chooses email template, then translation doesn't work. Take following code for example:

$template = 'template-name';
$subject = 'Subject';
Mail::send(1, $template, Mail::l($subject));

It should, theoretically, do the same as the previous snippet. The only change is that constants are extracted to variables. But, in this case, thirtybees's static analysis is unable to determine the association between 'template-name' and 'Subject'

There are many emails in the system that are using this dynamic way. For example, emails regarding order status changes. Because order statuses are not hardcoded (you can create new one in back office), email subject can't be hardcoded in php codebase as well. And, therefore, they are not translatable using standard mechanism.

Note that order status change emails use order status name as a subject, so you can modify order status name to tweak email subject. Or, you can use my conseqs module and replace subject on the fly

 

  • Like 1
  • 7 months later...
Posted
On 10/16/2019 at 7:23 AM, datakick said:

so you can modify order status name to tweak email subject.

any hint how to do this?

Posted (edited)
30 minutes ago, Sigi said:

any hint how to do this?

Click on edit and add new status name 🙂

Screenshot_2020-05-19 Statuses.png

Edited by toplakd
  • Thanks 1
  • 3 years later...
  • 10 months later...
Posted (edited)

I do encounter problems with french emails translations.. when I delete the directory and click on update .. it downloads english themes translations/ templates on the mails/fr directory

In order to get translated emails, I used an old website and export emails from there and upload it.

Edited by zen

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Ă—
Ă—
  • Create New...