Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Commit

Permalink
bug #228 Ignore the IdentityTranslator so that the texts are translat…
Browse files Browse the repository at this point in the history
…ed properly (sroze)

This PR was merged into the 1.5-dev branch.

Discussion
----------

Ignore the IdentityTranslator so that the texts are translated properly

Since we've introduced the identity translator in Symfony, the `time_diff` does not work anymore. This ignores it and consider the translator as not useful (so it actually displays the diffs properly 💃)

Commits
-------

a494c63 Ignore the IdentityTranslator so that the texts are translated properly
  • Loading branch information
fabpot committed Nov 16, 2018
2 parents 2c1a865 + a494c63 commit e187386
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Twig/Extensions/Extension/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* file that was distributed with this source code.
*/
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Translation\IdentityTranslator;

/**
* @author Robin van der Vleuten <robinvdvleuten@gmail.com>
Expand All @@ -31,6 +32,11 @@ class Twig_Extensions_Extension_Date extends Twig_Extension

public function __construct(TranslatorInterface $translator = null)
{
// Ignore the IdentityTranslator, otherwise the parameters won't be replaced properly
if ($translator instanceof IdentityTranslator) {
$translator = null;
}

$this->translator = $translator;
}

Expand Down

0 comments on commit e187386

Please sign in to comment.