2017-04-20 08:09
浏览 133


I am working on a Multi Lingual Application in Laravel 5.4



Then in other pages, I am trying to set the tile dyamically based on user locale. It throws error when I try to use the following:

@section('title',{{ __("dashboard") }})


@section('title', @lang("dashboard"))

This is the error:

Parse error: syntax error, unexpected '<'

Can any one tell how to pass @lang or __('') as paramater in a @section()

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dpxw17759 2017-04-20 08:17

    What you have as a parameter is supposedly php. Therefore, when you put @lang or {{}}, it will open php tags inside already opened php tags.
    Therefore, what you can do is just put __() without the brackets. Just like that :

    @section('title', __('dashboard'))
    打赏 评论
  • dsvcqvp139098 2017-04-20 08:16

    You can use trans instead of lang decorators :

    @section('title', trans("dashboard"))


    You can also use __ function like this :

    @section('title', __("dashboard"))

    You don't need to use {{}} as you are not using it inside another directive.

    打赏 评论

相关推荐 更多相似问题