src/Classes/ExportLocalizations.php
public function export()
    {
        // Check if value is cached and set array to cached version
        if (Cache::has(config('laravel-localization.caches.key'))) {
            $this->strings = Cache::get(config('laravel-localization.caches.key'));

            return $this;
        }

        foreach (config('laravel-localization.paths.lang_dirs') as $dir) {
            try {

                // Collect language files and build array with translations
                $files = $this->findLanguageFiles($dir);

                // Parse translations and create final array
                array_walk($files['lang'], [$this, 'parseLangFiles'], $dir);
                array_walk($files['vendor'], [$this, 'parseVendorFiles'], $dir);
                array_walk($files['json'], [$this, 'parseJsonFiles'], $dir);
            } catch (\Exception $exception) {
                \Log::critical('Can\'t read lang directory '.$dir.', error: '.$exception->getMessage());
            }
        }

        // Trigger event for final translated array
        event(new LaravelLocalizationExported($this->strings));

        // If timeout > 0 save array to cache
        if (config('laravel-localization.caches.timeout', 0) > 0) {
            Cache::store(config('laravel-localization.caches.driver', 'file'))
                 ->put(
                     config('laravel-localization.caches.key', 'localization.array'),
                     $this->strings,
                     config('laravel-localization.caches.timeout', 60)
                 );
        }

        return $this;
    }
public function export()
    {
        // Check if value is cached and set array to cached version
        if (Cache::has(config('laravel-localization.caches.key'))) {
            $this->strings = Cache::get(config('laravel-localization.caches.key'));

            return $this;
        }

        foreach (config('laravel-localization.paths.lang_dirs') as $dir) {
            try {

                // Collect language files and build array with translations
                $files = $this->findLanguageFiles($dir);

                // Parse translations and create final array
                array_walk($files['lang'], [$this, 'parseLangFiles'], $dir);
                array_walk($files['vendor'], [$this, 'parseVendorFiles'], $dir);
                array_walk($files['json'], [$this, 'parseJsonFiles'], $dir);
            } catch (\Exception $exception) {
                \Log::critical('Can\'t read lang directory '.$dir.', error: '.$exception->getMessage());
            }
        }

        // Trigger event for final translated array
        event(new LaravelLocalizationExported($this->strings));

        // If timeout > 0 save array to cache
        if (config('laravel-localization.caches.timeout', 0) > 0) {
            Cache::store(config('laravel-localization.caches.driver', 'file'))
                 ->put(
                     config('laravel-localization.caches.key', 'localization.array'),
                     $this->strings,
                     config('laravel-localization.caches.timeout', 60)
                 );
        }

        return $this;
    }
public function export ( ) { // Check if value is cached and set array to cached version if ( Cache :: has ( config ( 'laravel-localization.caches.key' ) ) ) { $ this -> strings = Cache :: get ( config ( 'laravel-localization.caches.key' ) ) ; return $ this ; } foreach ( config ( 'laravel-localization.paths.lang_dirs' ) as $ dir ) { try { // Collect language files and build array with translations $ files = $ this -> findLanguageFiles ( $ dir ) ; // Parse translations and create final array array_walk ( $ files [ 'lang' ] , [ $ this , 'parseLangFiles' ] , $ dir ) ; array_walk ( $ files [ 'vendor' ] , [ $ this , 'parseVendorFiles' ] , $ dir ) ; array_walk ( $ files [ 'json' ] , [ $ this , 'parseJsonFiles' ] , $ dir ) ; } catch ( \ Exception $ exception ) { \ Log :: critical ( 'Can\'t read lang directory ' . $ dir . ', error: ' . $ exception -> getMessage ( ) ) ; } } // Trigger event for final translated array event ( new LaravelLocalizationExported ( $ this -> strings ) ) ; // If timeout > 0 save array to cache if ( config ( 'laravel-localization.caches.timeout' , 0 ) > 0 ) { Cache :: store ( config ( 'laravel-localization.caches.driver' , 'file' ) ) -> put ( config ( 'laravel-localization.caches.key' , 'localization.array' ) , $ this -> strings , config ( 'laravel-localization.caches.timeout' , 60 ) ) ; } return $ this ; }
Method to return generate array with contents of parsed language files.

@return object
Method to return generate array with contents of parsed language files .