CsvFileDumper.php
1 month ago
DumperInterface.php
2 years ago
FileDumper.php
1 month ago
IcuResFileDumper.php
1 month ago
IniFileDumper.php
1 month ago
JsonFileDumper.php
1 month ago
MoFileDumper.php
1 month ago
PhpFileDumper.php
1 month ago
PoFileDumper.php
1 month ago
QtFileDumper.php
1 month ago
XliffFileDumper.php
1 month ago
YamlFileDumper.php
1 month ago
IniFileDumper.php
42 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 IAWPSCOPED\Symfony\Component\Translation\Dumper; |
| 12 | |
| 13 | use IAWPSCOPED\Symfony\Component\Translation\MessageCatalogue; |
| 14 | /** |
| 15 | * IniFileDumper generates an ini formatted string representation of a message catalogue. |
| 16 | * |
| 17 | * @author Stealth35 |
| 18 | * @internal |
| 19 | */ |
| 20 | class IniFileDumper extends FileDumper |
| 21 | { |
| 22 | /** |
| 23 | * {@inheritdoc} |
| 24 | */ |
| 25 | public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []) : string |
| 26 | { |
| 27 | $output = ''; |
| 28 | foreach ($messages->all($domain) as $source => $target) { |
| 29 | $escapeTarget = \str_replace('"', '\\"', $target); |
| 30 | $output .= $source . '="' . $escapeTarget . "\"\n"; |
| 31 | } |
| 32 | return $output; |
| 33 | } |
| 34 | /** |
| 35 | * {@inheritdoc} |
| 36 | */ |
| 37 | protected function getExtension() : string |
| 38 | { |
| 39 | return 'ini'; |
| 40 | } |
| 41 | } |
| 42 |