Util\Translator: show correct language list
List was showing useless stuff such as LC_MESSAGES and no language but the default one. We should have a look whether LC_MESSAGES is really needed, it looks so ugly.
This commit is contained in:
parent
408c15b8fb
commit
b7521f48b9
|
@ -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, '.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue