Example #1
0
/**
 * T
 * 多语言实现,翻译函数
 * @param w    默认语言的词语
 */
function T($w)
{
    $method = $GLOBALS['G_Fei']["lang"][FeiController::getLang()];
    if (!isset($method) || 'default' == $method) {
        return $w;
    } elseif (function_exists($method)) {
        return ($tmp = call_user_func($method, $w)) ? $tmp : $w;
    } elseif (is_array($method)) {
        return ($tmp = FeiClass($method[0])->{$method[1]}($w)) ? $tmp : $w;
    } elseif (file_exists($method)) {
        $dict = (require $method);
        return isset($dict[$w]) ? $dict[$w] : $w;
    } else {
        return $w;
    }
}