src/Commands/FileLoaderCommand.php
public function loadDirectory($path, $locale, $namespace = '*', $group = '')
    {
        // Load all files inside subdirectories:
        $directories = $this->files->directories($path);
        foreach ($directories as $directory) {
            $directoryName = str_replace($path . '/', '', $directory);
            $dirGroup      = $group . basename($directory) . '/';
            $this->loadDirectory($directory, $locale, $namespace, $dirGroup);
        }

        // Load all files in root:
        $files = $this->files->files($path);
        foreach ($files as $file) {
            $this->loadFile($file, $locale, $namespace, $group);
        }
    }
public function loadDirectory($path, $locale, $namespace = '*', $group = '')
    {
        // Load all files inside subdirectories:
        $directories = $this->files->directories($path);
        foreach ($directories as $directory) {
            $directoryName = str_replace($path . '/', '', $directory);
            $dirGroup      = $group . basename($directory) . '/';
            $this->loadDirectory($directory, $locale, $namespace, $dirGroup);
        }

        // Load all files in root:
        $files = $this->files->files($path);
        foreach ($files as $file) {
            $this->loadFile($file, $locale, $namespace, $group);
        }
    }
public function loadDirectory ( $ path , $ locale , $ namespace = '*' , $ group = '' ) { // Load all files inside subdirectories: $ directories = $ this -> files -> directories ( $ path ) ; foreach ( $ directories as $ directory ) { $ directoryName = str_replace ( $ path . '/' , '' , $ directory ) ; $ dirGroup = $ group . basename ( $ directory ) . '/' ; $ this -> loadDirectory ( $ directory , $ locale , $ namespace , $ dirGroup ) ; } // Load all files in root: $ files = $ this -> files -> files ( $ path ) ; foreach ( $ files as $ file ) { $ this -> loadFile ( $ file , $ locale , $ namespace , $ group ) ; } }
Load all files inside a locale directory and its subdirectories.

@param  string  $path       Path to locale root. Ex: /path/to/laravel/resources/lang/en
@param  string  $locale     Locale to apply when loading the localization files.
@param  string  $namespace  Namespace to apply when loading the localization files ('*' by default, or the vendor package name if not)
@param  string  $group      When loading from a subdirectory, the subdirectory's name must be prepended. For example: trans('subdir/file.entry').
@return void
Load all files inside a locale directory and its subdirectories .