Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Translation] Ability to format a message catalogue without actually writing it.#5745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
xabbuh merged 1 commit intosymfony:2.8fromaitboudad:translation_dumper
Oct 5, 2015
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletionscomponents/translation/custom_formats.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -85,7 +85,7 @@ will save a few lines::

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

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

The :method:`Symfony\\Component\\Translation\\Dumper\\FileDumper::format`
.. sidebar:: Format a message catalogue

.. versionadded:: 2.8
The ability to format a message catalogue without dumping it was introduced in Symfony 2.8.

In some cases, you want to send the dump contents as a response instead of writing them in files.
To do this, you can use the ``formatCatalogue`` method. In this case, you must pass the domain argument,
which determines the list of messages that should be dumped.

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 +125,3 @@ YAML file are dumped into a text file with the custom format::

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


[8]ページ先頭

©2009-2025 Movatter.jp