Permalink
Browse files

feature #3386 [Translation] added method to expose collected message …

…(Grygir)

This PR was merged into the master branch.

Discussion
----------

[Translation] added method to expose collected message

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | yes (symfony/symfony#9859)
| Applies to    | all (or 2.4+)
| Fixed tickets |

Commits
-------

f701f73 [Translation] added method to expose collected message
  • Loading branch information...
weaverryan committed Nov 4, 2014
2 parents 9ed31c8 + f701f73 commit 4b98d48ba630851004df159256fb3fbbb0be79d4
Showing with 22 additions and 0 deletions.
  1. +22 −0 components/translation/usage.rst
@@ -371,3 +371,25 @@ use for translation::
.. _`L10n`: http://en.wikipedia.org/wiki/Internationalization_and_localization
.. _`ISO 31-11`: http://en.wikipedia.org/wiki/Interval_(mathematics)#Notations_for_intervals
Retrieving the Message Catalogue
--------------------------------
In case you want to use the same translation catalogue outside your application
(e.g. use translation on a client side), it's possible to fetch raw translation messages.
You just need to specify required locale::
$messages = $translator->getMessages('fr_FR');
``$messages`` will have the following structure::
array(
'messages' => array(
'Hello world' => 'Bonjour tout le monde',
),
'validators' => array(
'Value should not be empty' => 'Valeur ne doit pas être vide',
'Value is too long' => 'Valeur est trop long',
),
);

0 comments on commit 4b98d48

Please sign in to comment.