Skip to content

Commit

Permalink
Fix language switcher bad url
Browse files Browse the repository at this point in the history
  • Loading branch information
ilestis committed Nov 11, 2023
1 parent b441258 commit f87ac51
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions resources/views/layouts/footer.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,37 +80,45 @@
</footer>

<x-dialog id="language-select-modal" :title="__('footer.language-switcher.title')">
@php
$currentUrl = url()->full();
if (\Illuminate\Support\Str::contains($currentUrl, '?')) {
$currentUrl .= '&lang=';
} else {
$currentUrl .= '?lang=';
}
@endphp
<div class="grid grid-cols-2 gap-4">
<ul class="list-none p-0 m-0">
<li class="py-2">
<a rel="alternate" hreflang="en-US" href="{{ url()->full() . '?lang=en-US' }}">
<a rel="alternate" hreflang="en-US" href="{{ $currentUrl . 'en-US' }}">
US English
</a>
</li>
<li class="py-2">
<a rel="alternate" hreflang="en" href="{{ url()->full() . '?lang=en' }}">
<a rel="alternate" hreflang="en" href="{{ $currentUrl . 'en' }}">
UK English
</a>
</li>
<li class="py-2">
<a rel="alternate" hreflang="pt-BR" href="{{ url()->full() . '?lang=pt-BR' }}">
<a rel="alternate" hreflang="pt-BR" href="{{ $currentUrl . 'pt-BR' }}">
Português do Brasil
</a>
</li>
</ul>
<ul class="list-none p-0 m-0">
<li class="py-2">
<a rel="alternate" hreflang="de" href="{{ url()->full() . '?lang=de' }}">
<a rel="alternate" hreflang="de" href="{{ $currentUrl . 'de' }}">
Deutsch
</a>
</li>
<li class="py-2">
<a rel="alternate" hreflang="fr" href="{{ url()->full() . '?lang=fr' }}">
<a rel="alternate" hreflang="fr" href="{{ $currentUrl . 'fr' }}">
Français
</a>
</li>
<li class="py-2">
<a rel="alternate" hreflang="es" href="{{ url()->full() . '?lang=es' }}">
<a rel="alternate" hreflang="es" href="{{ $currentUrl . 'es' }}">
Español
</a>
</li>
Expand All @@ -123,29 +131,29 @@
<div class="grid grid-cols-2 gap-4">
<ul class="list-none p-0 m-0">
<li class="py-2">
<a rel="alternate" hreflang="it" href="{{ url()->full() . '?lang=it' }}">
<a rel="alternate" hreflang="it" href="{{ $currentUrl . 'it' }}">
Italiano
</a>
</li>
<li class="py-2">
<a rel="alternate" hreflang="pl" href="{{ url()->full() . '?lang=pl' }}">
<a rel="alternate" hreflang="pl" href="{{ $currentUrl . 'pl' }}">
Polska
</a>
</li>
<li class="py-2">
<a rel="alternate" hreflang="ru" href="{{ url()->full() . '?lang=ru' }}">
<a rel="alternate" hreflang="ru" href="{{ $currentUrl . 'ru' }}">
Pусский
</a>
</li>
</ul>
<ul class="list-none p-0 m-0">
<li class="py-2">
<a rel="alternate" hreflang="nl" href="{{ url()->full() . '?lang=nl' }}">
<a rel="alternate" hreflang="nl" href="{{ $currentUrl . 'nl' }}">
Nederlands
</a>
</li>
<li class="py-2">
<a rel="alternate" hreflang="sk" href="{{ url()->full() . '?lang=sk' }}">
<a rel="alternate" hreflang="sk" href="{{ $currentUrl . 'sk' }}">
Slovenský
</a>
</li>
Expand Down

0 comments on commit f87ac51

Please sign in to comment.