protected function findLocaleChain(I18n\Locale $locale, $directoryPath)
    {
        $filesInHierarchy = [Files::concatenatePaths([$directoryPath, (string)$locale . '.xml'])];

        $localeIdentifier = (string)$locale;
        while ($localeIdentifier = substr($localeIdentifier, 0, (int)strrpos($localeIdentifier, '_'))) {
            $possibleFilename = Files::concatenatePaths([$directoryPath, $localeIdentifier . '.xml']);
            if (file_exists($possibleFilename)) {
                array_unshift($filesInHierarchy, $possibleFilename);
            }
        }
        array_unshift($filesInHierarchy, Files::concatenatePaths([$directoryPath, 'root.xml']));

        return $filesInHierarchy;
    }
protected function findLocaleChain(I18n\Locale $locale, $directoryPath)
    {
        $filesInHierarchy = [Files::concatenatePaths([$directoryPath, (string)$locale . '.xml'])];

        $localeIdentifier = (string)$locale;
        while ($localeIdentifier = substr($localeIdentifier, 0, (int)strrpos($localeIdentifier, '_'))) {
            $possibleFilename = Files::concatenatePaths([$directoryPath, $localeIdentifier . '.xml']);
            if (file_exists($possibleFilename)) {
                array_unshift($filesInHierarchy, $possibleFilename);
            }
        }
        array_unshift($filesInHierarchy, Files::concatenatePaths([$directoryPath, 'root.xml']));

        return $filesInHierarchy;
    }
protected function findLocaleChain ( I18n \ Locale $ locale , $ directoryPath ) { $ filesInHierarchy = [ Files :: concatenatePaths ( [ $ directoryPath , ( string ) $ locale . '.xml' ] ) ] ; $ localeIdentifier = ( string ) $ locale ; while ( $ localeIdentifier = substr ( $ localeIdentifier , 0 , ( int ) strrpos ( $ localeIdentifier , '_' ) ) ) { $ possibleFilename = Files :: concatenatePaths ( [ $ directoryPath , $ localeIdentifier . '.xml' ] ) ; if ( file_exists ( $ possibleFilename ) ) { array_unshift ( $ filesInHierarchy , $ possibleFilename ) ; } } array_unshift ( $ filesInHierarchy , Files :: concatenatePaths ( [ $ directoryPath , 'root.xml' ] ) ) ; return $ filesInHierarchy ; }
Returns absolute paths to CLDR files connected in hierarchy

For given locale, many CLDR files have to be merged in order to get full
set of CLDR data. For example, for 'en_GB' locale, files 'root', 'en',
and 'en_GB' should be merged.

@param I18n\Locale $locale A locale
@param string $directoryPath Relative path to existing CLDR directory which contains one file per locale (see 'main' directory in CLDR for example)
@return array<string> Absolute paths to CLDR files in hierarchy
Returns absolute paths to CLDR files connected in hierarchy