Skip to content

Commit

Permalink
bug #31599 [Translation] Fixed issue with new vs old TranslatorInterf…
Browse files Browse the repository at this point in the history
…ace in TranslationDataCollector (althaus)

This PR was submitted for the master branch but it was squashed and merged into the 4.2 branch instead (closes #31599).

Discussion
----------

[Translation] Fixed issue with new vs old TranslatorInterface in TranslationDataCollector

I'm not sure when this gets executed, but overriding `$trans` directly after the `if` simply looks wrong.

| Q             | A
| ------------- | ---
| Branch?       | 4.3-beta2, but last change at that position is a couple of months
| Bug fix?      | yes, me thinks
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT

Cheers
Matthias

Commits
-------

a1677c7 [Translation] Fixed issue with new vs old TranslatorInterface in TranslationDataCollector
  • Loading branch information
nicolas-grekas committed May 23, 2019
2 parents 19741a4 + a1677c7 commit 451b440
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/Translation/DataCollectorTranslator.php
Expand Up @@ -68,10 +68,10 @@ public function transChoice($id, $number, array $parameters = [], $domain = null
{
if ($this->translator instanceof TranslatorInterface) {
$trans = $this->translator->trans($id, ['%count%' => $number] + $parameters, $domain, $locale);
} else {
$trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale);
}

$trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale);

$this->collectMessage($locale, $domain, $id, $trans, ['%count%' => $number] + $parameters);

return $trans;
Expand Down

0 comments on commit 451b440

Please sign in to comment.