Skip to content

Commit 5f8cfe6

Browse files
committed
MAGETWO-67296: String localization is not working when phrase contains quote (\')
- Remove unnecessary escaping in translation and add escape to post-translated string
1 parent e824400 commit 5f8cfe6

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

app/code/Magento/Customer/Block/Adminhtml/Edit.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
use Magento\Customer\Controller\RegistryConstants;
1111

1212
/**
13-
* Customer edit block
13+
* @deprecated for UiComponent replacement
14+
* @see app/code/Magento/Customer/view/base/ui_component/customer_form.xml
1415
*/
1516
class Edit extends \Magento\Backend\Block\Widget\Form\Container
1617
{
@@ -115,12 +116,13 @@ protected function _construct()
115116

116117
if ($customerId) {
117118
$url = $this->getUrl('customer/customer/invalidateToken', ['customer_id' => $customerId]);
118-
$deleteConfirmMsg = __("Are you sure you want to revoke the customer\'s tokens?");
119+
$deleteConfirmMsg = __("Are you sure you want to revoke the customer's tokens?");
119120
$this->buttonList->add(
120121
'invalidate_token',
121122
[
122123
'label' => __('Force Sign-In'),
123-
'onclick' => 'deleteConfirm(\'' . $deleteConfirmMsg . '\', \'' . $url . '\')',
124+
'onclick' => 'deleteConfirm(\'' . $this->escapeJs($this->escapeHtml($deleteConfirmMsg)) .
125+
'\', \'' . $url . '\')',
124126
'class' => 'invalidate-token'
125127
],
126128
10

app/code/Magento/Customer/Block/Adminhtml/Edit/InvalidateTokenButton.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ public function getButtonData()
2121
$customerId = $this->getCustomerId();
2222
$data = [];
2323
if ($customerId) {
24-
$deleteConfirmMsg = __("Are you sure you want to revoke the customer\'s tokens?");
24+
$deleteConfirmMsg = __("Are you sure you want to revoke the customer's tokens?");
2525
$data = [
2626
'label' => __('Force Sign-In'),
2727
'class' => 'invalidate-token',
28-
'on_click' => 'deleteConfirm(\'' . $deleteConfirmMsg . '\', \'' . $this->getInvalidateTokenUrl() .
29-
'\')',
28+
'on_click' => 'deleteConfirm("' . $deleteConfirmMsg . '", "' . $this->getInvalidateTokenUrl() . '")',
3029
'sort_order' => 65,
3130
];
3231
}

app/code/Magento/User/Block/User/Edit.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ protected function _construct()
6565
]
6666
);
6767

68-
$deleteConfirmMsg = __("Are you sure you want to revoke the user\'s tokens?");
68+
$deleteConfirmMsg = __("Are you sure you want to revoke the user's tokens?");
6969
$this->addButton(
7070
'invalidate',
7171
[
7272
'label' => __('Force Sign-In'),
7373
'class' => 'invalidate-token',
74-
'onclick' => "deleteConfirm('" . $deleteConfirmMsg . "', '" . $this->getInvalidateUrl() . "')",
74+
'onclick' => "deleteConfirm('" . $this->escapeJs($this->escapeHtml($deleteConfirmMsg)) .
75+
"', '" . $this->getInvalidateUrl() . "')",
7576
]
7677
);
7778
}

0 commit comments

Comments
 (0)