Browse Source

refactor: move lang files to sub folder

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1099 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 9 years ago
parent
commit
3a65e13806
  1. 4
      htdocs/cacher/common.php
  2. 2
      htdocs/cacher/edit.php
  3. 1
      htdocs/cacher/index.php
  4. 0
      htdocs/cacher/lang/en.php
  5. 0
      htdocs/cacher/lang/zh-simplified.php
  6. 0
      htdocs/cacher/lang/zh-traditional.php
  7. 18
      htdocs/common/common.php
  8. 0
      htdocs/common/lang/en.php
  9. 0
      htdocs/common/lang/zh-simplified.php
  10. 0
      htdocs/common/lang/zh-traditional.php
  11. 2
      htdocs/coverager/common.php
  12. 0
      htdocs/coverager/lang/en.php
  13. 0
      htdocs/coverager/lang/zh-simplified.php
  14. 2
      htdocs/diagnosis/index.php
  15. 0
      htdocs/diagnosis/lang/en.php
  16. 0
      htdocs/diagnosis/lang/zh-simplified.php
  17. 0
      htdocs/diagnosis/lang/zh-tranditional.php

4
htdocs/cacher/common.php

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

2
htdocs/cacher/edit.php

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

1
htdocs/cacher/index.php

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

0
htdocs/cacher/cacher-en.lang.php → htdocs/cacher/lang/en.php

0
htdocs/cacher/cacher-zh-simplified.lang.php → htdocs/cacher/lang/zh-simplified.php

0
htdocs/cacher/cacher-zh-traditional.lang.php → htdocs/cacher/lang/zh-traditional.php

18
htdocs/common/common.php

@ -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")) {

0
htdocs/common/common-en.lang.php → htdocs/common/lang/en.php

0
htdocs/common/common-zh-simplified.lang.php → htdocs/common/lang/zh-simplified.php

0
htdocs/common/common-zh-traditional.lang.php → htdocs/common/lang/zh-traditional.php

2
htdocs/coverager/common.php

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

0
htdocs/coverager/coverager-en.lang.php → htdocs/coverager/lang/en.php

0
htdocs/coverager/coverager-zh-simplified.lang.php → htdocs/coverager/lang/zh-simplified.php

2
htdocs/diagnosis/index.php

@ -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'),
);

0
htdocs/diagnosis/lang/en.php

0
htdocs/diagnosis/lang/zh-simplified.php

0
htdocs/diagnosis/lang/zh-tranditional.php

Loading…
Cancel
Save