Magento2: Asynchronous mail sending does not use store language, mails are sent in en_US instead

Created on 6 Sep 2016  路  8Comments  路  Source: magento/magento2

Preconditions

  1. ce 2.1.1
  2. one store view, using locale de_DE with some german translations for the order confirmation mail. (the actual language is irrelevant as long as there are translations other than en_US so that the problem is shown)

    Steps to reproduce

  3. enable asynchronous mail sending

  4. create an order in the frontend
  5. wait for next cron run and check the order confirmation mail

    Expected result

  6. order confirmation mail is in the language de_DE

    Actual result

  7. order confirmation mail is in the language en_US

when turning off asynchronous mail sending, the mail is sent in the correct language, in our case in german. asynchronous mail sending does not seem to be setting the app store context to the correct store.

Fixed in 2.2.x Fixed in 2.3.x Format is valid Ready for Work bug report

Most helpful comment

The problem is that when executing cron or running a command from the command line, the renderer is not set correctly on the \Magento\Framework\Phrase, i.e. the method public static function setRenderer(RendererInterface $renderer) is not called with the renderer as defined by the di.xml files.

Usually this is done by Magento\Framework\App\Area in the protected function _initTranslate() method.

Find attached a patch, that gets the area from the AreaList and calls the load method with the correct part parameter.

load_translate_part_of_frontend_area_in_app_emulation-vendor_modulestore_model_app_emulation.diff.zip

All 8 comments

The problem is that when executing cron or running a command from the command line, the renderer is not set correctly on the \Magento\Framework\Phrase, i.e. the method public static function setRenderer(RendererInterface $renderer) is not called with the renderer as defined by the di.xml files.

Usually this is done by Magento\Framework\App\Area in the protected function _initTranslate() method.

Find attached a patch, that gets the area from the AreaList and calls the load method with the correct part parameter.

load_translate_part_of_frontend_area_in_app_emulation-vendor_modulestore_model_app_emulation.diff.zip

affected are as @ktruehl mentioned all mails generated by cron / from a command line function

Thanks for reporting, internal ticket created MAGETWO-58198

Same here

@ktruehl
Thanks!

this issue seems still present in CE 2.1.3

issue is still present in CE 2.1.4, but https://github.com/magento/magento2/pull/8413 will likely fix it in a future release.

@heldchen, thank you for your report.
The fix for this issue is already available in the develop branch and upcoming 2.2.0 release. See https://github.com/magento/magento2/pull/8413.

Was this page helpful?
0 / 5 - 0 ratings