mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-27 06:29:19 +08:00
Fix determining URL with language preferred
This commit is contained in:
parent
48c8aeb6ff
commit
2ed5dad582
17
resources/views/vendor/language.tpl
vendored
17
resources/views/vendor/language.tpl
vendored
@ -8,11 +8,18 @@
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
@foreach(config('locales') as $code => $langInfo)
|
||||
@if (!isset($langInfo['alias']))
|
||||
@if (count($_GET) == 0 || (count($_GET) == 1 && isset($_GET['lang'])))
|
||||
<li class="locale"><a href="?lang={{ $code }}">{{ $langInfo['name'] }}</a></li>
|
||||
@else
|
||||
<li class="locale"><a href="{{ $_SERVER['REQUEST_URI'] }}&lang={{ $code }}">{{ $langInfo['name'] }}</a></li>
|
||||
@endif
|
||||
<?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>
|
||||
@endif
|
||||
@endforeach
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user