PHP code example of bunker / laravel-localization
1. Go to this page and download the library: Download bunker/laravel-localization library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bunker / laravel-localization example snippets
bash
<ul class="navbar-nav">
@if(count(config('panel.available_languages', [])) > 1)
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="languageDropdown" role="button"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ strtoupper(app()->getLocale()) }}
</a>
<div class="dropdown-menu" aria-labelledby="languageDropdown">
@foreach(config('panel.available_languages') as $langLocale => $langName)
<a class="dropdown-item {{ app()->getLocale() == $langLocale ? 'd-none': '' }}" href="{{ url()->current() }}?lang={{ $langLocale }}">{{ $langName }}</a>
@endforeach
</div>
</li>
@endif
</ul>