Description
Preconditions (*)
- Clean Magento 2.4.1 installation
- 2.4-develop
Steps to reproduce (*)
- Add a product to cart
- Navigate to cart page
- Open admin interface, find the product, save it as "Out of Stock"
- Refresh cart page, see error message: There are no source items with the in stock status
- Find the translation for the message in vendor/magento/module-catalog-inventory/i18n/en_US.csv
- Change the result string to be something else
- Clean "translate" cache
- Refresh the cart page and witness the previously mentioned string being not translated to value we changed it at point 6
Expected result (*)
- Error messages are translated
Actual result (*)
- Error messages are not translated - can be verified even with default en_US language - change the translation for the error message
NOTES
The steps to reproduce part only highlights one specific string, however this seems to be a more general problem:
Due to update of design (and translations) loading in b2a035d
(loading design and translations was moved from beforeDispatch to beforeExecute)
However there are several plugins in M2 ecosystem, which come before actual execute call, \Magento\InventorySales\Model\IsProductSalableForRequestedQtyCondition\IsProductSalableForRequestedQtyConditionChain is one of the many examples (on quote loading, validation is triggered).
Verified this in clean Magento 2.4.1 - the error phrase is never translated, as renderers for Phrase is set only in \Magento\Theme\Plugin\LoadDesignPlugin::beforeExecute
This happens due to renderer not being set to \Magento\Framework\Phrase, and if it is used earlier than the renderers are set - the original string gets returned, as it uses the RendererPlaceholder class to render them.
With current state, a lot of strings cannot be translated, the only imaginable workaround is to move design and translations loading back to beforeDispatch method. (Moving just the translation loading to beforeDispatch won't help, if the translations are in theme.)
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- < ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- [ > Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status