laravel / ideas

Issues board used for Laravel internals discussions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix nested directory structure for translation files

shadow81627 opened this issue · comments

Laravel localization doesn't follow the usual "dot notation" for files in nested directories. When using the dot notation with nested directories translation key is returned.
Such edit to docs was suggested already in July 2016 (#14212).
-amadeann

This behavior is not intentional and thus may not be supported in the future so would rather not document it.
-taylorotwell
Source

Either prevent nested directory structure access or document the functionality.

The translation string files may be nested in subdirectories:

    /resources
        /lang
            /en
                /welcome
                    messages.php
            /es
                /welcome
                    messages.php

In this case the translation strings will be referenced by specifying the full path. For example:

    {{ __('welcome/messages.welcome') }}

    @lang('welcome/messages.welcome')

Documentation
Source code
Stackoverflow