bezhanSalleh / filament-language-switch

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

getBrowserLocale for pt_BR language #77

Closed vitorcrovador closed 5 months ago

vitorcrovador commented 8 months ago

Hi,

The default language of my application is pt_BR. When a person accesses the application for the first time, the getBrowserLocale function in the SwitchLanguageLocale middleware returns 'en' as the browser language. Testing locally, I saw that the problem is that the variable "HTTP_ACCEPT_LANGUAGE" returns pt-BR instead of pt_BR ("pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7")

I override the class, changing the following line:

$appLocales = strreplace('','-',LanguageSwitch::make()->getLocales());

But I believe it is not the best solution. Could you check the best solution and make the correction?