Skip to content

Commit

Permalink
minor #14549 [Translation] simplify getMessages. (aitboudad)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.6 branch.

Discussion
----------

[Translation] simplify getMessages.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Fixed tickets  | ~
| Tests pass?   | yes
| License       | MIT

Commits
-------

db077c1 [Translation] simplify getMessages.
  • Loading branch information
aitboudad committed May 5, 2015
2 parents e019ff5 + 055a6ab commit 398e0ee
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions Translator.php
Expand Up @@ -273,15 +273,10 @@ protected function getLoaders()
*/
public function getMessages($locale = null)
{
$catalogues = array();
$catalogues[] = $catalogue = $this->getCatalogue($locale);
$catalogue = $this->getCatalogue($locale);
$messages = $catalogue->all();
while ($catalogue = $catalogue->getFallbackCatalogue()) {
$catalogues[] = $catalogue;
}
$messages = array();
for ($i = count($catalogues) - 1; $i >= 0; $i--) {
$localeMessages = $catalogues[$i]->all();
$messages = array_replace_recursive($messages, $localeMessages);
$messages = array_replace_recursive($catalogue->all(), $messages);
}

return $messages;
Expand Down

0 comments on commit 398e0ee

Please sign in to comment.