Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add locale/language options to email and PDF rendering #1884

Closed
lukeholder opened this issue Nov 19, 2020 · 3 comments
Closed

Add locale/language options to email and PDF rendering #1884

lukeholder opened this issue Nov 19, 2020 · 3 comments
Assignees

Comments

@lukeholder
Copy link
Member

Right now if an email it set to be sent to the customer then the email is rendered in the order's orderLanguage which is the language of the site the order was made in from the front end. Any PDFs that were also attached to those emails were rendered in the same language.

Add following options to PDF setup:

Field Name: PDF Language
Description: Choose the language the PDF will be rendered with.
Dropdown options:

  • The language the order was made in
  • Site A Language
  • Site B Language
  • Site C Language
  • etc...

Add the following to Email setup:

If custom recipients is selected then show the following field:

Field Name: Email Language
Description: Choose the language the PDF will be rendered with.
Dropdown options:

  • The language the order was made in
  • Site A Language
  • Site B Language
  • Site C Language
  • etc

If "send to customer" is selected then "The language the order was made in" is set automatically.

In Emails::sendEmail() override the language as per the email settings.

In Pdfs::renderPdfForOrder() override the language as per the pdf settings.

@lukeholder lukeholder added 💡 enhancement Ideas and suggestions New labels Nov 19, 2020
@lukeholder
Copy link
Member Author

lukeholder commented Nov 19, 2020

Using this solution https://github.com/craftcms/cms/blob/3.1.0/src/controllers/EntriesController.php#L1021-L1022 top set (and restore) the correct locale for rendering.

@thijskaspers
Copy link

Yes please, we need the ability to set the email locale. We have an email template that goes to the admin after an order has been placed, but it is always sent in the locale of the person triggering the email... The shop has 5 languages, and if a French person orders something, the 'new order' notification email is sent to the admin in French, which he can't read.

We could of course make a static template that doesn't use the |t() filter for the admin notification, but in our case the email is quite complex with a lot of extending/includes and that wouldn't make DRY code.

Any idea when this will be implemented?

brandonkelly added a commit that referenced this issue Dec 9, 2020
@lukeholder
Copy link
Member Author

lukeholder commented Dec 9, 2020

This has been fixed by #1895 and will be in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants