diff --git a/admin/common-en.lang.php b/admin/common-en.lang.php new file mode 100644 index 0000000..64786a9 --- /dev/null +++ b/admin/common-en.lang.php @@ -0,0 +1,5 @@ + diff --git a/admin/common-zh-simplified-utf-8.lang.php b/admin/common-zh-simplified-utf-8.lang.php new file mode 100644 index 0000000..7aa78c4 --- /dev/null +++ b/admin/common-zh-simplified-utf-8.lang.php @@ -0,0 +1,102 @@ + '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' + => '位置', + '' + => '', + '' + => '', + '' + => '', + '' + => '', + ); + diff --git a/admin/common.php b/admin/common.php new file mode 100644 index 0000000..46d5269 --- /dev/null +++ b/admin/common.php @@ -0,0 +1,70 @@ + '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 '' . htmlspecialchars($str) . ''; + } + 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")); + +?> diff --git a/admin/config.php.example b/admin/config.php.example index 79d7b54..0ff88ad 100644 --- a/admin/config.php.example +++ b/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; } diff --git a/admin/help-en.lang.php b/admin/help-en.lang.php new file mode 100644 index 0000000..1ac0c6c --- /dev/null +++ b/admin/help-en.lang.php @@ -0,0 +1,32 @@ +
+