blessing-skin-server/resources/views/vendor/language.tpl

27 lines
1.1 KiB
PHP
Raw Normal View History

<!-- Language Menu -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
2016-12-11 15:17:24 +08:00
<i class="fa 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">
<a href="{{ $link }}">{{ $langInfo['name'] }}</a>
</li>
2017-01-18 22:31:35 +08:00
@endif
@endforeach
</ul>
</li>