M
M
Mark2020-01-12 11:28:25
Yii
Mark, 2020-01-12 11:28:25

How to internationalize emails in Yii2?

Situation: a certain selection of users is sending emails for a CRON task (for example, a reminder about the end of the subscription).
Task : it is necessary to send a letter in the language specified by the user in the settings. Currently, the site itself uses the standard " Internationalization " for translations .
Question: How can this be done correctly?
So far, two ideas:
1. Create separate letters for different languages ​​and attach them to a folder depending on the language.

Example

ru-RU/accountManagement/beforeEndSubscription/reminder-html
en-US/accountManagement/beforeEndSubscription/reminder-html

2. Use standard internationalization and change the "language" configuration value on the fly, but there is doubt whether this will work.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question