Make Icinga\Util\Tranlsator not only return locale codes with encodings
refs #6602
This commit is contained in:
parent
e3b2f15863
commit
b3cb29d804
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue