CsvFileDumper.php
2 months ago
DumperInterface.php
2 months ago
FileDumper.php
2 months ago
IcuResFileDumper.php
2 months ago
IniFileDumper.php
2 months ago
JsonFileDumper.php
2 months ago
MoFileDumper.php
2 months ago
PhpFileDumper.php
2 months ago
PoFileDumper.php
2 months ago
QtFileDumper.php
2 months ago
XliffFileDumper.php
2 months ago
YamlFileDumper.php
2 months ago
JsonFileDumper.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <fabien@symfony.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | namespace ProfilePressVendor\Symfony\Component\Translation\Dumper; |
| 12 | |
| 13 | use ProfilePressVendor\Symfony\Component\Translation\MessageCatalogue; |
| 14 | /** |
| 15 | * JsonFileDumper generates an json formatted string representation of a message catalogue. |
| 16 | * |
| 17 | * @author singles |
| 18 | */ |
| 19 | class JsonFileDumper extends FileDumper |
| 20 | { |
| 21 | /** |
| 22 | * {@inheritdoc} |
| 23 | */ |
| 24 | public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []) |
| 25 | { |
| 26 | $flags = $options['json_encoding'] ?? \JSON_PRETTY_PRINT; |
| 27 | return json_encode($messages->all($domain), $flags); |
| 28 | } |
| 29 | /** |
| 30 | * {@inheritdoc} |
| 31 | */ |
| 32 | protected function getExtension() |
| 33 | { |
| 34 | return 'json'; |
| 35 | } |
| 36 | } |
| 37 |