-
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
Initialize inline translations module only when they are enabled #27696
Initialize inline translations module only when they are enabled #27696
Conversation
Hi @krzksz. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
@magento give me test instance |
Hi @krzksz. Thank you for your request. I'm working on Magento instance for you |
@magento give me 2.4-develop instance |
Hi @krzksz. Thank you for your request. I'm working on Magento 2.4-develop instance for you |
Hi @krzksz, here is your new Magento instance. |
@magento run all tests |
1 similar comment
@magento run all tests |
@magento run all tests |
@magento give me test instance |
Hi @krzksz. Thank you for your request. I'm working on Magento instance for you |
Hi @krzksz, here is your new Magento instance. |
@magento give me 2.4-develop instance |
@magento run all tests |
Hi @ihor-sviziev, thank you for the review. |
✔️ QA Passed Tested on Magento 2.4-develop with Luma and sample data. 205 → 201 JS requests (-1.96%). When inline translations are disabled there is no request for translate-inline JS file. Was tested and on the Blank theme. |
Hi @krzksz, thank you for your contribution! |
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 (*)
Resolved issues: