Closed valpuia604 closed 5 months ago
There's no way for the queue worker to know the selected locale when you're not storing it. Not a Filament bug, right? 🙂
I am not sure about "you're not storing it", how to store the locale? I hope we can do sth like this but don't know where exactly to change (for PR) https://laravel.com/docs/11.x/notifications#localizing-notifications
I'm not sure I fully understand the original issue. You're talking about data being stored in English, but we're talking about exports right? Not imports?
Yes, store in "English" only in export (I didn't check for imports atm). Like I said in OP using sync
it's working fine.
Can you explain how we can store (not sure this word is correct or not) the selected locale for queue work database
?
Could you clarify the issue here? I'm not sure what you're referring to with "storing in English".
As we can see from this image, my locale is km
but after exported the title (Export completed), message (your league...) and download button text never translate because of queue database
.. like I said these are working fine if I use sync
What I meant for "storing in English" is after exported, all these notifications are displayed based on database data, so my database contains only "English" word, not others (for database
not sync
queue). hope you understand
This should just work then, right? https://laravel.com/docs/11.x/notifications#localizing-notifications
I hope that links resolves this, but I don't know how to apply that one in "Export"
Just implement the HasLocalePreference
interface on your User model?
not working
/**
* @return string|null
*/
public function preferredLocale(): ?string
{
return \App::getLocale();
}
Package
filament/filament
Package Version
v3.2.83
Laravel Version
v11.8.0
Livewire Version
v3.5
PHP Version
v8.2
Problem description
When switching to different locale and export data using
QUEUE_CONNECTION=database
doesn't respect app locale and always storing data inen
language. ifQUEUE_CONNECTION=sync
then it's correct.Expected behavior
Export with queue respect app locale
Steps to reproduce
clone, install login using
test@example.com
andpassword
Change locale Goto user, export user using non english locale run queuephp artisan queue:work
Check database/notificationsReproduction repository
https://github.com/valpuia604/fila-noti-db-bug
Relevant log output
No response