vendredi 2 décembre 2016

Laravel localization file format error: array() versus [] format

I am struggling a bit with localization in Laravel 5.3 (with php 7). The default localizaiton file format in Laravel 5.3 is using brackets, as in this example:

return [
'footer.contact.email'   => 'Email:',
]

That's what I have been using in my app and it's working fine. But now I am trying to work with some packages to help with translations, for example:

But both of those generate localization files in the "old" laravel 4.x array format. For example

return array(
  'footer' => array(
    'contact' => array(
      'email' => 'Email:',
    ),
   ), 
);

As I understand it I should have no issue with this localization file format in my laravel 5.3 app, however it's always throwing an exception:

[2016-12-02 13:26:01] local.ERROR: ErrorException: htmlspecialchars() expects parameter 1 to be string, array given in C:\100_source_code\consulting_platform_laravel\maingig\vendor\laravel\framework\src\Illuminate\Support\helpers.php:519
Stack trace:
#0 C:\100_source_code\consulting_platform_laravel\maingig\vendor\sentry\sentry\lib\Raven\Breadcrumbs\ErrorHandler.php(36): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'htmlspecialchar...', 'C:\\100_source_c...', 519, Array)

I really cant understand why this format is not working with my app. I bet it is something trivial that I am missing, but any help would be very welcome!

Thanks,

Christian



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire