bezhanSalleh / filament-language-switch

A versatile and user-friendly plugin designed for Filament Panels.
MIT License
210 stars 45 forks source link

Feature: Add Language switch to Auth pages #43

Closed mstfkhazaal closed 1 year ago

mstfkhazaal commented 1 year ago

Add switch to Auth pages (Login,Register, verify,tenant...)

bezhanSalleh commented 1 year ago

you are welcome to PR it. no time atm. might rewrite the whole plugin to globally control everything from a service provider.

dgironella commented 1 year ago

Adding a switch to the Auth pages (Login, Register, Verify, Tenant, etc.) sounds like a fantastic idea! It will undoubtedly enhance user navigation and experience, making the platform more user-friendly and intuitive. This addition will streamline processes and provide users with a more cohesive experience. Well thought out!

underdpt commented 1 year ago

Hello,

It's actually pretty easy to add this to the login page. This is how I'm doing it to show on the top right of the page, by adding a renderhook on the panel (p.e. AdminPanelProvider):

->renderHook(
    name: 'panels::body.start',
    hook: function (): string {
        return Blade::render(
            <<<'EOD'
            <div class="absolute top-2 right-2">
                @livewire('switch-filament-language')
            </div>
            EOD
        );
    },
    // scopes: [
    // Pages\Auth\Login::class,
    // Pages\Auth\Register::class,
    // Pages\Auth\EmailVerification\EmailVerificationPrompt::class,
    // Pages\Auth\PasswordReset\RequestPasswordReset::class,
    // Pages\Auth\PasswordReset\ResetPassword::class,
    // ]
);

One issue is hat scoping is not working (that's why the scopes are commented), so it shows on everypage (but get hidden behind the top bar). I'm starting a discussion on Filament to see how to solve it.

underdpt commented 1 year ago

For reference, this is the Filament issue: https://github.com/filamentphp/filament/issues/8213