Laravel:子文件夹中的lang文件

Fer*_*art 7 php localization laravel laravel-5

我想"多本地化"我的Laravel项目.

我创建了这样的目录结构:

lang
- en
 - front
  - contact.php
-footer.php
Run Code Online (Sandbox Code Playgroud)

我像这样建立了我的页脚:

{{ link_to('/', trans('footer.frontpage'))}}
Run Code Online (Sandbox Code Playgroud)

它工作得很好,但是当我想要本地化其他刀片页面时,例如这样的contact us页面:

@lang('front.contact.name')
Run Code Online (Sandbox Code Playgroud)

或这个:

{{ __('front.contact.name') }}
Run Code Online (Sandbox Code Playgroud)

或这个:

{{ trans('front.contact.name') }}
Run Code Online (Sandbox Code Playgroud)

我只回到了页面上:

front.contact.name

有什么问题?

Mah*_*bub 26

只需/用作目录分隔符.

{{ trans('front/contact.name') }}
Run Code Online (Sandbox Code Playgroud)

  • 谢谢,这就是问题所在:) (2认同)
  • 请注意:来自 Laravel 问题队列中的 Taylor Otwell:[“此行为不是故意的,因此将来可能不受支持,因此宁愿不记录它。”](https://github.com/laravel /docs/pull/3957#issuecomment-355646321) (2认同)