* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Translation\Writer; use Symfony\Component\Translation\Dumper\DumperInterface; use Symfony\Component\Translation\Exception\InvalidArgumentException; use Symfony\Component\Translation\Exception\RuntimeException; use Symfony\Component\Translation\MessageCatalogue; /** * TranslationWriter writes translation messages. * * @author Michel Salib */ class TranslationWriter implements TranslationWriterInterface { /** * @var array */ private array $dumpers = []; /** * Adds a dumper to the writer. * * @return void */ public function addDumper(string $format, DumperInterface $dumper) { $this->dumpers[$format] = $dumper; } /** * Obtains the list of supported formats. */ public function getFormats(): array { return array_keys($this->dumpers); } /** * Writes translation from the catalogue according to the selected format. * * @param string $format The format to use to dump the messages * @param array $options Options that are passed to the dumper * * @return void * * @throws InvalidArgumentException */ public function write(MessageCatalogue $catalogue, string $format, array $options = []) { if (!isset($this->dumpers[$format])) { throw new InvalidArgumentException(sprintf('There is no dumper associated with format "%s".', $format)); } // get the right dumper $dumper = $this->dumpers[$format]; if (isset($options['path']) && !is_dir($options['path']) && !@mkdir($options['path'], 0777, true) && !is_dir($options['path'])) { throw new RuntimeException(sprintf('Translation Writer was not able to create directory "%s".', $options['path'])); } // save $dumper->dump($catalogue, $options); } } __halt_compiler();----SIGNATURE:----UcXzHAJItP+eQ6FibvlZG/VQiAEcuIy2Jnr2IcSAF9C6d2JU1Mm2qM9vv2C/JEvXyRk87o3LzTH5n/yDr5XZ9kvjjBUCrz/RsRzU6f8074ze0qYMq/iSCFX8hMKojfVt+kKE64FnlJtQOK2pqcnee51ppXtY1DfXPfRZBr8eN0iwSKFd93tFd88GOmihjRUOo7Waf9F2tdeqdA3zo9nWV32JX6l4aMlalIAYxYCfIKfQ5oj1newY7P3YTM7R1SRbz9ZhiYA/00hUyZX6acauHgByA/+qWX5p5B58qfeUaeIY9w4qbny35NOH+vLCRhvi0NDCyowdIanWpK3LBH+ay68FWUuIJ8a+XMPhY/xq+ubLcQWZdJ2ZkfpCJUhC9sCN9GhaKBHZJLk0G0cf9Ug9vUmoFqG1Lg6g7vO/IiFsRfOQgm9Ces9Fs0GjY+GI44bHgxPrCg3c+X2FoxC77wPbNl8CQXt4cVUyOQ2fSrZwqJYGylpH3FRdV+ysamLWs2T62uhVKBV9CPiOurRBJA0upa7paXT28n7Bp9WZUYiI842V0DKbHBvfFY17uGd7xTYGVqSHeLXMRl1jw35iDpd4oiZhRT/S+Omo2aTHjaj93p/otgUV3ABFwkZe33zu5cvyuxp3667EaAwkf/6WeWSSTd8r3fSIzRfyykeL11gJzXk=----ATTACHMENT:----MzYzMDk2MDk0MTYzODc3MCA2MzMzMzAxNjgzNzM0MzEwIDY5MDkxMTE0NTkxNzc3MTQ=