-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
ImportExport module missing some translation #24017
Conversation
Hi @edenduong. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
Hi @rogyar, thank you for the review.
|
Hi @edenduong ! I've checked PR and looks like changes doesn't solve the problem. Actual Result: @edenduong Could you take a look, please? Thanks! |
d8437c4
to
2fbd1ed
Compare
@engcom-Alfa: I am sorry about that. I have changed the source code. Please check it again. Have a nice day! |
@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')); ?>' |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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')); ?>' |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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’.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
Hi @VladimirZaets, thank you for the review. |
Hi @sidolov, thank you for the review. |
✔️ QA Passed |
Hi @edenduong, thank you for your contribution! |
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 (*)
Questions or comments
Contribution checklist (*)