@php($activeLocale = app()->getLocale())
<div class="dropdown tp-locale-picker">
    <button class="btn btn-sm btn-outline-secondary dropdown-toggle d-inline-flex align-items-center gap-1" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="{{ __('ui.language') }}">
        <span aria-hidden="true">🌐</span><span>{{ strtoupper($activeLocale) }}</span>
    </button>
    <ul class="dropdown-menu dropdown-menu-end shadow-sm">
        @foreach(['tr' => 'Türkçe', 'en' => 'English'] as $code => $label)
            <li><form method="POST" action="{{ route('locale.update') }}">@csrf
                <input type="hidden" name="return_to" value="{{ request()->getRequestUri() }}">
                <button name="locale" value="{{ $code }}" type="submit" class="dropdown-item d-flex align-items-center gap-2" @if($activeLocale === $code) aria-current="true" @endif>
                    <span class="text-center" style="width:1rem" aria-hidden="true">{{ $activeLocale === $code ? '✓' : '' }}</span><span>{{ $label }}</span>
                </button>
            </form></li>
        @endforeach
    </ul>
</div>
