namespace Symfony\Component\Translation;
+use Symfony\Component\Translation\Exception\InvalidArgumentException;
+
/**
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
*/
public function __construct(TranslatorInterface $translator)
{
if (!$translator instanceof TranslatorBagInterface) {
- throw new \InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', get_class($translator)));
+ throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', get_class($translator)));
}
$this->translator = $translator;
*/
public function getFallbackLocales()
{
- if ($this->translator instanceof Translator) {
+ if ($this->translator instanceof Translator || method_exists($this->translator, 'getFallbackLocales')) {
return $this->translator->getFallbackLocales();
}