I want to "multilocalize" my Laravel project.
I made my directory structure like this:
lang
- en
- front
- contact.php
-footer.php
And I built my footer like this:
{{ link_to('/', trans('footer.frontpage'))}}
It works perfectly, but when I want localize the other blade pages, for example the contact us
page like this:
@lang('front.contact.name')
or this:
{{ __('front.contact.name') }}
or this:
{{ trans('front.contact.name') }}
I only got back on the page:
front.contact.name
What's the problem?
Just use /
as directory separator.
{{ trans('front/contact.name') }}
In Blade both "
/
" and ".
" function (while the latter is recommended).But for
Lang
the ".
" is unintentionally reserved for file's content (array and any number of child-array), so that we can have both a folder and file with the same name (like bothfront
folder andfront.php
file).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With