F
Filament6mo ago
Vp

export notification message doesn't change base on locale

As we can see from image, I have translation file in action/km/export but on the notification list, only english is displayed. This line "Your league export..." is exceptional cause I didn't create a translation text, but both "Export Completed & Download.xls" should translate.. I use km and zh_CN locale, in both locale this "Export Completed" and "Download" is not translated How to resolve this? version: v3.2.83
No description
No description
Solution:
Yes, sync is working, database always showing 'English'
Jump to solution
29 Replies
Vp
VpOP6mo ago
Checking this more and more: 1. Notification list is displayed from database notifications table 2. While exporting, it doesn't check translation files and store english word only (Export completed, Download.**) 3. The body text (Your league ...) also not checking translation, it just store default english only.. I may be wrong also, but these are what I found
Lara Zeus
Lara Zeus6mo ago
check the class ExportCompletion they are translated ->title(__('filament-actions::export.notifications.completed.title')) but it always store the current active locale
Vp
VpOP6mo ago
For me always store "English" only, yeah title body download action were translated (based on code), but I got only English in DB
Lara Zeus
Lara Zeus6mo ago
did you published the lang files? maybe they not updated?
No description
Vp
VpOP6mo ago
No, not published.. and I don't have any missing translation for export for km
Lara Zeus
Lara Zeus6mo ago
one thing that my QUEUE_CONNECTION is sync not sure if affect this, since in queue the default is en I think!
Solution
Vp
Vp6mo ago
Yes, sync is working, database always showing 'English'
Lara Zeus
Lara Zeus6mo ago
ya thought so https://laravel.com/docs/11.x/notifications#localizing-notifications there is a chance to send PR new feature for filament to support something like: Notification::make()->locale('es')->send()
Vp
VpOP6mo ago
I don't have any idea where to start for this new feature 🤣
Lara Zeus
Lara Zeus6mo ago
then I suggest report it as a bug, maybe the team will do better than us 😅
Vp
VpOP6mo ago
sure
Umar Farooq
Umar Farooq6mo ago
I'm facing same issue
No description
Umar Farooq
Umar Farooq6mo ago
I do publish the translation
No description
krekas
krekas6mo ago
even if you have published languages it doesn't mean all values are translated
Umar Farooq
Umar Farooq6mo ago
all values are translated
No description
Umar Farooq
Umar Farooq6mo ago
The db notification does not get translated according to the app locale. simple notification work fine
No description
krekas
krekas6mo ago
there's no such language zh https://github.com/filamentphp/filament/tree/3.x/packages/actions/resources/lang it's either zh_CN or zh_TW
Umar Farooq
Umar Farooq6mo ago
Yes, I just need "zh", not "zh_CN" for China, "zh_TW" for Taiwan, or "zh_SG" for Singapore. other translations are working fine according to zh
krekas
krekas6mo ago
by default laravel fallbacks locale to english https://github.com/laravel/laravel/blob/11.x/config/app.php#L83 so it should be some translations missing or maybe the locale is set wrong
Umar Farooq
Umar Farooq6mo ago
no, I double check the __('filament-actions::export.notifications.completed.title') working fine expect inside the db notification
Umar Farooq
Umar Farooq6mo ago
No description
No description
krekas
krekas6mo ago
maybe some cache issue then?
Umar Farooq
Umar Farooq6mo ago
I try to flush all the redis cache
Vp
VpOP6mo ago
This is the solution ATM @Umar Farooq You can read another solution here https://github.com/filamentphp/filament/issues/12974
Umar Farooq
Umar Farooq6mo ago
HasLocalPreference is not working
/**
* @return string|null
*/
public function preferredLocale(): ?string
{
return \App::getLocale();
}
/**
* @return string|null
*/
public function preferredLocale(): ?string
{
return \App::getLocale();
}
Vp
VpOP6mo ago
Yeah I also have the same problem..
Umar Farooq
Umar Farooq6mo ago
no solution? 🥲
Vp
VpOP6mo ago
Just use QUEUE_CONNECTION=sync 🤣 no solution atm
Umar Farooq
Umar Farooq6mo ago
Want results from more Discord servers?
Add your server