Nested Language Files in Laravel 5

28th May 2016

In earlier versions of Laravel, you were able to use dot notation to refer to language lines in sub-directories of your translations directory.

So in other words, given the following file structure:

resources
  lang
    en
      site.php
      admin
        settings
          site.php

...you could refer to a line named title in resources/lang/en/admin/settings/site.php like this:

admin.settings.site.title

This no longer works in Laravel 5. It's entirely possible, however - it's just not obvious, nor particularly well documented.

All you need to do is use forward-slashes, for example:

admin/settings/site.title

That's it.