[Issue] Initialize inline translations module only when they are enabled #29553
Labels
Component: Translation
Fixed in 2.4.x
The issue has been fixed in 2.4-develop branch
Issue: Format is not valid
Gate 1 Failed. Automatic verification of issue format is failed
Priority: P2
A defect with this priority could have functionality issues which are not to expectations.
Progress: done
Reported on 2.4.0
Indicates original Magento version for the Issue report.
Severity: S3
Affects non-critical data or functionality and does not force users to employ a workaround.
This issue is automatically created based on existing pull request: #27696: Initialize inline translations module only when they are enabled
Description (*)
This PR is a part of my effort to improve Magento 2 frontend performance.
The focus point of this PR was to remove downloading of inline translations JavaScript modules when they are not enabled. This was happening because they were defined in
deps
, which is completely redundant because they are properly initialized in https://github.com/krzksz/magento2/blob/98e04e174906799b941011a9fb1b5890a5e7cae9/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml#L57While I was touching the files anyway I took the liberty to:
escapeHTML
to utilities (it is not used anywhere else and there is already anunescape
counterpart).serialize
method.Performance improvement
Tested on Magento 2.4-develop with Luma and sample data.
Manual testing scenarios (*)
translate-inline
JS file.Questions or comments
Contribution checklist (*)
The text was updated successfully, but these errors were encountered: