public function CsvFileDumper::format in Plug 7
Transforms a domain of a message catalogue to its string representation.
Parameters
MessageCatalogue $messages:
string $domain:
Return value
string representation
Overrides FileDumper::format
File
- lib/
Symfony/ translation/ Dumper/ CsvFileDumper.php, line 29
Class
- CsvFileDumper
- CsvFileDumper generates a csv formatted string representation of a message catalogue.
Namespace
Symfony\Component\Translation\DumperCode
public function format(MessageCatalogue $messages, $domain = 'messages') {
$handle = fopen('php://memory', 'rb+');
foreach ($messages
->all($domain) as $source => $target) {
fputcsv($handle, array(
$source,
$target,
), $this->delimiter, $this->enclosure);
}
rewind($handle);
$output = stream_get_contents($handle);
fclose($handle);
return $output;
}