Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Laravel error when changing localization in Metronic 8


Hello,

I am currently using Laravel demo8 from Metronic 8 package.

I am getting an error when trying to change the "locale" setting in config/app.php from 'en' to 'ro' (a custom folder created by me with Romanian translations). I have even added the english translations provided by the theme in the 'ro' folder, but the error persists.

The output of the error:
Array to string conversion (View: xxxx\resources\views\layout\demo8\aside\_menu.blade.php)

The debug panel traces the error to app\Core\Menu.php:199, more specifically the
echo __($item['title']); from these lines:

if ( isset($this->callbacks['title']) && is_callable($this->callbacks['title']) ) {
echo call_user_func($this->callbacks['title'], $item, $item['title']);
} else {
echo __($item['title']);
...
}

To me, looks like the 'title' atribute from the menu is not recognized, but I may be wrong.

How can I solve this issue?

Thank you!


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (3)


Hi David,

Could you please try to update the config after changing the config from app.php?


php artisan config:clear


Thanks



Hi Faizal,

I have tried your suggestion and unfortunately the error still persists.
If you have any other ideas please tell me.

Thanks



Hi,

Probably the file name under lang/ro/ has a similar name in the menu title.

For example;

resources/lang/ro/test.php
And in the menu, there is a "test" title.

Thanks


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(