From f701f73838223885f48dc6674fb07b96e2f2dadc Mon Sep 17 00:00:00 2001 From: Hryhorii Hrebiniuk Date: Thu, 26 Dec 2013 12:28:36 +0200 Subject: [PATCH] [Translation] added method to expose collected message --- components/translation/usage.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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', + ), + ); +