-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Issue 28656 inline translation rest api #28856
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
Issue 28656 inline translation rest api #28856
Conversation
…ranslated phrases for areas other than frontend and adminhtml.
…rios, and add scenarios for all other areas where other enabled checks are true
Hi @zaximus84. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. |
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.
Hi @zaximus84!
Please check my suggestions.
Also, please check failed tests.
* | ||
* @return bool | ||
*/ | ||
private function isAreaAllowed() |
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.
private function isAreaAllowed() | |
private function isAreaAllowed(): bool |
@@ -89,6 +103,7 @@ public function __construct( | |||
\Magento\Framework\Translate\Inline\ConfigInterface $config, | |||
\Magento\Framework\Translate\Inline\ParserInterface $parser, | |||
\Magento\Framework\Translate\Inline\StateInterface $state, | |||
\Magento\Framework\App\State $appState, |
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.
\Magento\Framework\App\State $appState, | |
\Magento\Framework\App\State $appState = null, |
@@ -99,6 +114,7 @@ public function __construct( | |||
$this->config = $config; | |||
$this->parser = $parser; | |||
$this->state = $state; | |||
$this->appState = $appState; |
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.
$this->appState = $appState; | |
$this->appState = $appState ?: \Magento\Framework\App\ObjectManager::getInstance() | |
->(\Magento\Framework\App\State::class); |
@magento run all tests |
@magento run all tests |
Hi @zaximus84, can You please fix failed tests and look through requested changes? |
@magento run all tests |
@magento run all tests |
Hi @swnsma, thank you for the review. |
✔️ QA Passed Manual testing scenario:
Actual Result: ✔️ Inline translate for Storefront is enabled
Before: ✖️ Result from rest API: After: ✔️ Inline translation only affects frontend side and the response does not contain inline translation markup
|
Hi @zaximus84, thank you for your contribution! |
Description (*)
When inline translation is enabled for the storefront, it should be limited to the frontend where HTML is rendered. However, making an API call to /rest/V1/integration/admin/token with bad credentials while inline translation is enabled results in inline translation markup around the error message in the API response.
Since inline translation markup is only useful in the adminhtml and frontend areas, this PR adds an area check in addition to the existing configuration checks before rendering inline translation markup.
Fixed Issues (if relevant)
Manual testing scenarios (*)
POST - {Baseurl}/rest/V1/integration/admin/token
Body - {"username": "","password": ""}
Contribution checklist (*)