src/Commands/MissingCommand.php
private function getMissing(array $languages)
    {
        $files = $this->manager->files();

        // Array of content of all files indexed by fileName.languageKey
        $filesResults = [];

        // The final output of the method
        $missing = [];

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

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

        $emptyValues = array_filter($values, function ($value) {
            return $value == '';
        });

        // Adding all keys that has values = ''
        foreach ($emptyValues as $dottedValue => $emptyValue) {
            list($fileName, $languageKey, $key) = explode('.', $dottedValue, 3);

            $missing[] = "{$fileName}.{$key}:{$languageKey}";
        }

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

        return $missing;
    }
private function getMissing(array $languages)
    {
        $files = $this->manager->files();

        // Array of content of all files indexed by fileName.languageKey
        $filesResults = [];

        // The final output of the method
        $missing = [];

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

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

        $emptyValues = array_filter($values, function ($value) {
            return $value == '';
        });

        // Adding all keys that has values = ''
        foreach ($emptyValues as $dottedValue => $emptyValue) {
            list($fileName, $languageKey, $key) = explode('.', $dottedValue, 3);

            $missing[] = "{$fileName}.{$key}:{$languageKey}";
        }

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

        return $missing;
    }
private function getMissing ( array $ languages ) { $ files = $ this -> manager -> files ( ) ; // Array of content of all files indexed by fileName.languageKey $ filesResults = [ ] ; // The final output of the method $ missing = [ ] ; // Here we collect the file results foreach ( $ files as $ fileName => $ languageFiles ) { foreach ( $ languageFiles as $ languageKey => $ filePath ) { $ filesResults [ $ fileName ] [ $ languageKey ] = $ this -> manager -> getFileContent ( $ filePath ) ; } } $ values = Arr :: dot ( $ filesResults ) ; $ emptyValues = array_filter ( $ values , function ( $ value ) { return $ value == '' ; } ) ; // Adding all keys that has values = '' foreach ( $ emptyValues as $ dottedValue => $ emptyValue ) { list ( $ fileName , $ languageKey , $ key ) = explode ( '.' , $ dottedValue , 3 ) ; $ missing [ ] = "{$fileName}.{$key}:{$languageKey}" ; } $ missing = array_merge ( $ missing , $ this -> manager -> getKeysExistingInALanguageButNotTheOther ( $ values ) ) ; return $ missing ; }
Get an array of keys that have missing values with a hint
from another language translation file if possible.

ex: [ ['key' => 'product.color.nl', 'hint' => 'en = "color"'] ]

@param array $languages
@return array
Get an array of keys that have missing values with a hint from another language translation file if possible .