Make Icinga\Util\Tranlsator not only return locale codes with encodings

refs #6602
This commit is contained in:
Johannes Meyer 2014-07-07 09:04:01 +02:00
parent e3b2f15863
commit b3cb29d804
1 changed files with 6 additions and 5 deletions

View File

@ -141,17 +141,18 @@ class Translator
public static function getAvailableLocaleCodes()
{
$codes = array();
$postfix = '.UTF-8';
foreach (array_values(self::$knownDomains) as $directory) {
$dh = opendir($directory);
while (false !== ($name = readdir($dh))) {
if (substr($name, 0, 1) === '.') continue;
if (substr($name, -6) !== $postfix) continue;
if (is_dir($directory . DIRECTORY_SEPARATOR . $name)) {
$codes[] = substr($name, 0, -6);
if (substr($name, 0, 1) !== '.'
&& false === in_array($name, $codes)
&& is_dir($directory . DIRECTORY_SEPARATOR . $name)
) {
$codes[] = $name;
}
}
}
return $codes;
}