1
0
Fork 0

refactor: move lang files to sub folder

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1099 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
This commit is contained in:
Xuefer 2012-08-01 06:47:18 +00:00
parent 055c34799e
commit 3a65e13806
17 changed files with 15 additions and 14 deletions

View File

@ -2,4 +2,6 @@
require_once "../common/common.php";
include get_language_file("cacher");
include get_language_file("./lang");
$module = "cacher";

View File

@ -36,8 +36,6 @@ else {
}
}
$module = "cacher";
include "edit.tpl.php";
?>

View File

@ -253,7 +253,6 @@ function getEntryList() // {{{
}
// }}}
$module = "cacher";
xcache_count(XC_TYPE_PHP); // trigger auth
if (!extension_loaded('XCache')) {
header("Location: ../diagnosis");

View File

@ -85,7 +85,7 @@ function xcache_validateFileName($name)
return preg_match('!^[a-zA-Z0-9._-]+$!', $name);
}
function get_language_file_ex($name, $lang)
function get_language_file_ex($dir, $lang)
{
static $langMap = array(
'zh' => 'zh-simplified',
@ -100,22 +100,22 @@ function get_language_file_ex($name, $lang)
return null;
}
$file = "$name-$lang.lang.php";
$file = "$dir/$lang.php";
if (file_exists($file)) {
return $file;
}
return null;
}
function get_language_file($name)
function get_language_file($dir)
{
global $config;
if (!empty($config['lang'])) {
$lang = strtolower($config['lang']);
$file = get_language_file_ex($name, $lang);
$file = get_language_file_ex($dir, $lang);
if (!isset($file)) {
$lang = strtok($lang, ':-');
$file = get_language_file_ex($name, $lang);
$file = get_language_file_ex($dir, $lang);
}
}
else {
@ -124,13 +124,13 @@ function get_language_file($name)
if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
foreach (explode(',', str_replace(' ', '', $_SERVER['HTTP_ACCEPT_LANGUAGE'])) as $lang) {
$lang = strtok($lang, ':;');
$file = get_language_file_ex($name, $lang);
$file = get_language_file_ex($dir, $lang);
if (isset($file)) {
$config['lang'] = $lang;
break;
}
if (strpos($lang, '-') !== false) {
$file = get_language_file_ex($name, strtok($lang, ':-'));
$file = get_language_file_ex($dir, strtok($lang, ':-'));
if (isset($file)) {
$config['lang'] = $lang;
break;
@ -139,7 +139,7 @@ function get_language_file($name)
}
}
}
return isset($file) ? $file : "$name-en.lang.php";
return isset($file) ? $file : "$dir/en.php";
}
function _T($str)
@ -260,7 +260,7 @@ if (file_exists("./config.php")) {
}
$strings = array();
include get_language_file("../common/common");
include get_language_file("../common/lang");
$modules = array();
if (file_exists("../cacher/index.php")) {

View File

@ -2,6 +2,6 @@
require_once "../common/common.php";
include get_language_file("coverager");
include get_language_file("./lang");
$module = "coverager";

View File

@ -1,6 +1,8 @@
<?php
include "../common/common.php";
include get_language_file("./lang");
$knownUnstablePhpVersions = array(
array('=', '5.3.14', 'random corrupt memory on high concurrent'),
);

View File

View File