diff --git a/src/Generator.php b/src/Generator.php index 9923473..369f586 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -76,7 +76,7 @@ public function generateFromPath($path, $umd = null, $withVendor = false) $locales = $this->adjustVendor($locales); - $jsonLocales = json_encode($locales, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . PHP_EOL; + $jsonLocales = json_encode($locales, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL; if(json_last_error() !== JSON_ERROR_NONE) { @@ -136,7 +136,7 @@ public function generateMultiple($path, $umd = null) foreach ($this->filesToCreate as $fileName => $data) { $fileToCreate = $jsPath . $fileName . '.js'; $createdFiles .= $fileToCreate . PHP_EOL; - $jsonLocales = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . PHP_EOL; + $jsonLocales = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL; if(json_last_error() !== JSON_ERROR_NONE) { throw new Exception('Could not generate JSON, error code '.json_last_error()); diff --git a/tests/GenerateTest.php b/tests/GenerateTest.php index c6f50c9..c4c5159 100644 --- a/tests/GenerateTest.php +++ b/tests/GenerateTest.php @@ -253,6 +253,7 @@ function testShouldNotTouchHtmlTags() 'help' => [ 'yes' => 'see ', 'no' => 'see ', + 'maybe' => 'It is a Test ok!', ] ] ]; @@ -264,7 +265,8 @@ function testShouldNotTouchHtmlTags() . ' "en": {' . PHP_EOL . ' "help": {' . PHP_EOL . ' "yes": "see ",' . PHP_EOL - . ' "no": "see "' . PHP_EOL + . ' "no": "see ",' . PHP_EOL + . ' "maybe": "It is a Test ok!"' . PHP_EOL . ' }' . PHP_EOL . ' }' . PHP_EOL . '}' . PHP_EOL,