Support the ongoing development of →
Configuration Views
Last updated 2 years ago.

I am currently learning to localize my L5 installation, thus, I am interested in this topic. As far as I can tell, the localization still works out of the box with L5. You have a default language set in the config and a fallback language. And according to my experience, this is fetching the respective language resource from the respective folders.

But L5 (and I guess L4 too) does not have a native multilanguage feature. You will probably have to install a package for that. Something like

Question: Where exactly did you try to use the 'trans' method? In a view file? I can only confirm that it works properly in view files so far...

Last updated 9 years ago.

Localization itself works out of the box in L4 and L5, but there is one difference: In L4 you could add whatever folder structure you like to your app/lang/{locale}/directory, you could easily access those files (even in subdirs) by Lang::get('directory_1.directory_2.[...].directory_n.key') in your views.

In L5 only those files in the directory resources/lang/{locale}/(without subdirs) are loaded. A value in resources/lang/en/foo/bar.php cannot be called in views by Lang::get('') (which is by the way the same like trans('')).

Having multiple lang files, I find it reasonable to organize those in several subfolders.


You may be right. I think I tried subfolders too at the beginning, but decided then to use underscores to "categorize" my language files, e.g. foo_bar.php. I will check asap. I will then also try other delimiters like '/'.


For your example you need to specify the path as:



For those who are facing the same problem with sub directories in Laravel 5. Its working, but you have to add a slash to the directories instead of a point.


{{ trans('foo/bar/foo.key') }}
Last updated 8 years ago.

Sign in to participate in this thread!


Your banner here too?

ndrskln ndrskln Joined 23 Feb 2015


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.