-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Consumer - product alert emails are not translated #35674
Comments
Hi @loic-paquin. Thank you for your report.
Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
For more details, review the Magento Contributor Assistant documentation. Add a comment to assign the issue: To learn more about issue processing workflow, refer to the Code Contributions.
🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket. ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
Hi @engcom-Lima. Thank you for working on this issue.
|
Hi @loic-paquin , Thanks for your contribution and collaboration. As this issue related to this issue #35602 and it is taking time to resolve . Thanks |
Reproduced issue in Magento pce 2.4.5-p2 |
I have the same problem on Magento 2.4.6-p1. |
@loic-paquin I didn't understand your comment that it will be needed to add Magento\Framework\App\AreaList in the constructor. Can you please provide the exact code changes? |
This is what I did at the time, I used a preference : It worked well on 2.4.4, I cannot confirm it will works on current Magento version. You can see I added on L69 AreaList $areaList in the constructor |
@loic-paquin Anyway, based on your directions, I created and applied the below patch and tested it on Magento 2.4.6-p1 with PHP 8.1.20, and it worked without any errors recorders in the log files. I would like to thank you for that. `diff --git a/vendor/magento/module-product-alert/Model/Email.php b/vendor/magento/module-product-alert/Model/Email.php /**
@@ -164,6 +171,7 @@ class Email extends AbstractModel
@@ -175,6 +183,7 @@ class Email extends AbstractModel
@@ -346,7 +355,9 @@ class Email extends AbstractModel
` |
Reproduced on 2.4.5-p2 |
Hello. It looks like dependent issue fixed. Could you please test this issue again? After my translations did not work, I realized that this was the problem. |
Hi @engcom-Dash. Thank you for working on this issue.
|
use Magento\Framework\App\Area;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Phrase;
use Magento\Framework\Phrase\Renderer\Composite;
use Magento\Framework\Translate;
use Magento\ProductAlert\Model\Mailing\AlertProcessor;
class AlertProcessorPlugin
{
function beforeProcess(AlertProcessor $object, string $alertType, array $customerIds, int $websiteId)
{
$objectManager = ObjectManager::getInstance();
$objectManager->get(Translate::class)->loadData(Area::AREA_FRONTEND, true);
Phrase::setRenderer($objectManager->get(Composite::class));
return [$alertType, $customerIds, $websiteId];
}
} I just added this plugin to fix the product alert translation issue it is working for me |
Hi @loic-paquin We have reopened the dependent issue - 35602. Will test this issue once the dependent issue is fixed. Thanks. |
Hi @loic-paquin Thanks for reporting and collaboration. Verified the issue on Magento 2.4 dev instance and the issue is not reproducable. Product alert emails are being translated Steps to reproduce
The consumer is launched Please refer the attached screenshots and let us know if we missed anything. |
Hi @loic-paquin As there is no activity on this issue for a long time, we believe the issue has been resolved, hence closing this issue. Thank you. |
Preconditions and environment
Steps to reproduce
Expected result
Actual result
The email is sent in english even if the translations are available in the language pack
Additional information
I was able to fix the problem by editing the class Magento\ProductAlert\Model\Email
I added those lines after the call to the startEnvironmentEmulation function ( around L349)
$area = $this->areaList->getArea(\Magento\Framework\App\Area::AREA_FRONTEND);
$area->load(\Magento\Framework\App\Area::PART_TRANSLATE);
( You will need to add Magento\Framework\App\AreaList in the constructor)
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: