0

when trying to translate metronic menu (generated from config file ). it gives me:

Target class [translator] does not exist.

this error is thrown when I use __() method

OMR
  • 11,736
  • 5
  • 20
  • 35
amin mohamed
  • 53
  • 1
  • 7
  • are you using __(), translator helper, in the config file. If yes then you cant use __() in the config file because they load very first. – abhay Mar 03 '21 at 09:08
  • Yes I know but what I should do to translate this menu ? – amin mohamed Mar 03 '21 at 09:11
  • I think if you define keys in the config then translate them inside the view or controller then it works .something like __(config('key')). – abhay Mar 03 '21 at 09:32

1 Answers1

0

I reach that i should not modify the aside_menu.php (the confige file where the menu generated from) instead, should perform modification where this values actually handled, So for this purpose Metronic team had created App\classes\Menu.php which where you should do the work for example:

=> you can translate section title from :

' . $item['section'] '

=> be modified to

' . __('lang.'.$item['section']). '
amin mohamed
  • 53
  • 1
  • 7