Skip to content

ImportExport module missing some translation #24017

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

Conversation

edenduong
Copy link
Contributor

@edenduong edenduong commented Aug 5, 2019

Description (*)

ImportExport has some "fixed" string. And it can not be translated.

Solution: use :

echo __('Invalid response');

and echo __('Invalid data');

instead of hard fix string.

Fixed Issues (if relevant)

Manual testing scenarios (*)

  1. Check the translate word when the message was triggered. ("Invalid data")

Questions or comments

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 Aug 5, 2019

Hi @edenduong. 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 Assistant documentation

@rogyar rogyar added the Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests label Aug 7, 2019
@engcom-Alfa engcom-Alfa self-assigned this Aug 7, 2019
@magento-engcom-team
Copy link
Contributor

Hi @rogyar, thank you for the review.
ENGCOM-5551 has been created to process this Pull Request
✳️ @rogyar, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@engcom-Alfa
Copy link
Contributor

Hi @edenduong !

I've checked PR and looks like changes doesn't solve the problem.

Actual Result:
The message was not translated

screen

@edenduong Could you take a look, please?

Thanks!

@edenduong edenduong force-pushed the 2.3-bugfix/missing_translate_import_export branch from d8437c4 to 2fbd1ed Compare August 8, 2019 07:26
@edenduong
Copy link
Contributor Author

@engcom-Alfa: I am sorry about that. I have changed the source code. Please check it again.
@rogyar: Please review my new changes.

Have a nice day!

@edenduong
Copy link
Contributor Author

@rogyar: Could you please review my new changes?

@@ -89,7 +89,7 @@ require([
form.action = oldAction;
} else {
alert({
content: 'Invalid data'
content: '<?= $block->escapeHtml(__('Invalid data')); ?>'
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, use mage/translation instead of block method

Copy link
Contributor Author

@edenduong edenduong Aug 14, 2019

Choose a reason for hiding this comment

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

@sidolov : I don't know the reason but the first time of this PR, I use the mage/translate. And it can not translate. Could you please try it?

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -209,7 +209,7 @@ require([
postToFrameProcessResponse: function(response) {
if ('object' != typeof(response)) {
alert({
content: 'Invalid response'
content: '<?= $block->escapeHtml(__('Invalid response')); ?>'
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, use mage/translation instead of block method

Copy link
Contributor Author

@edenduong edenduong Aug 14, 2019

Choose a reason for hiding this comment

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

@sidolov : I don't know the reason but the first time of this PR, I use the mage/translate. And it can not translate. Could you please try it?

image

Copy link
Contributor

Choose a reason for hiding this comment

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

escapeHtml method does not translate strings, it just removes special characters from the string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sidolov : Yes, but __(‘...’) translate the string. And the code now can translate. I use escapeHtml because I make it similar many place in Magento now. It is strange because the code escapeHtml of ‘fixed’ string. I can remove that code if you want.
I mean the mage/translate can not translate in this case (I don’t know but I may be a bug of mage/translate) . So I use translate by ‘block’.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sidolov :I think escapeHtml to Secure the change of csv file can include the “html” code. So it is the reason escapeHtml of __(‘...’) function.

Copy link
Contributor

Choose a reason for hiding this comment

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

@edenduong looks like @engcom-Alfa didn't clear the cache after changes were applied. mage/translate works similar to __() function on the backend. Please, revert back changes to use mage/translate and I'll accept your PR. I'm sorry for the inconvenience.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sidolov : I don't know the reason but mage/translate can not translate. (I have cleared cache). I tested it. Could you please try to edit it?

Copy link
Contributor

Choose a reason for hiding this comment

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

@edenduong you are right looks like mage/translate does not work in phtml file, it's working on js only. Thank you for the clarification!

@ghost ghost assigned sidolov Aug 14, 2019
@magento-engcom-team
Copy link
Contributor

Hi @VladimirZaets, thank you for the review.
ENGCOM-5551 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-5551 has been created to process this Pull Request

@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

@m2-assistant
Copy link

m2-assistant bot commented Aug 27, 2019

Hi @edenduong, 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.

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.4 milestone Aug 27, 2019
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.

7 participants