@props([ 'size' => 'md', ]) @php $locales = config('dashboard.locales', ['ar', 'en']); $current = app()->getLocale(); $next = collect($locales)->first(fn ($locale) => $locale !== $current) ?? $current; $sizeClass = match ($size) { 'sm' => 'size-8 gap-1.5 px-2.5 text-[11px]', default => 'size-9 gap-2 px-3 text-xs', }; @endphp @if (count($locales) <= 2) {{-- Two-locale projects get a single toggle button --}} class([ 'inline-flex items-center rounded-full font-medium uppercase tracking-wider transition', $sizeClass, ]) }} data-current-locale="{{ $current }}" data-next-locale="{{ $next }}" aria-label="{{ __('dashboard::dashboard.auth.locale_label.' . $next) }}"> {{ strtoupper($next) }} @else {{-- 3+ locales fall back to a dropdown --}} @foreach ($locales as $locale) {{ __('dashboard::dashboard.auth.locale_label.' . $locale) }} @endforeach @endif