diff --git a/php-templates/translations.php b/php-templates/translations.php index 36de192a..05cee9ff 100644 --- a/php-templates/translations.php +++ b/php-templates/translations.php @@ -129,7 +129,7 @@ protected function linesFromJsonFile($file) $lines = explode(PHP_EOL, $contents); $encoded = array_map( - fn($k) => [json_encode($k), $k], + fn($k) => [json_encode($k, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), $k], array_keys($json), ); $result = []; @@ -364,4 +364,4 @@ protected function fromPhpFile($file, $path, $namespace) 'values' => array_keys($translator->values), 'params' => array_map(fn($p) => json_decode($p, true), array_keys($translator->paramResults)), 'to_watch' => $translator->directoriesToWatch, -]); +], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); diff --git a/src/templates/translations.ts b/src/templates/translations.ts index 66d8d755..8b3d823d 100644 --- a/src/templates/translations.ts +++ b/src/templates/translations.ts @@ -129,7 +129,7 @@ $translator = new class $lines = explode(PHP_EOL, $contents); $encoded = array_map( - fn($k) => [json_encode($k), $k], + fn($k) => [json_encode($k, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), $k], array_keys($json), ); $result = []; @@ -364,5 +364,5 @@ echo json_encode([ 'values' => array_keys($translator->values), 'params' => array_map(fn($p) => json_decode($p, true), array_keys($translator->paramResults)), 'to_watch' => $translator->directoriesToWatch, -]); +], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); `; \ No newline at end of file