Skip to content
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

+: The possibility to use html in the translations #5806

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion app/code/Magento/Translation/Model/ResourceModel/StringUtils.php
Expand Up @@ -211,7 +211,7 @@ public function saveTranslate($string, $translate, $locale = null, $storeId = nu
$string = htmlspecialchars_decode($string);
$connection = $this->getConnection();
$table = $this->getMainTable();
$translate = htmlspecialchars($translate, ENT_QUOTES);
$translate = $this->htmlSpecialCharsTranslation($translate);

if ($locale === null) {
$locale = $this->_localeResolver->getLocale();
Expand Down Expand Up @@ -266,6 +266,17 @@ public function saveTranslate($string, $translate, $locale = null, $storeId = nu
return $this;
}

/**
* Converting special characters in translation to HTML entities
*
* @param $translate
* @return string
*/
public function htmlSpecialCharsTranslation($translate)
{
return htmlspecialchars($translate, ENT_QUOTES);
}

/**
* Retrieve current store identifier
*
Expand Down