[Translator] Optional Intl dependency

This commit is contained in:
Roland Franssen 2020-09-23 20:32:26 +02:00 committed by Fabien Potencier
parent 50f37f0ccc
commit a2eb263457

View File

@ -163,7 +163,7 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran
}
$this->assertValidLocale($locale);
$this->locale = $locale;
$this->locale = $locale ?? (class_exists(\Locale::class) ? \Locale::getDefault() : 'en');
}
/**
@ -171,7 +171,7 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran
*/
public function getLocale()
{
return $this->locale ?? \Locale::getDefault();
return $this->locale;
}
/**