我想“多本地化”我的 Laravel 项目。
我的目录结构是这样的:
lang
- en
- front
- contact.php
-footer.php
我这样构建了页脚:
{{ link_to('/', trans('footer.frontpage'))}}
它工作得很好,但是当我想要本地化其他刀片页面时,例如contact us
页面是这样的:
@lang('front.contact.name')
or this:
{{ __('front.contact.name') }}
or this:
{{ trans('front.contact.name') }}
我才回到页面:
前台.联系人.姓名
有什么问题?
只需使用/
作为目录分隔符。
{{ trans('front/contact.name') }}
在《刀锋》中,“/
" and ".
” 函数(建议使用后者)。
But for Lang
the ".
" is 无意中为文件内容(数组和任意数量的子数组)保留,这样我们就可以拥有同名的文件夹和文件(就像两者一样)front
文件夹和front.php
file).
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)