8000 change translation getMessages() to getCatalogue() · symfony/symfony-docs@06ca405 · GitHub
[go: up one dir, main page]

Skip to content

Commit 06ca405

Browse files
Henry Snoekxabbuh
Henry Snoek
authored andcommitted
change translation getMessages() to getCatalogue()
1 parent 8e91949 commit 06ca405<
8000
/span>

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

components/translation/usage.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,11 @@ In case you want to use the same translation catalogue outside your application
376376
(e.g. use translation on the client side), it's possible to fetch raw translation
3 7FBC 77377
messages. Just specify the required locale::
378378

379-
$messages = $translator->getMessages('fr_FR');
379+
$catalogue = $translator->getCatalogue('fr_FR');
380+
$messages = $catalogue->all();
381+
while ($catalogue = $catalogue->getFallbackCatalogue()) {
382+
$messages = array_replace_recursive($catalogue->all(), $messages);
383+
}
380384

381385
The ``$messages`` variable will have the following structure::
382386

0 commit comments

Comments
 (0)
0