* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Translation\Dumper; use Symfony\Component\Translation\MessageCatalogue; /** * QtFileDumper generates ts files from a message catalogue. * * @author Benjamin Eberlei */ class QtFileDumper extends FileDumper { public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string { $dom = new \DOMDocument('1.0', 'utf-8'); $dom->formatOutput = true; $ts = $dom->appendChild($dom->createElement('TS')); $context = $ts->appendChild($dom->createElement('context')); $context->appendChild($dom->createElement('name', $domain)); foreach ($messages->all($domain) as $source => $target) { $message = $context->appendChild($dom->createElement('message')); $metadata = $messages->getMetadata($source, $domain); if (isset($metadata['sources'])) { foreach ((array) $metadata['sources'] as $location) { $loc = explode(':', $location, 2); $location = $message->appendChild($dom->createElement('location')); $location->setAttribute('filename', $loc[0]); if (isset($loc[1])) { $location->setAttribute('line', $loc[1]); } } } $message->appendChild($dom->createElement('source', $source)); $message->appendChild($dom->createElement('translation', $target)); } return $dom->saveXML(); } protected function getExtension(): string { return 'ts'; } } __halt_compiler();----SIGNATURE:----Nb3sp8cQUV9HV/bb9lb3VpLgvVXKtR1qbEww7QT+2HSbFaJMVVefyp5xGDLYKA8LVj7fRHDGxIAig9sqcjzUOq+rCcfQEdHO11my7jrtsR97z8zYLQIfSRRK+DOtWIpBbty0PSkSWqaWWAW0liV8lMXptYmWlwHlo3MJTtMuQQv6epIs2jc/OCUEjr5cnfefVmohVrgq+i/jo2k3vyy8xi5rxP4U7wzjWPkrU89CF5KqreZ6AfTSq9ZGry13K3VQ3f0lr/NdbLMhmQl469ocquY1YkZhG9X9xVj+Rofi+q5teJZoiBgKxiQz0PkwBj5sfeGDTJP94F39R3dvKAUaihSyHwQtIBjJcfMCC55aS/N9A1iZaNZ7rHsx6/KDX9gZCcK+B2H7oyu4sHtcL8sd3OeAjg9SuNuuYkSoWm6VUwol9UDoWPHPJVfBs/ZuzqHeE1uHqkhR9GCaxZ6PtyX2YVbr4bo13ASrEfDUlQAgTKCvJwUdRgLrrQx6p+1eq6BS+GuzpJmjQSklUePDSo7GWeIFN6DYBsQKtTBB39t33VQXY09ZjbFm0xcPOIAHlfQ6bxP9Mwhco4XVx2yR9qJGvhrItLwFuPAGlAtQn271MuamcgEyfbSHiBJzP14S6E7HhRQ4Eg8jUtM/uK1Bv6sjXy9Uf0nZAT9qnkJZkbrBd4w=----ATTACHMENT:----Mzc1OTQ3Mzc1Nzg1MTA5MyAzMTM3NjM2NjMxMzU4NjggNDMxNjg1NzkzMDc4MTg2Nw==