Skip to content

Fix translation retrieval #25626

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

Merged

Conversation

brosenberger
Copy link
Contributor

Description (*)

Translationstrings are collected in the static content deploy step with configurable regex-patterns (for the js-tranlsations.json-file - all translations available within a js context (js, ko-templates)).

when bundling of js files is enabled, all html-ko templates do get bundled and attribute-quotes do get escaped. this breaks the current js-file retrieval pattern for translation args

Manual testing scenarios (*)

  1. add translation for in any language
  2. js bundling activated, set locale for the store to where the translation is added
  3. static content deploy
  4. go to checkout 2. page in luma theme
  5. check if Your cart (right summary box headline) is translated

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Nov 16, 2019

Hi @brosenberger. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.3-develop instance - deploy vanilla Magento instance

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

@dmytro-ch dmytro-ch added the Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests label Nov 23, 2019
@magento-engcom-team
Copy link
Contributor

Hi @dmytro-ch, thank you for the review.
ENGCOM-6319 has been created to process this Pull Request

@engcom-Alfa
Copy link
Contributor

Hi @brosenberger.

Could you provide more details on how to reproduce this issue?
Because with standard translation phrases all work correctly and they are recorded into js-translation.json file.
It would be good if you provided an example.

Thanks!

@brosenberger
Copy link
Contributor Author

@engcom-Alfa : i have js-bundling enabled for the static content deploy and following bundle.js is generated for the Magento_Checkout/template/summary/cart-itmes.html (part of it:)

</td>\n</tr>\n","Magento_Checkout/template/summary/cart-items.html":"<!--\n/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n-->\n<div class=\"block items-in-cart\">\n <div class=\"title\" data-role=\"title\">\n <strong role=\"heading\" aria-level=\"1\">\n <translate args=\"'Your cart'\"/>\n </strong>\n </div>\n <div class=\"content minicart-items\" data-role=\"content\">\n <div class=\"minicart-items-wrapper overflowed\">\n <ol class=\"minicart-items\">\n <each args=\"items()\">\n <li class=\"product-item\">\n <div class=\"product\">\n <each args=\"$parent.elems()\" render=\"\"/>\n </div>\n </li>\n </eac

the original translation regex does not catch

<translate args="'Item in Cart'" if="getCartLineItemsCount() === 1"/>
(there has been probably a change from <translate args="'Your cart'"/>to a item count specific version, but the pattern would not be applied either as it gets escaped to <translate args=\"'Your cart'\"/> respectivelly <translate args=\"'Item in Cart'\" i...

@sidolov sidolov changed the base branch from 2.3-develop to 2.4-develop December 5, 2019 17:12
@engcom-Alfa engcom-Alfa added Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests and removed Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests labels Dec 9, 2019
@engcom-Alfa
Copy link
Contributor

Hi @brosenberger .
Due to Magento Definition of Done all code must be covered by tests. Please cover your fix by automated tests.
Thanks!

@engcom-Echo engcom-Echo self-assigned this Jan 9, 2020
@engcom-Echo engcom-Echo added Auto-Tests: Covered All changes in Pull Request is covered by auto-tests and removed Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests labels Jan 9, 2020
kalinicham and others added 3 commits January 10, 2020 10:44
…fix-translation-retrieval

# Conflicts:
#	app/code/Magento/Translation/Test/Unit/Model/Js/DataProviderTest.php
@engcom-Echo engcom-Echo requested a review from dmytro-ch January 28, 2020 15:07
Copy link
Contributor

@dmytro-ch dmytro-ch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @brosenberger, could you please update your working branch with the latest changes from 2.4-develop and resolve merge conflicts?
Thank you!

… fix-translation-retrieval

� Conflicts:
�	app/code/Magento/Translation/Test/Unit/Model/Js/DataProviderTest.php
@engcom-Echo
Copy link
Contributor

@magento run all tests

@magento-engcom-team
Copy link
Contributor

Hi @dmytro-ch, thank you for the review.
ENGCOM-6319 has been created to process this Pull Request

@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

@m2-assistant
Copy link

m2-assistant bot commented Feb 21, 2020

Hi @brosenberger, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants