@php($activeLocale = app()->getLocale())
<x-filament::dropdown placement="bottom-end">
    <x-slot name="trigger">
        <button type="button" class="tp-admin-control" aria-label="{{ __('ui.language') }}" title="{{ __('ui.language') }}">
            <x-filament::icon icon="heroicon-o-language" class="fi-icon fi-size-lg" />
            <span class="tp-admin-control-label">{{ strtoupper($activeLocale) }}</span>
            <x-filament::icon icon="heroicon-m-chevron-down" class="tp-admin-control-chevron" />
        </button>
    </x-slot>
    <x-filament::dropdown.list>
        @foreach(['tr' => 'Türkçe', 'en' => 'English'] as $code => $label)
            <form method="POST" action="{{ route('locale.update') }}">@csrf
                <input type="hidden" name="return_to" value="{{ request()->getRequestUri() }}">
                <x-filament::dropdown.list.item type="submit" name="locale" :value="$code" :icon="$activeLocale === $code ? 'heroicon-o-check' : null">
                    {{ $label }}
                </x-filament::dropdown.list.item>
            </form>
        @endforeach
    </x-filament::dropdown.list>
</x-filament::dropdown>
