Skip to content

Commit c79b583

Browse files
author
Anton Evers
committed
Concatenate JS translations before translating them
This enables support for $.mage.__("concatenating" + "strings");
1 parent a150d24 commit c79b583

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/code/Magento/Translation/Model/Js/DataProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ protected function getPhrases($content)
134134
{
135135
$phrases = [];
136136
foreach ($this->config->getPatterns() as $pattern) {
137-
$result = preg_match_all($pattern, $content, $matches);
137+
$concatenatedContent = preg_replace('~(["\'])\s*?\+\s*?\1~', '', $content);
138+
$result = preg_match_all($pattern, $concatenatedContent, $matches);
138139

139140
if ($result) {
140141
if (isset($matches[2])) {

0 commit comments

Comments
 (0)