F
Filament3mo ago
Ashk

Navigation group translated label and sort

Hi, I have weird behavior that I can't understand at all, maybe someone here is able to explain it? I define my navigation groups as follows
->navigationGroups([
NavigationGroup::make(__('labels.third_parties'))
->collapsible(),
NavigationGroup::make(__('labels.planning'))
->collapsible(),
NavigationGroup::make(__('labels.commercial'))
->collapsible(),
])
->navigationGroups([
NavigationGroup::make(__('labels.third_parties'))
->collapsible(),
NavigationGroup::make(__('labels.planning'))
->collapsible(),
NavigationGroup::make(__('labels.commercial'))
->collapsible(),
])
The order in English is good, but in French it changes (planning and commercial inverted) Thanks for your help!
No description
No description
Solution:
Put it like this, you need to wrap in fn()
NavigationGroup::make()
->label(fn (): string => __('labels.third_parties')),
NavigationGroup::make()
->label(fn (): string => __('labels.third_parties')),
...
Jump to solution
3 Replies
403gtfo
403gtfo3mo ago
Just a stab in the dark, but what about trying this?
Filament::registerNavigationGroups([
NavigationGroup::make('nav_1')
->label(__('labels.third_parties'))
->collapsible(),
NavigationGroup::make('nav_2')
->label(__('labels.planning'))
->collapsible(),
NavigationGroup::make'nav_3')
->label(__('labels.commercial'))
->collapsible(),
])
Filament::registerNavigationGroups([
NavigationGroup::make('nav_1')
->label(__('labels.third_parties'))
->collapsible(),
NavigationGroup::make('nav_2')
->label(__('labels.planning'))
->collapsible(),
NavigationGroup::make'nav_3')
->label(__('labels.commercial'))
->collapsible(),
])
I dont have a lot of experience in multi language, but the idea is the make('nav_x) is normalized and should be consistent across languages the labels are still translatable.
Solution
Vp
Vp3mo ago
Put it like this, you need to wrap in fn()
NavigationGroup::make()
->label(fn (): string => __('labels.third_parties')),
NavigationGroup::make()
->label(fn (): string => __('labels.third_parties')),
Ashk
AshkOP3mo ago
Now that I have the solution in front of me it seems so obvious.... Thank you so much!!!
Want results from more Discord servers?
Add your server