Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f701f73

Browse files
committed
[Translation] added method to expose collected message
1 parent 47fe03a commit f701f73

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

components/translation/usage.rst

+22
Original file line numberDiff line numberDiff line change
@@ -371,3 +371,25 @@ use for translation::
371371

372372
.. _`L10n`: http://en.wikipedia.org/wiki/Internationalization_and_localization
373373
.. _`ISO 31-11`: http://en.wikipedia.org/wiki/Interval_(mathematics)#Notations_for_intervals
374+
375+
Retrieving the Message Catalogue
376+
--------------------------------
377+
378+
In case you want to use the same translation catalogue outside your application
379+
(e.g. use translation on a client side), it's possible to fetch raw translation messages.
380+
You just need to specify required locale::
381+
382+
$messages = $translator->getMessages('fr_FR');
383+
384+
``$messages`` will have the following structure::
385+
386+
array(
387+
'messages' => array(
388+
'Hello world' => 'Bonjour tout le monde',
389+
),
390+
'validators' => array(
391+
'Value should not be empty' => 'Valeur ne doit pas être vide',
392+
'Value is too long' => 'Valeur est trop long',
393+
),
394+
);
395+

0 commit comments

Comments
 (0)