bug #31599 [Translation] Fixed issue with new vs old TranslatorInterface 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
-------

a1677c78a6 [Translation] Fixed issue with new vs old TranslatorInterface in TranslationDataCollector
This commit is contained in:
Nicolas Grekas 2019-05-23 17:21:24 +02:00
commit 451b4406d2
1 changed files with 2 additions and 2 deletions

View File

@ -68,10 +68,10 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn
{
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;