src/Commands/SyncCommand.php
private function syncKeysFromFiles($translationFiles)
    {
        $this->info('Reading translation keys from files...');

        // An array of all translation keys as found in project files.
        $allKeysInFiles = $this->manager->collectFromFiles();

        foreach ($translationFiles as $fileName => $languages) {
            foreach ($languages as $languageKey => $path) {
                $fileContent = $this->manager->getFileContent($path);

                if (isset($allKeysInFiles[$fileName])) {
                    $missingKeys = array_diff($allKeysInFiles[$fileName], array_keys(array_dot($fileContent)));

                    foreach ($missingKeys as $i => $missingKey) {
                        if (Arr::has($fileContent, $missingKey)) {
                            unset($missingKeys[$i]);
                        }
                    }

                    $this->fillMissingKeys($fileName, $missingKeys, $languageKey);
                }
            }
        }
    }
private function syncKeysFromFiles($translationFiles)
    {
        $this->info('Reading translation keys from files...');

        // An array of all translation keys as found in project files.
        $allKeysInFiles = $this->manager->collectFromFiles();

        foreach ($translationFiles as $fileName => $languages) {
            foreach ($languages as $languageKey => $path) {
                $fileContent = $this->manager->getFileContent($path);

                if (isset($allKeysInFiles[$fileName])) {
                    $missingKeys = array_diff($allKeysInFiles[$fileName], array_keys(array_dot($fileContent)));

                    foreach ($missingKeys as $i => $missingKey) {
                        if (Arr::has($fileContent, $missingKey)) {
                            unset($missingKeys[$i]);
                        }
                    }

                    $this->fillMissingKeys($fileName, $missingKeys, $languageKey);
                }
            }
        }
    }
private function syncKeysFromFiles ( $ translationFiles ) { $ this -> info ( 'Reading translation keys from files...' ) ; // An array of all translation keys as found in project files. $ allKeysInFiles = $ this -> manager -> collectFromFiles ( ) ; foreach ( $ translationFiles as $ fileName => $ languages ) { foreach ( $ languages as $ languageKey => $ path ) { $ fileContent = $ this -> manager -> getFileContent ( $ path ) ; if ( isset ( $ allKeysInFiles [ $ fileName ] ) ) { $ missingKeys = array_diff ( $ allKeysInFiles [ $ fileName ] , array_keys ( array_dot ( $ fileContent ) ) ) ; foreach ( $ missingKeys as $ i => $ missingKey ) { if ( Arr :: has ( $ fileContent , $ missingKey ) ) { unset ( $ missingKeys [ $ i ] ) ; } } $ this -> fillMissingKeys ( $ fileName , $ missingKeys , $ languageKey ) ; } } } }
Synchronize keys found in project files but missing in languages.

@param $translationFiles
@throws \Illuminate\Contracts\Filesystem\FileNotFoundException
@return void
Synchronize keys found in project files but missing in languages .