Skip to content

Commit

Permalink
Only check hasForLocale once in localeForChoice
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanvdlugt committed Jul 31, 2024
1 parent 9037a8e commit 569ff21
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/Illuminate/Translation/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,9 @@ public function choice($key, $number, array $replace = [], $locale = null)
*/
protected function localeForChoice($key, $locale)
{
if ($locale && $this->hasForLocale($key, $locale)) {
return $locale;
}

if ($this->hasForLocale($key, $this->locale)) {
return $this->locale;
}
$locale = $locale ?: $this->locale;

return $this->fallback;
return $this->hasForLocale($key, $locale) ? $locale : $this->fallback;
}

/**
Expand Down

0 comments on commit 569ff21

Please sign in to comment.