Browse Source

Chinese translation for admin page

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@123 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
1.1
Xuefer 15 years ago
parent
commit
52ec514422
  1. 5
      admin/common-en.lang.php
  2. 102
      admin/common-zh-simplified-utf-8.lang.php
  3. 70
      admin/common.php
  4. 7
      admin/config.php.example
  5. 32
      admin/help-en.lang.php
  6. 32
      admin/help-zh-simplified-utf-8.lang.php
  7. 47
      admin/help.php
  8. 3
      admin/xcache.css
  9. 11
      admin/xcache.php
  10. 72
      admin/xcache.tpl.php

5
admin/common-en.lang.php

@ -0,0 +1,5 @@
<?php
// empty
?>

102
admin/common-zh-simplified-utf-8.lang.php

@ -0,0 +1,102 @@
<?php
$strings = array(
'Cache Legends'
=> 'Cache 帮助',
'List Legends'
=> 'List 帮助',
'XCache Administration Help'
=> 'XCache 管理页面帮助信息',
'Help'
=> '帮助',
'Slots'
=> '槽',
'Size'
=> '大小',
'Avail'
=> '剩余',
'Used'
=> '已用',
'Clear'
=> '清除',
'Sure to clear?'
=> '确认要清除吗?',
'Compiling'
=> '编译中',
'%'
=> '%',
'Hits'
=> '命中',
'Misses'
=> '错过',
'Clogs'
=> '阻塞',
'OOMs'
=> '内存不足',
'Protected'
=> '保护',
'Cached'
=> '缓存',
'Deleted'
=> '待删',
'Delete'
=> '删除',
'Free Blocks'
=> '空闲块',
'entry'
=> '项目',
'Refcount'
=> '引用数',
'SrcSize'
=> '源大小',
'Modify'
=> '修改',
'device'
=> '设备',
'inode'
=> 'Inode',
'Access'
=> '访问',
'Create'
=> '创建',
'See also'
=> '建议参考',
'GC'
=> 'GC',
'Cache'
=> '缓冲区',
'Caches'
=> '缓冲区',
'Cached'
=> '缓冲',
'php Cached'
=> '缓冲的 php 脚本',
'php Deleted'
=> '待删 php 脚本',
'var Cached'
=> '缓冲的变量',
'var Deleted'
=> '待删变量',
'Statistics'
=> '摘要统计',
'List PHP'
=> '列出PHP',
'List Var Data'
=> '列变量数据',
'XCache %s Administration'
=> 'XCache %s 管理页面',
'size'
=> '大小',
'offset'
=> '位置',
''
=> '',
''
=> '',
''
=> '',
''
=> '',
);

70
admin/common.php

@ -0,0 +1,70 @@
<?php
function get_language_file_ex($name, $l, $s)
{
static $map = array(
'zh' => 'zh-simplified',
'zh-hk' => 'zh-traditional',
'zh-tw' => 'zh-traditional',
);
if (isset($map[$l])) {
$l = $map[$l];
}
if (file_exists($file = "$name-$l-$s.lang.php")) {
return $file;
}
if (file_exists($file = "$name-$l.lang.php")) {
return $file;
}
return null;
}
function get_language_file($name)
{
global $charset, $lang;
$s = strtolower($charset);
if (isset($lang)) {
$file = get_language_file_ex($name, strtolower($lang), $s);
}
else if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
foreach (explode(',', str_replace(' ', '', $_SERVER['HTTP_ACCEPT_LANGUAGE'])) as $l) {
$l = strtok($l, ';');
$file = get_language_file_ex($name, $l, $s);
if (isset($file)) {
break;
}
if (strpos($l, '-') !== false) {
$l = strtok($l, '-');
$file = get_language_file_ex($name, $l, $s);
if (isset($file)) {
break;
}
}
}
}
return isset($file) ? $file : "$name-en.lang.php";
}
function _T($str)
{
if (isset($GLOBALS['strings'][$str])) {
return $GLOBALS['strings'][$str];
}
if (!empty($GLOBALS['show_todo_strings'])) {
return '<span style="color:red">' . htmlspecialchars($str) . '</span>';
}
return $str;
}
error_reporting(E_ALL);
define('REQUEST_TIME', time());
$charset = "UTF-8";
if (file_exists("./config.php")) {
include("./config.php");
}
include(get_language_file("common"));
?>

7
admin/config.php.example

