QtFileDumper.php in Plug 7
File
lib/Symfony/translation/Dumper/QtFileDumper.php
View source
<?php
namespace Symfony\Component\Translation\Dumper;
use Symfony\Component\Translation\MessageCatalogue;
class QtFileDumper extends FileDumper {
public function format(MessageCatalogue $messages, $domain) {
$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'));
$message
->appendChild($dom
->createElement('source', $source));
$message
->appendChild($dom
->createElement('translation', $target));
}
return $dom
->saveXML();
}
protected function getExtension() {
return 'ts';
}
}
Classes
Name |
Description |
QtFileDumper |
QtFileDumper generates ts files from a message catalogue. |