Skip to content

Commit

Permalink
Merge branch '4.4' into 5.1
Browse files Browse the repository at this point in the history
* 4.4:
  [ErrorHandler] Return false directly and remove unused variable
  [OptionsResolver] Assert that the error type is valid in deprecations test
  [HttpClient] Allow bearer token with colon
  [Form] Fix custom formats deprecation with HTML5 widgets
  [Translator] Optional Intl dependency
  [Contracts][Translation] Optional Intl dependency
  [ErrorHandler] Escape JSON encoded log context
  update missing translations arabic
  [Yaml] simplify the test
  fix test by letting mock throw the actual expected exception
  • Loading branch information
fabpot committed Sep 27, 2020
2 parents 8f6a001 + 0b8c4bb commit e3cdd51
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ public function addResource(string $format, $resource, string $locale, string $d
public function setLocale(string $locale)
{
$this->assertValidLocale($locale);
$this->locale = $locale;
$this->locale = $locale ?? (class_exists(\Locale::class) ? \Locale::getDefault() : 'en');
}

/**
* {@inheritdoc}
*/
public function getLocale()
{
return $this->locale ?? \Locale::getDefault();
return $this->locale;
}

/**
Expand Down

0 comments on commit e3cdd51

Please sign in to comment.