Skip to content

[Translation] added method to expose collected message #3386

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2014
Merged
Changes from all 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
22 changes: 22 additions & 0 deletions components/translation/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 duplicate lines

``$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',
),
);