diff --git a/components/translation/usage.rst b/components/translation/usage.rst index fbb6664c607..63daff8d7a8 100644 --- a/components/translation/usage.rst +++ b/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', + ), + ); +