public function scanLocales($sourceDir)
    {
        $locales = glob($sourceDir.'/*.txt');

        // Remove file extension and sort
        array_walk($locales, function (&$locale) { $locale = basename($locale, '.txt'); });

        // Remove non-locales
        $locales = array_filter($locales, function ($locale) {
            return preg_match('/^[a-z]{2}(_.+)?$/', $locale);
        });

        sort($locales);

        return $locales;
    }
public function scanLocales($sourceDir)
    {
        $locales = glob($sourceDir.'/*.txt');

        // Remove file extension and sort
        array_walk($locales, function (&$locale) { $locale = basename($locale, '.txt'); });

        // Remove non-locales
        $locales = array_filter($locales, function ($locale) {
            return preg_match('/^[a-z]{2}(_.+)?$/', $locale);
        });

        sort($locales);

        return $locales;
    }
public function scanLocales ( $ sourceDir ) { $ locales = glob ( $ sourceDir . '/*.txt' ) ; // Remove file extension and sort array_walk ( $ locales , function ( & $ locale ) { $ locale = basename ( $ locale , '.txt' ) ; } ) ; // Remove non-locales $ locales = array_filter ( $ locales , function ( $ locale ) { return preg_match ( '/^[a-z]{2}(_.+)?$/' , $ locale ) ; } ) ; sort ( $ locales ) ; return $ locales ; }
Returns all locales found in the given directory.

@param string $sourceDir The directory with ICU files

@return array An array of locales. The result also contains locales that
are in fact just aliases for other locales. Use
{@link scanAliases()} to determine which of the locales
are aliases
Returns all locales found in the given directory .