@ -3,12 +3,19 @@
// this is an example only
// write your own config and name it as config.php
// detected by browser
// $lang = 'en-us';
$charset = "UTF-8";
// developers only
$show_todo_strings = false;
// this function is detected by xcache.tpl.php, and enabled if function_exists
// this ob filter is applied for the cache list, not the whole page
function ob_filter_path_nicer($o)
{
$o = str_replace($_SERVER['DOCUMENT_ROOT'], "{DOCROOT}/", $o);
$o = str_replace("/home/", "{H}/", $o);
return $o;
}

32
admin/help-en.lang.php

@ -0,0 +1,32 @@
<h2><?php echo _T('Cache Legends'); ?></h2>
<dl>
<dt><?php echo _T('Slots'); ?>: </dt><dd>Number of hash slots. the setting from your php.ini</dd>
<dt><?php echo _T('Size'); ?>: </dt><dd>Cache Size, Size of the cache (or cache chunk), in bytes</dd>
<dt><?php echo _T('Avail'); ?>: </dt><dd>Available Memory, free memory in bytes of this cache</dd>
<dt><?php echo _T('%'); ?>: </dt><dd>Percent, A bar shows how much memory available in percent</dd>
<dt><?php echo _T('Clear'); ?>: </dt><dd>Clear Button, Press the button to clean this cache</dd>
<dt><?php echo _T('Compiling'); ?>: </dt><dd>Compiling flag, "yes" if the cache is busy compiling php script</dd>
<dt><?php echo _T('Hits'); ?>: </dt><dd>Cache Hits, hit=a var/php is loaded from this cache</dd>
<dt><?php echo _T('Misses'); ?>: </dt><dd>Cache Misses, miss=a var/php is requested but not in the cache</dd>
<dt><?php echo _T('Clogs'); ?>: </dt><dd>Compiling Clogs, clog=compiling is needed but avoided to wait(be blocked) when the cache is busy compiling already</dd>
<dt><?php echo _T('OOMs'); ?>: </dt><dd>Out Of Memory, how many times a new item should be stored but there isn't enough memory in the cache, think of increasing the xcache.size or xcache.var_size</dd>
<dt><?php echo _T('Protected'); ?>: </dt><dd>Whether <a href="http://trac.lighttpd.net/xcache/wiki/ReadonlyProtection">readonly_protection</a> is available and enable on this cache</dd>
<dt><?php echo _T('Cached'); ?>: </dt><dd>Number of entries stored in this cache</dd>
<dt><?php echo _T('Deleted'); ?>: </dt><dd>Number of entries is pending in delete list (expired but referenced)</dd>
<dt><?php echo _T('GC'); ?>: </dt><dd>Seconds count down of Garbage Collection</dd>
<dt><?php echo _T('Free Blocks'); ?>: </dt><dd>Free blocks list in the specified cache</dd>
</dl>
<h2><?php echo _T('List Legends'); ?></h2>
<dl>
<dt><?php echo _T('entry'); ?>: </dt><dd>The entry name or filename</dd>
<dt><?php echo _T('Hits'); ?>: </dt><dd>Times this entry is hit (loaded from this cache)</dd>
<dt><?php echo _T('Refcount'); ?>: </dt><dd>Reference count this entry is holded by a php request</dd>
<dt><?php echo _T('Size'); ?>: </dt><dd>Size in bytes of this entry in the cache</dd>
<dt><?php echo _T('SrcSize'); ?>: </dt><dd>Size of the source file</dd>
<dt><?php echo _T('Modify'); ?>: </dt><dd>Last modified time of the source file</dd>
<dt><?php echo _T('device'); ?>: </dt><dd>device number of the source file</dd>
<dt><?php echo _T('inode'); ?>: </dt><dd>inode number of the source file</dd>
<dt><?php echo _T('Access'); ?>: </dt><dd>Last access time of the cached entry</dd>
<dt><?php echo _T('Create'); ?>: </dt><dd>The time when this entry is stored</dd>
</dl>

32
admin/help-zh-simplified-utf-8.lang.php

