Skip to content

Commit

Permalink
MAGETWO-80197: [2.2.x] - Fix JS translation search #10445
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirZaets committed Oct 3, 2017
1 parent 7ca7002 commit 27149cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions app/code/Magento/Translation/Model/Js/DataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Translation/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
<argument name="patterns" xsi:type="array">
<item name="i18n_translation" xsi:type="string"><![CDATA[~i18n\:\s*(["'])(.*?)(?<!\\)\1~]]></item>
<item name="translate_wrapping" xsi:type="string"><![CDATA[~translate\=("')([^\'].*?)\'\"~]]></item>
<item name="mage_translation_widget" xsi:type="string">~\$\.mage\.__\((?s)[^'"]*?(['"])(.+?)\1(?s).*?\)~</item>
<item name="mage_translation_static" xsi:type="string">~\$t\((?s)[^'"]*?(["'])(.+?)\1(?s).*?\)~</item>
<item name="mage_translation_widget" xsi:type="string"><![CDATA[~(?:\$|jQuery)\.mage\.__\((?s)[^'"]*?(['"])(.+?)(?<!\\)\1(?s).*?\)~]]></item>
<item name="mage_translation_static" xsi:type="string"><![CDATA[~\$t\((?s)[^'"]*?(["'])(.+?)\1(?s).*?\)~]]></item>
</argument>
</arguments>
</type>
Expand Down

0 comments on commit 27149cb

Please sign in to comment.