Skip to content

Instantly share code, notes, and snippets.

@duikb00t
Last active September 2, 2015 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duikb00t/7f6311b0bb3084204eb1 to your computer and use it in GitHub Desktop.
Save duikb00t/7f6311b0bb3084204eb1 to your computer and use it in GitHub Desktop.
Language Switcher blade laravel - add active class to the current language so you can style it with CSS.
<ul class="language_bar_chooser pull-right">
@foreach(LaravelLocalization::getSupportedLocales() as $localeCode => $properties)
<li>
@if ( $localeCode == LaravelLocalization::getCurrentLocale() )
<a class="active"rel="alternate" hreflang="{{$localeCode}}" href="{{LaravelLocalization::getLocalizedURL($localeCode) }}">{{{ $properties['native'] }}}</a>
@else
<a rel="alternate" hreflang="{{$localeCode}}" href="{{LaravelLocalization::getLocalizedURL($localeCode) }}">{{{ $properties['native'] }}}</a>
@endif
</li>
@endforeach
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment