Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
chinleung committed Jul 16, 2020
1 parent c9138d5 commit 978a418
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/MultilingualRegistrar.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ protected function generatePrefixForLocale(string $key, string $locale): ?string
protected function generateUriFromKey(string $key, string $locale): string
{
if ($key == '/') {
return $this->shouldNotPrefixLocale($locale) ||
$this->shouldNotPrefixDefaultHome($locale) ? '/' : "/$locale";
return $this->shouldNotPrefixHome($locale) ? '/' : "/{$locale}";
}

return Lang::has("routes.{$key}", $locale)
Expand Down Expand Up @@ -226,7 +225,19 @@ protected function shouldNotPrefixLocale(string $locale): bool
}

/**
* Verify if we should not prefix the default Home Route.
* Verify if we should not prefix the home page.
*
* @param string $locale
* @return bool
*/
protected function shouldNotPrefixHome(string $locale): bool
{
return $this->shouldNotPrefixLocale($locale)
|| $this->shouldNotPrefixDefaultHome($locale);
}

/**
* Verify if we should not prefix the default home page.
*
* @param string $locale
* @return bool
Expand Down

0 comments on commit 978a418

Please sign in to comment.