private function loadMatchingFile($files, $lang) {
        // Check all file names
        foreach ($files as $file) {
            // Extract locale from filename
            $fileLocale = substr($file, 0, strlen($file) - 5);

            if (\Locale::filterMatches($lang, $fileLocale)) { // Check if filename matches $lang
                return array('dict' => $this->loadFile($file), 'lang' => $fileLocale);
            }
        }

        return null;
    }
private function loadMatchingFile($files, $lang) {
        // Check all file names
        foreach ($files as $file) {
            // Extract locale from filename
            $fileLocale = substr($file, 0, strlen($file) - 5);

            if (\Locale::filterMatches($lang, $fileLocale)) { // Check if filename matches $lang
                return array('dict' => $this->loadFile($file), 'lang' => $fileLocale);
            }
        }

        return null;
    }
private function loadMatchingFile ( $ files , $ lang ) { // Check all file names foreach ( $ files as $ file ) { // Extract locale from filename $ fileLocale = substr ( $ file , 0 , strlen ( $ file ) - 5 ) ; if ( \ Locale :: filterMatches ( $ lang , $ fileLocale ) ) { // Check if filename matches $lang return array ( 'dict' => $ this -> loadFile ( $ file ) , 'lang' => $ fileLocale ) ; } } return null ; }
Load the best dictionary looking at the language code given in parameter.

@param array $files The array of dictionary file names
@param string $lang The language code
@return array|null The dictionary found for the given language code, or null if there is no match.
Load the best dictionary looking at the language code given in parameter .