Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

Laravel menu translation


Hi,
How can translate laravel menu with Metronic 8? Currently the menu is in config directory which translator class is not accessible.

For example I have a translations file under resources/lang/translations.php with value 'settings' => 'Setting|Settings' and I want to use it in Menu.php under config directory as

trans_choice("translations.settings", 2).


Thanks,


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (4)


Hi,

Do you have the translation file?

resources/lang/en/translations.php

Thanks



Thank for your response Faizal. But that solution doesn't work. I'm not sure what I'm missing.
Here is what I have, but output as normal text string

array(
'title' => 'translations.roles',
'path' => 'settings/roles',
'bullet' => '<span class="bullet bullet-dot"></span>',
),


The menu output is ranslations.roles



Hi

In the config/global/menu.php file, add the translation key for the title. For example:


array(
"title" => "messages.overview",
"path" => "documentation/getting-started/overview",
),


In the Menu.php class, the menu title would be processed as:

echo __("messages.overview");


Thanks


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(