Skip to content

Commit

Permalink
[Translation] Ability to format a message catalogue without dumping it.
Browse files Browse the repository at this point in the history
  • Loading branch information
aitboudad committed Oct 1, 2015
1 parent 25fe737 commit 98eea63
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions components/translation/custom_formats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ will save a few lines::

class MyFormatDumper extends FileDumper
{
protected function format(MessageCatalogue $messages, $domain = 'messages')
public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array())
{
$output = '';

Expand All @@ -102,7 +102,14 @@ will save a few lines::
}
}

The :method:`Symfony\\Component\\Translation\\Dumper\\FileDumper::format`
.. versionadded:: 2.8
The ability to format a message catalogue without dumping it was introduced in Symfony 2.8.

.. tip::

To format a message catalogue without dumping it into files use the ``formatCatalogue`` method.

The :method:`Symfony\\Component\\Translation\\Dumper\\FileDumper::formatCatalogue`
method creates the output string, that will be used by the
:method:`Symfony\\Component\\Translation\\Dumper\\FileDumper::dump` method
of the FileDumper class to create the file. The dumper can be used like any other
Expand All @@ -116,4 +123,3 @@ YAML file are dumped into a text file with the custom format::

$dumper = new MyFormatDumper();
$dumper->dump($catalogue, array('path' => __DIR__.'/dumps'));

0 comments on commit 98eea63

Please sign in to comment.