class QtFileDumper in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/translation/Dumper/QtFileDumper.php \Symfony\Component\Translation\Dumper\QtFileDumper
QtFileDumper generates ts files from a message catalogue.
@author Benjamin Eberlei <kontakt@beberlei.de>
Hierarchy
- class \Symfony\Component\Translation\Dumper\FileDumper implements DumperInterface
- class \Symfony\Component\Translation\Dumper\QtFileDumper
Expanded class hierarchy of QtFileDumper
1 file declares its use of QtFileDumper
- QtFileDumperTest.php in vendor/
symfony/ translation/ Tests/ Dumper/ QtFileDumperTest.php
File
- vendor/
symfony/ translation/ Dumper/ QtFileDumper.php, line 21
Namespace
Symfony\Component\Translation\DumperView source
class QtFileDumper extends FileDumper {
/**
* {@inheritdoc}
*/
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();
}
/**
* {@inheritdoc}
*/
protected function getExtension() {
return 'ts';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FileDumper:: |
private | property | Make file backup before the dump. | |
FileDumper:: |
protected | property | A template for the relative paths to files. | 1 |
FileDumper:: |
public | function |
Dumps the message catalogue. Overrides DumperInterface:: |
1 |
FileDumper:: |
private | function | Gets the relative file path using the template. | |
FileDumper:: |
public | function | Sets backup flag. | |
FileDumper:: |
public | function | Sets the template for the relative paths to files. | |
QtFileDumper:: |
public | function |
Transforms a domain of a message catalogue to its string representation. Overrides FileDumper:: |
|
QtFileDumper:: |
protected | function |
Gets the file extension of the dumper. Overrides FileDumper:: |