From a5638b7f43ebe3605e96685d54fb80ced9096a1e Mon Sep 17 00:00:00 2001 From: AleksSem Date: Wed, 26 Jul 2017 17:18:14 +0300 Subject: [PATCH] add fix to skip ' with trailing slash in translation for example {i18n.__('You don\'t have any bookmark.')} --- src/Utils/JsFunctionsScanner.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Utils/JsFunctionsScanner.php b/src/Utils/JsFunctionsScanner.php index 500ae6b1..812a5dbd 100644 --- a/src/Utils/JsFunctionsScanner.php +++ b/src/Utils/JsFunctionsScanner.php @@ -35,6 +35,13 @@ public function getFunctions(array $constants = []) $next = isset($this->code[$pos + 1]) ? $this->code[$pos + 1] : null; switch ($char) { + case '\\': + $prev = $char; + $char = $next; + $pos++; + $next = isset($this->code[$pos]) ? $this->code[$pos] : null; + break; + case "\n": ++$line; @@ -224,12 +231,6 @@ protected function upStatus() protected static function prepareArgument($argument) { if ($argument && ($argument[0] === '"' || $argument[0] === "'")) { - if ($argument[0] === '"') { - $argument = str_replace('\\"', '"', $argument); - } else { - $argument = str_replace("\\'", "'", $argument); - } - return substr($argument, 1, -1); } }