-
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
FIX for issue #14849 - In Sales Emails no translation using order.getStatusLabel() #14914
FIX for issue #14849 - In Sales Emails no translation using order.getStatusLabel() #14914
Conversation
…der.getStatusLabel() \Magento\Sales\Model\Order\Config::getStatusLabel(), used by template email was forcing the usage of getLabel() when in adminhtml area. I added a new method getFrontendStatusLabel() in \Magento\Sales\Model\Order and modified email template files to use it instead of the original implementation. I did not modify the original implementation because still in use by backend and frontend.
* Retrieve frontend label of order status | ||
* | ||
* @return string | ||
* @throws \Magento\Framework\Exception\LocalizedException |
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, import the class to the 'use' section instead of specifying the full class path inline
*/ | ||
public function getFrontendStatusLabel() | ||
{ | ||
return $this->getConfig()->getStatusLabel($this->getStatus(), \Magento\Framework\App\Area::AREA_FRONTEND); |
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, import the class to the 'use' section instead of specifying the full class path inline
/** | ||
* Retrieve label of order status | ||
* | ||
* @return string | ||
* @throws \Magento\Framework\Exception\LocalizedException |
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, import the class to the 'use' section instead of specifying the full class path inline
* @return string | ||
* @throws \Magento\Framework\Exception\LocalizedException |
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, import the class to the 'use' section instead of specifying the full class path inline
@@ -118,11 +118,13 @@ public function getStateDefaultStatus($state) | |||
* Retrieve status label | |||
* | |||
* @param string $code | |||
* @param null $forceArea |
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.
I believe we have string|null
here. Please, fix the DocBlock
Hello @phoenix128. Thank you for the collaboration. Please, consider fixing minor issues mentioned in the review. |
@rogyar , just fixed. |
*/ | ||
public function getStatusLabel($code) | ||
public function getStatusLabel($code, $forceArea = null) |
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.
@phoenix128 , adding new parameters to public method is not allowed because this is breaking changes. Please, refer to Backward compatible development guide section Adding parameters in public methods for more information
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 , does the rule applies for optional parameters?
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.
@phoenix128 , yes, this changes may affect 3d party code with the same changes but with different logic
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.
Small refactoring is needed
Hi @phoenix128. Are you going to proceed with this PR? |
@rogyar , |
Hi @phoenix128 , will you continue work on this PR or we can close it for now? |
@sidolov , now should be fine. |
Hi @sidolov, thank you for the review. |
…ing order.getStatusLabel() #14914
Hi @phoenix128. Thank you for your contribution. Please, consider to port this solution to 2.3 release line. |
Description
\Magento\Sales\Model\Order\Config::getStatusLabel(), used by template email was forcing the usage of getLabel() when in adminhtml area.
I added a new method getFrontendStatusLabel() in \Magento\Sales\Model\Order and modified email template files to use it instead of the original implementation.
I did not modify the original implementation because still in use by backend and frontend.
Fixed Issues (if relevant)
Contribution checklist