Fix #277 Incorrect priority when loading old lang files

This commit is contained in:
Kijin Sung 2016-02-24 10:37:16 +09:00
parent 87a3128af6
commit 0b339a9450
2 changed files with 5 additions and 9 deletions

View file

@ -70,7 +70,7 @@ class LangParser
unset($xml); unset($xml);
// Save the array as a cache file. // Save the array as a cache file.
$buff = "<?php\n"; $buff = "<?php\n// $filename\n";
foreach ($lang as $key => $value) foreach ($lang as $key => $value)
{ {
if (is_array($value)) if (is_array($value))

View file

@ -102,25 +102,21 @@ class Lang
{ {
$filename = $dir . '/' . $this->_language . '.php'; $filename = $dir . '/' . $this->_language . '.php';
} }
elseif (file_exists($dir . '/' . ($this->_language === 'ja' ? 'jp' : $this->_language) . '.lang.php'))
{
$filename = $dir . '/' . ($this->_language === 'ja' ? 'jp' : $this->_language) . '.lang.php';
}
elseif (($hyphen = strpos($this->_language, '-')) !== false) elseif (($hyphen = strpos($this->_language, '-')) !== false)
{ {
if (file_exists($dir . '/' . substr($this->_language, 0, $hyphen) . '.php')) if (file_exists($dir . '/' . substr($this->_language, 0, $hyphen) . '.php'))
{ {
$filename = $dir . '/' . substr($this->_language, 0, $hyphen) . '.php'; $filename = $dir . '/' . substr($this->_language, 0, $hyphen) . '.php';
} }
elseif (file_exists($dir . '/' . substr($this->_language, 0, $hyphen) . '.lang.php'))
{
$filename = $dir . '/' . substr($this->_language, 0, $hyphen) . '.lang.php';
}
} }
elseif (file_exists("$dir/lang.xml")) elseif (file_exists("$dir/lang.xml"))
{ {
$filename = Compat\LangParser::compileXMLtoPHP("$dir/lang.xml", $this->_language === 'ja' ? 'jp' : $this->_language); $filename = Compat\LangParser::compileXMLtoPHP("$dir/lang.xml", $this->_language === 'ja' ? 'jp' : $this->_language);
} }
elseif (file_exists($dir . '/' . ($this->_language === 'ja' ? 'jp' : $this->_language) . '.lang.php'))
{
$filename = $dir . '/' . ($this->_language === 'ja' ? 'jp' : $this->_language) . '.lang.php';
}
// Load the language file. // Load the language file.
if ($filename) if ($filename)