bug #38285 [Contracts][Translation] Optional Intl dependency (ro0NL)

This PR was merged into the 4.4 branch.

Discussion
----------

[Contracts][Translation] Optional Intl dependency

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->
same as #38283, and should help streamlining #38230

Commits
-------

d65d39da14 [Contracts][Translation] Optional Intl dependency
This commit is contained in:
Fabien Potencier 2020-09-24 11:41:33 +02:00
commit 8611b0b32f

View File

@ -35,7 +35,7 @@ trait TranslatorTrait
*/
public function getLocale()
{
return $this->locale ?: \Locale::getDefault();
return $this->locale ?: (class_exists(\Locale::class) ? \Locale::getDefault() : 'en');
}
/**