diff --git a/lib/internal/Magento/Framework/Phrase/Renderer/Translate.php b/lib/internal/Magento/Framework/Phrase/Renderer/Translate.php index 9cc79b5fab2adcf7243a338306ab2fa027ba39b2..910b1a7587b5165ee4c6198ce4f3faef1f831562 100644 --- a/lib/internal/Magento/Framework/Phrase/Renderer/Translate.php +++ b/lib/internal/Magento/Framework/Phrase/Renderer/Translate.php @@ -49,7 +49,8 @@ class Translate implements RendererInterface public function render(array $source, array $arguments) { $text = end($source); - $text = preg_replace('/([^\\\\])(\\\\")/', '$1"', $text); + /* If phrase contains escaped double quote then use translation for phrase with non-escaped quote */ + $text = str_replace('\"', '"', $text); try { $data = $this->translator->getData(); diff --git a/setup/src/Magento/Setup/Module/I18n/Dictionary/Phrase.php b/setup/src/Magento/Setup/Module/I18n/Dictionary/Phrase.php index 4e6c4359183dfadc82bc4d991a98f9cec97f1175..56cbd751fc623dba60cf867583ddf58ea553d1a1 100644 --- a/setup/src/Magento/Setup/Module/I18n/Dictionary/Phrase.php +++ b/setup/src/Magento/Setup/Module/I18n/Dictionary/Phrase.php @@ -267,12 +267,14 @@ class Phrase private function getCompiledString($string) { $encloseQuote = $this->getQuote() == Phrase::QUOTE_DOUBLE ? Phrase::QUOTE_DOUBLE : Phrase::QUOTE_SINGLE; - //find all occurrences of ' and ", with no \ before it. + /* Find all occurrences of ' and ", with no \ before it for concatenation */ preg_match_all('/[^\\\\]' . $encloseQuote . '|' . $encloseQuote . '[^\\\\]/', $string, $matches); if (count($matches[0])) { $string = preg_replace('/([^\\\\])' . $encloseQuote . ' ?\. ?' . $encloseQuote . '/', '$1', $string); } - $string = preg_replace('/([^\\\\])(\\\\")/', '$1"', $string); + /* Remove all occurrences of escaped double quote because it is not desirable in csv file. + Translation for such phrases will use translation for phrase without escaped quote. */ + $string = str_replace('\"', '"', $string); return $string; } }