Magento2: advanced bundling js translation not (always) working

Created on 22 Jul 2019  路  8Comments  路  Source: magento/magento2


When using advanced bundling, some core strings are not translatable.

Preconditions (*)

  1. Use any supported Magento Version (e.g. latest)
  2. Configure and use advanced bundling (eventually also reproducable with current default bundling implementation)
  3. use a language pack or translate "Cancel" to anything else in your locale

Steps to reproduce (*)

  1. add product to cart
  2. hit the delete button in minicart

Expected result (*)

  1. The Cancel Button is translated

Actual result (*)

  1. The Cancel Button is not translated
    (same probably for OK, but OK does not have to be translated for many locales)

This error can potentially appear in many more cases, where strings are translated in js before the translations are fully initialized.

I'm not a frontend dev but it seems that the translations are initialized in the body here while some js components already try to use the translate function during initialization.
When bundled, this happens before the actual translations are loaded

See translation initialization:
https://github.com/magento/magento2/blob/2e7f0396e370074b4998a6b56636fb1ddb6da74b/app/code/Magento/Translation/view/base/templates/translate.phtml

and confirm modal initialization:
https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Ui/view/base/web/js/modal/confirm.js

Translation Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.2.x Reproduced on 2.3.x

Most helpful comment

Internal ticket MC-19247 created and it is currently in progress

All 8 comments

Hi @davidverholen. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@davidverholen do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

Hi @davidverholen. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 6. Add label Issue: Confirmed once verification is complete.

  • [ ] 7. Make sure that automatic system confirms that report has been added to the backlog.

:white_check_mark: Confirmed by @davidverholen
Thank you for verifying the issue. Based on the provided information internal tickets MC-18420, MC-18421 were created

Issue Available: @davidverholen, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._

@DrewML fyi. I do not really have an idea what happens in the translate.phtml and why it is implemented like that (instead of adding the translations during init of the translate component) so I do not really have an Idea how to fix this.

No problem @davidverholen - appreciate the thorough bug report. Getting it assigned out to someone internally

Internal ticket MC-19247 created and it is currently in progress

Hi @davidverholen fix is merged into mainline with this commit:
https://github.com/magento/magento2/commit/71c781df5536a2ec79c9cf42ade0c262396767a3

The issue has been fixed and delivered into 2.3develop.
Closed.

Was this page helpful?
0 / 5 - 0 ratings