@ -0,0 +1,32 @@
<h2><?php echo _T('Cache Legends'); ?></h2>
<dl>
<dt><?php echo _T('Slots'); ?>: </dt><dd>Hash 槽个数, 对应 php.ini 里的设置</dd>
<dt><?php echo _T('Size'); ?>: </dt><dd>共享内存区大小, 单位: 字节</dd>
<dt><?php echo _T('Avail'); ?>: </dt><dd>可用内存, 对应共享内存区的剩余内存字节数</dd>
<dt><?php echo _T('%'); ?>: </dt><dd>百分比, 条状显示可用内存的比例</dd>
<dt><?php echo _T('Clear'); ?>: </dt><dd>清除按钮, 点击按钮清除对应共享内存区的数据</dd>
<dt><?php echo _T('Compiling'); ?>: </dt><dd>编译标记, 当共享内存区正在编译 php 脚本时标记为 "yes"</dd>
<dt><?php echo _T('Hits'); ?>: </dt><dd>共享内存命中次数, 命中=从该共享内存载入php或者变量</dd>
<dt><?php echo _T('Misses'); ?>: </dt><dd>共享内存错过次数, 错过=请求的php或者变量并不在该共享内存内</dd>
<dt><?php echo _T('Clogs'); ?>: </dt><dd>编译阻塞跳过, 阻塞=当需该共享内存区负责编译时, 其他进程/现成无法访问此共享内存. 跳过=XCache 自动判断阻塞的共享内存区自动跳过阻塞等待, 直接使用非共享内存方式继续处理请求</dd>
<dt><?php echo _T('OOMs'); ?>: </dt><dd>内存不足次数, 显示需要存储新数据但是共享内存区内存不足的次数. 如果出现太频繁请考虑加大配置中的 xcache.size 或者 xcache.var_size</dd>
<dt><?php echo _T('Protected'); ?>: </dt><dd>显示该 Cache 是否支持并启用 <a href="http://trac.lighttpd.net/xcache/wiki/ReadonlyProtection">readonly_protection</a></dd>
<dt><?php echo _T('Cached'); ?>: </dt><dd>共享内存于该共享内存区的项目条数</dd>
<dt><?php echo _T('Deleted'); ?>: </dt><dd>共享内存区内将要删除的项目 (已经删除但是还被某些进程占用)</dd>
<dt><?php echo _T('GC'); ?>: </dt><dd>垃圾回收的倒计时</dd>
<dt><?php echo _T('Free Blocks'); ?>: </dt><dd>共享内存区内的空闲内存块</dd>
</dl>
<h2><?php echo _T('List Legends'); ?></h2>
<dl>
<dt><?php echo _T('entry'); ?>: </dt><dd>项目名或者文件名</dd>
<dt><?php echo _T('Hits'); ?>: </dt><dd>该项目被命中的次数 (从共享内存区载入)</dd>
<dt><?php echo _T('Refcount'); ?>: </dt><dd>项目依然被其他进程占据的引用次数</dd>
<dt><?php echo _T('Size'); ?>: </dt><dd>项目在共享内存里占用字节数</dd>
<dt><?php echo _T('SrcSize'); ?>: </dt><dd>源文件大小</dd>
<dt><?php echo _T('Modify'); ?>: </dt><dd>源文件最后修改时间</dd>
<dt><?php echo _T('device'); ?>: </dt><dd>源文件所在设备ID</dd>
<dt><?php echo _T('inode'); ?>: </dt><dd>源文件的inode</dd>
<dt><?php echo _T('Access'); ?>: </dt><dd>最后访问该项目的时间</dd>
<dt><?php echo _T('Create'); ?>: </dt><dd>该项目被创建于共享内的时间</dd>
</dl>

47
admin/help.php

