bezhanSalleh / filament-language-switch

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

Cannot change language #59

Closed aquzif closed 9 months ago

aquzif commented 9 months ago

Hello, When i try to change language, i get "Component not found" error inside dev tools.

Steps to reporduce:

  1. prepare fresh filamentphp setup:
    • composer create-project laravel/laravel example-app
    • setup database
    • composer require filament/filament:"^3.0-stable" -W
    • php artisan filament:install --panels
    • migrate, and create user
  2. Install plugin:
    • composer require bezhansalleh/filament-language-switch
    • register Language Switch in AppServiceProvider, in boot method as belows:
LanguageSwitch::configureUsing(function (LanguageSwitch $languageSwitch) {
    $languageSwitch->locales([
        'fr', 'en'
    ])->renderHook('panels::global-search.before');
});

Note: To even see language switch, i need to change render hook to global-search.before, create resource for User, and add protected static ?string $recordTitleAttribute = 'email';

Now when I try to change the language I get the error as below

image

bezhanSalleh commented 9 months ago

i don't know what, but something is not right. here is the repo created just like the steps you outlined and it works as it should. https://github.com/bezhanSalleh/filament-language-switch-test

aquzif commented 9 months ago

I compared yours files with mine, there was one thing that changed everything: require filament/filament. I had "3.0-stable", you had "^3.0". Even if i created clean installation, i didnt had latest version of filament. Once i changed this to your version, deleted vendor files, composer lock and redownloaded vendor files, everything started working properly. Thank you for a repository :)

bezhanSalleh commented 9 months ago

No worries, Cheers!