The New Way to Build! Introducing ReUI — the developer platform for agentic UI with shadcn/ui
Learn More

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
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 (3)


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



Hi Faizal,

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

Thanks



Hi David,

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


php artisan config:clear


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  :(