diff --git a/app/code/Magento/Translation/Model/Js/DataProvider.php b/app/code/Magento/Translation/Model/Js/DataProvider.php index 040b3fd211b99..67d594b65b0f5 100644 --- a/app/code/Magento/Translation/Model/Js/DataProvider.php +++ b/app/code/Magento/Translation/Model/Js/DataProvider.php @@ -134,12 +134,13 @@ protected function getPhrases($content) { $phrases = []; foreach ($this->config->getPatterns() as $pattern) { - $result = preg_match_all($pattern, $content, $matches); + $concatenatedContent = preg_replace('~(["\'])\s*?\+\s*?\1~', '', $content); + $result = preg_match_all($pattern, $concatenatedContent, $matches); if ($result) { if (isset($matches[2])) { foreach ($matches[2] as $match) { - $phrases[] = str_replace('\\\'', '\'', $match); + $phrases[] = str_replace(["\'", '\"'], ["'", '"'], $match); } } } diff --git a/app/code/Magento/Translation/etc/di.xml b/app/code/Magento/Translation/etc/di.xml index 13a170a37ecf2..c10619fbf74ae 100644 --- a/app/code/Magento/Translation/etc/di.xml +++ b/app/code/Magento/Translation/etc/di.xml @@ -65,8 +65,8 @@ - ~\$\.mage\.__\((?s)[^'"]*?(['"])(.+?)\1(?s).*?\)~ - ~\$t\((?s)[^'"]*?(["'])(.+?)\1(?s).*?\)~ + +