@ -1,8 +1,5 @@
<?php
$charset = "UTF-8";
if (file_exists("./config.php")) {
include("./config.php");
}
include("./common.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@ -11,12 +8,13 @@ if (file_exists("./config.php")) {
<?php
echo <<<HEAD
<meta http-equiv="Content-Type" content="text/html; charset=$charset" />
<meta http-equiv="Content-Language" content="$lang" />
<script type="text/javascript" src="tablesort.js" charset="$charset"></script>
HEAD;
?>
<link rel="stylesheet" type="text/css" href="xcache.css" />
<title>XCache Administration Help</title>
<title><?php echo _T('XCache Administration Help'); ?></title>
<script>
function toggle(o)
{
@ -26,44 +24,11 @@ HEAD;
</head>
<body>
<h1>XCache Administration Help</h1>
<a href="javascript:" onclick="toggle(document.getElementById('help'));return false" style="display:block; float: right">Help</a>
<h1><?php echo _T('XCache Administration Help'); ?></h1>
<div id1="help">
<h2>Cache Legends</h2>
<pre>
<b>Slots: </b>Number of hash slots. the setting from your php.ini
<b>Size: </b>Cache Size, Size of the cache (or cache chunk), in bytes
<b>Avail: </b>Available Memory, free memory in bytes of this cache
<b>Used: </b>Used Percent, A bar shows how much memory used in percent
<b>Clear: </b>Clear Button, Press the button to clean this cache
<b>Compiling: </b>Compiling flag, "yes" if the cache is busy compiling php script
<b>Hits: </b>Cache Hits, hit=a var/php is loaded from this cache
<b>Misses: </b>Cache Misses, miss=a var/php is requested but not in the cache
<b>Clogs: </b>Compiling Clogs, clog=compiling is needed but avoided to wait(be blocked)
when the cache is busy compiling already
<b>OOMs: </b>Out Of Memory, how many times a new item should be stored but there isn't
enough memory in the cache, think of increasing the xcache.size or xcache.var_size
<b>Protected: </b>Whether readonly_protection is available and enable on this cache
<b>Cached: </b>Number of entries stored in this cache
<b>Deleted: </b>Number of entries is pending in delete list (expired but referenced)
<b>Free Blocks:</b>Free blocks list in the specified cache
</pre>
<h2>List Legends</h2>
<pre>
<b>entry: </b>The entry name or filename
<b>Hits: </b>Times this entry is hit (loaded from this cache)
<b>Refcount: </b>Reference count this entry is holded by a php request
<b>Size: </b>Size in bytes of this entry in the cache
<b>SrcSize: </b>Size of the source file
<b>Modify: </b>Last modified time of the source file
<b>device: </b>device number of the source file
<b>inode: </b>inode number of the source file
<b>Access: </b>Last access time of the cached entry
<b>Create: </b>The time when this entry is stored
</pre>
<?php include(get_language_file("help")); ?>
</div>
See also: <a href="http://trac.lighttpd.net/xcache/wiki/PhpIni">setting php.ini for XCache</a> in the <a href="http://trac.lighttpd.net/xcache/">XCache wiki</a>
<?php echo _T('See also'); ?>: <a href="http://trac.lighttpd.net/xcache/wiki/PhpIni">setting php.ini for XCache</a> in the <a href="http://trac.lighttpd.net/xcache/">XCache wiki</a>
</body>
</html>

3
admin/xcache.css

@ -18,3 +18,6 @@ form {margin: 0; padding: 0}
.switcher a.active { font-weight: bold; font-size: 130%; color: black; }
#help { display: block; float: right; }
.footnote { text-align: right; font-size: 12px; }
dl { overflow: hidden; }
dt { font-weight: bold; clear: both; float: left; width: 100px; text-align: right; margin: 0; }
dd { margin: 0; }

11
admin/xcache.php

@ -1,7 +1,6 @@
<?php
error_reporting(E_ALL);
define('REQUEST_TIME', time());
include("./common.php");
class Cycle
{
@ -83,12 +82,6 @@ function switcher($name, $options)
return implode(' ', $html);
}
$charset = "UTF-8";
if (file_exists("config.php")) {
include("config.php");
}
$pcnt = xcache_count(XC_TYPE_PHP);
$vcnt = xcache_count(XC_TYPE_VAR);
@ -188,7 +181,7 @@ default:
$type_php = XC_TYPE_PHP;
$type_var = XC_TYPE_VAR;
$types = array($type_none => 'Statistics', $type_php =>'List PHP', $type_var =>'List Var Data');
$types = array($type_none => _T('Statistics'), $type_php => _T('List PHP'), $type_var => _T('List Var Data'));
$xcache_version = XCACHE_VERSION;
$xcache_modules = XCACHE_MODULES;

72
admin/xcache.tpl.php

@ -10,18 +10,18 @@ HEAD;
?>
<link rel="stylesheet" type="text/css" href="xcache.css" />
<title>XCache <?php echo $xcache_version; ?> Administration</title>
<title><?php echo sprintf(_T("XCache %s Administration"), $xcache_version); ?></title>
</head>
<body>
<h1>XCache <?php echo $xcache_version; ?> Administration</h1>
<a href="help.php" target="_blank" id="help">Help &raquo;</a>
<h1><?php echo sprintf(_T("XCache %s Administration"), $xcache_version); ?></h1>
<a href="help.php" target="_blank" id="help"><?php echo _T("Help") ?> &raquo;</a>
<span class="switcher"><?php echo switcher("type", $types); ?></span>
<?php
$a = new Cycle('class="col1"', 'class="col2"');
$b = new Cycle('class="col1"', 'class="col2"');
?>
Caches:
<?php echo _T('Caches'); ?>:
<table cellspacing="0" cellpadding="4" class="cycles">
<col />
<col align="right" />
@ -40,23 +40,25 @@ Caches:
<col />
<tr <?php echo $a->next(); ?>>
<th>-</th>
<th>Slots</th>
<th>Size</th>
<th>Avail</th>
<th>%</th>
<th>Clear</th>
<th>Compiling</th>
<th>Hits</th>
<th>Misses</th>
<th>Clogs</th>
<th>OOMs</th>
<th>Protected</th>
<th>Cached</th>
<th>Deleted</th>
<th>GC</th>
<th><?php echo _T('Slots'); ?></th>
<th><?php echo _T('Size'); ?></th>
<th><?php echo _T('Avail'); ?></th>
<th><?php echo _T('%'); ?></th>
<th><?php echo _T('Clear'); ?></th>
<th><?php echo _T('Compiling'); ?></th>
<th><?php echo _T('Hits'); ?></th>
<th><?php echo _T('Misses'); ?></th>
<th><?php echo _T('Clogs'); ?></th>
<th><?php echo _T('OOMs'); ?></th>
<th><?php echo _T('Protected'); ?></th>
<th><?php echo _T('Cached'); ?></th>
<th><?php echo _T('Deleted'); ?></th>
<th><?php echo _T('GC'); ?></th>
</tr>
<?php
$numkeys = explode(',', 'hits,misses,clogs,ooms,cached,deleted');
$l_clear = _T('Clear');
$l_clear_confirm = _T('Sure to clear?');
foreach ($cacheinfos as $i => $ci) {
echo "
<tr ", $a->next(), " height=\"20\">";
@ -80,7 +82,7 @@ Caches:
<div>
<input type="hidden" name="type" value="{$ci['type']}">
<input type="hidden" name="cacheid" value="{$ci['cacheid']}">
<input type="submit" name="clearcache" value="Clear" class="submit" onclick="return confirm('Sure to clear?');" />
<input type="submit" name="clearcache" value="{$l_clear}" class="submit" onclick="return confirm('{$l_clear_confirm}');" />
</div>
</form>
</td>
@ -100,14 +102,14 @@ EOS;
</tr>
<?php } ?>
</table>
Free Blocks:
<?php echo _T('Free Blocks'); ?>:
<?php
foreach ($cacheinfos as $i => $ci) {
$b->reset();
?>
<table cellspacing="0" cellpadding="4" class="cycles freeblocks">
<tr>
<th><?php echo $ci['cache_name']; ?> size<br>offset</th>
<th><?php echo $ci['cache_name']; ?> <?php echo _T("size"); ?><br><?php echo _T("offset"); ?></th>
<?php
foreach ($ci['free_blocks'] as $block) {
$size = size($block['size']);
@ -135,7 +137,7 @@ if ($cachelist) {
foreach (array('Cached' => $cachelist['cache_list'], 'Deleted' => $cachelist['deleted_list']) as $listname => $entries) {
$a->reset();
echo "
<caption>{$cachelist['type_name']} $listname</caption>";
<caption>", _T("{$cachelist['type_name']} $listname"), "</caption>";
?>
<table cellspacing="0" cellpadding="4" class="cycles entrys" width="100%">
@ -161,23 +163,23 @@ if ($cachelist) {
<tr ", $a->next(), ">";
?>
<th><a href="javascript:" onclick="resort(this); return false">Cache</a></th>
<th><a href="javascript:" onclick="resort(this); return false">entry</a></th>
<th><a href="javascript:" onclick="resort(this); return false">Hits</a></th>
<th><a href="javascript:" onclick="resort(this); return false">Ref count</a></th>
<th><a href="javascript:" onclick="resort(this); return false">Size</a></th>
<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Cache'); ?></a></th>
<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('entry'); ?></a></th>
<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Hits'); ?></a></th>
<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Refcount'); ?></a></th>
<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Size'); ?></a></th>
<?php if ($isphp) { ?>
<th><a href="javascript:" onclick="resort(this); return false">SrcSize</a></th>
<th><a href="javascript:" onclick="resort(this); return false">Modify</a></th>
<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('SrcSize'); ?></a></th>
<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Modify'); ?></a></th>
<?php if ($haveinode) { ?>
<th><a href="javascript:" onclick="resort(this); return false">device</a></th>
<th><a href="javascript:" onclick="resort(this); return false">inode</a></th>
<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('device'); ?></a></th>
<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('inode'); ?></a></th>
<?php } ?>
<?php } ?>
<th><a href="javascript:" onclick="resort(this); return false">Access</a></th>
<th><a href="javascript:" onclick="resort(this); return false">Create</a></th>
<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Access'); ?></a></th>
<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Create'); ?></a></th>
<?php if ($listname == 'Deleted') { ?>
<th><a href="javascript:" onclick="resort(this); return false">Delete</a></th>
<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Delete'); ?></a></th>
<?php } ?>
</tr>
<?php
@ -244,7 +246,7 @@ ENTRY;
?>
<div class="footnote">
<?php echo <<<EOS
Powered By: {$xcache_version}, {$xcache_modules}
Powered By: XCache {$xcache_version}, {$xcache_modules}
EOS;
?>
</div>

Loading…
Cancel
Save