Skip to content

Commit

Permalink
Merge pull request #71 from hardchor/patch-1
Browse files Browse the repository at this point in the history
Removes duplicates from dumped translation messages
  • Loading branch information
willdurand committed Oct 25, 2013
2 parents b435bae + 88a0ae2 commit ccf354f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions Controller/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,7 @@ public function exposeTranslationAction(Request $request, $domain_name, $_locale

$messages = array();
foreach ($catalogues as $catalogue) {
$messages = array_merge_recursive($messages, $catalogue->all());
}

foreach ($messages as &$domain) {
$domain = array_map(function($m){ return is_array($m) ? end($m) : $m; }, $domain);
$messages = array_replace_recursive($messages, $catalogue->all());
}

$content = $this->engine->render('BazingaExposeTranslationBundle::exposeTranslation.' . $_format . '.twig', array(
Expand Down
2 changes: 1 addition & 1 deletion Dumper/TranslationDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private function getTranslationMessages()
$catalogue = $this->loaders[$extension]->load($file, $locale, $domain);

if (isset($messages[$locale])) {
$messages[$locale] = array_merge_recursive($messages[$locale], $catalogue->all());
$messages[$locale] = array_replace_recursive($messages[$locale], $catalogue->all());
} else {
$messages[$locale] = $catalogue->all();
}
Expand Down

0 comments on commit ccf354f

Please sign in to comment.