Skip to content

Commit

Permalink
Small change to make code easier to read (#29)
Browse files Browse the repository at this point in the history
* Small change to make code easier to read

* Fix small change to make code easier to read
  • Loading branch information
k-37 authored Oct 14, 2020
1 parent 24f8f0d commit 57c7fb9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Translation/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,13 @@ public function loadCurrentLocale(): string

$localeCode = $request->query->get('locale');

if (!$localeCode) {
$preferredLanguage = $request->getPreferredLanguage();
$preferredLanguage = '' === $preferredLanguage ? null : $preferredLanguage;

return $preferredLanguage ?? $this->defaultLocale;
if ($localeCode) {
return $localeCode;
}

return $localeCode;
$preferredLanguage = $request->getPreferredLanguage();

return empty($preferredLanguage) ? $this->defaultLocale : $preferredLanguage;
}

/**
Expand Down

0 comments on commit 57c7fb9

Please sign in to comment.