From a0cd71c4bd9553e5d02a1411f8d5bcae6914b474 Mon Sep 17 00:00:00 2001 From: Henry Snoek Date: Tue, 19 Jan 2016 22:23:09 +0100 Subject: [PATCH 1/2] use `getCatalogue()` instead of deprecated `getMessages()` --- components/translation/usage.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/translation/usage.rst b/components/translation/usage.rst index 3cf13b9fb7d..00c7f43fc56 100644 --- a/components/translation/usage.rst +++ b/components/translation/usage.rst @@ -376,7 +376,8 @@ In case you want to use the same translation catalogue outside your application (e.g. use translation on the client side), it's possible to fetch raw translation messages. Just specify the required locale:: - $messages = $translator->getMessages('fr_FR'); + $catalogue = $translator->getCatalogue('fr_FR'); + $messages = $catalogue->all(); The ``$messages`` variable will have the following structure:: From 1ab1a26b8fda9142a8e36b274a474d500cd90ae7 Mon Sep 17 00:00:00 2001 From: Henry Snoek Date: Wed, 20 Jan 2016 19:45:47 +0100 Subject: [PATCH 2/2] handle fallback catalogue --- components/translation/usage.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/translation/usage.rst b/components/translation/usage.rst index 00c7f43fc56..4ad16abb4cd 100644 --- a/components/translation/usage.rst +++ b/components/translation/usage.rst @@ -378,6 +378,9 @@ messages. Just specify the required locale:: $catalogue = $translator->getCatalogue('fr_FR'); $messages = $catalogue->all(); + while ($catalogue = $catalogue->getFallbackCatalogue()) { + $messages = array_replace_recursive($catalogue->all(), $messages); + } The ``$messages`` variable will have the following structure::