src/Commands/SyncCommand.php
private function syncKeysBetweenLanguages($translationFiles)
    {
        $this->info('Synchronizing language files...');

        $filesResults = [];

        // Here we collect the file results
        foreach ($translationFiles as $fileName => $languageFiles) {
            foreach ($languageFiles as $languageKey => $filePath) {
                $filesResults[$fileName][$languageKey] = $this->manager->getFileContent($filePath);
            }
        }

        $values = Arr::dot($filesResults);

        $missing = $this->manager->getKeysExistingInALanguageButNotTheOther($values);

        foreach ($missing as &$missingKey) {
            list($file, $key) = explode('.', $missingKey, 2);

            list($key, $language) = explode(':', $key, 2);

            $this->fillMissingKeys($file, [$key], $language);
        }
    }
private function syncKeysBetweenLanguages($translationFiles)
    {
        $this->info('Synchronizing language files...');

        $filesResults = [];

        // Here we collect the file results
        foreach ($translationFiles as $fileName => $languageFiles) {
            foreach ($languageFiles as $languageKey => $filePath) {
                $filesResults[$fileName][$languageKey] = $this->manager->getFileContent($filePath);
            }
        }

        $values = Arr::dot($filesResults);

        $missing = $this->manager->getKeysExistingInALanguageButNotTheOther($values);

        foreach ($missing as &$missingKey) {
            list($file, $key) = explode('.', $missingKey, 2);

            list($key, $language) = explode(':', $key, 2);

            $this->fillMissingKeys($file, [$key], $language);
        }
    }
private function syncKeysBetweenLanguages ( $ translationFiles ) { $ this -> info ( 'Synchronizing language files...' ) ; $ filesResults = [ ] ; // Here we collect the file results foreach ( $ translationFiles as $ fileName => $ languageFiles ) { foreach ( $ languageFiles as $ languageKey => $ filePath ) { $ filesResults [ $ fileName ] [ $ languageKey ] = $ this -> manager -> getFileContent ( $ filePath ) ; } } $ values = Arr :: dot ( $ filesResults ) ; $ missing = $ this -> manager -> getKeysExistingInALanguageButNotTheOther ( $ values ) ; foreach ( $ missing as & $ missingKey ) { list ( $ file , $ key ) = explode ( '.' , $ missingKey , 2 ) ; list ( $ key , $ language ) = explode ( ':' , $ key , 2 ) ; $ this -> fillMissingKeys ( $ file , [ $ key ] , $ language ) ; } }
Synchronize keys that exist in a language but not the other.

@param $translationFiles
@throws \Illuminate\Contracts\Filesystem\FileNotFoundException
@return void
Synchronize keys that exist in a language but not the other .