Skip to content

Commit

Permalink
Fix issue with slashes in JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
ahtinurme committed Feb 2, 2024
1 parent c1bf7f3 commit 47ea443
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/TranslationsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ public function export($download = false): void

foreach ($phrasesTree as $locale => $groups) {
foreach ($groups as $file => $phrases) {
$langPath = $download ? storage_path("app/translations/$locale/$file") : lang_path("$locale/$file");
if ($file === "$locale.json") {
$langPath = $download ? storage_path("app/translations/$file") : lang_path("$file");
} else {
$langPath = $download ? storage_path("app/translations/$locale/$file") : lang_path("$locale/$file");
}

if (! $this->filesystem->isDirectory(dirname($langPath))) {
$this->filesystem->makeDirectory(dirname($langPath), 0755, true);
Expand All @@ -135,7 +139,7 @@ public function export($download = false): void
}

if ($this->filesystem->extension($langPath) == 'json') {
$this->filesystem->put($langPath, json_encode($phrases, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
$this->filesystem->put($langPath, json_encode($phrases, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
}
}
}
Expand Down

0 comments on commit 47ea443

Please sign in to comment.