blessing-skin-server/resources/views/common/language.blade.php

27 lines
1.1 KiB
PHP
Raw Normal View History

<!-- Language Menu -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
2018-08-08 12:30:50 +08:00
<i class="fas fa-language" aria-hidden="true"></i>
2016-12-30 15:57:03 +08:00
<span class="description-text">{{ config('locales.'.App::getLocale(), config('locales.'.config('app.fallback_locale')))['short_name'] }}</span>
2016-12-11 15:17:24 +08:00
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
2016-12-30 15:57:03 +08:00
@foreach(config('locales') as $code => $langInfo)
2017-01-18 22:31:35 +08:00
@if (!isset($langInfo['alias']))
<?php
if (count($_GET) == 0) {
$link = "?lang=$code";
} elseif(isset($_GET['lang'])) {
$link = str_replace("lang={$_GET['lang']}", "lang=$code", $_SERVER['REQUEST_URI']);
} else {
$link = $_SERVER['REQUEST_URI']."&lang=$code";
}
?>
<li class="locale" data-code="{{ $code }}">
<a href="{{ $link }}">{{ $langInfo['name'] }}</a>
</li>
2017-01-18 22:31:35 +08:00
@endif
@endforeach
</ul>
</li>