diff --git a/library/Icinga/Util/Translator.php b/library/Icinga/Util/Translator.php index 8d6e60e19..c2aeccddd 100644 --- a/library/Icinga/Util/Translator.php +++ b/library/Icinga/Util/Translator.php @@ -133,10 +133,19 @@ class Translator $codes = array(); foreach (array_values(self::$knownDomains) as $directory) { - $dh = opendir($directory); + if ($directory[0] === '.') continue; + + $dir = realpath($directory); + if (!is_dir($dir)) { + $dir = realpath($dir . '/LC_MESSAGES'); + if (!is_dir($dir)) continue; + } + $dh = opendir($dir); while (false !== ($name = readdir($dh))) { - if (!preg_match('@\.|\.\.@', $name) && is_dir($directory . DIRECTORY_SEPARATOR . $name)) { - $codes[] = $name; + if (substr($name, 0, 1) === '.') continue; + if ($name === 'LC_MESSAGES') continue; + if (is_dir($dir . DIRECTORY_SEPARATOR . $name)) { + $codes[] = substr($name, 0, strpos($name, '.')); } } }