汉化一下下松鼠邮件系统SquirrelMail

来源:互联网 发布:华东理工网络学生平台 编辑:程序博客网 时间:2024/04/26 06:16

架设了一个邮件服务器,使用SquirrelMail做为web平台,发现它的Drafts、Sent、Trash三个邮箱名还是英文的,太不专业了吧。上网查帮助,它在sourceforge的官方留言板上对这个问题回答如下:

3> how do I translate the "trash/sent/drafts" into
> Chinese (simplified), since there seems no entries for
> them in .po file.

This must be changed at configuration level. Go to conf.pl and change
the default folders names to whatever you like. This cannot be changed
with po because it depends on the IMAP server. The only folder that can
be renamed is the INBOX wich is a "system" name.

在另外一个论坛上,有个老外直接了当地回答说,这个问题是无法解决的。哼哼,我就不信改不过来~看我的:

因为左边的邮箱目录在left_main.php中,我打开它,增加一个function

// --Add by Anjo, 2006.9.3
function rename_subbox($mailboxstr, $oldname, $newname) {
    $len0=strlen($mailboxstr);
    $len1=strlen($oldname);
    if (strpos($mailboxstr, $oldname, $len0-$len1)==$len0-$len1) {
        return substr($mailboxstr, 0, $len0-$len1).$newname;
    }
    else
        return $mailboxstr;
}
// --end of Anjo's function

然后找到这一段

    if ($special_color) {
        $line .= "<font color=/"$color[11]/">";
    }
    if ( $mailbox == 'INBOX' ) {
        $line .= _("INBOX");
    } else {
        $line .= str_replace(array(' ','<','>'),array('&nbsp;','&lt;','&gt;'),$mailbox);
    }

在它后面加上:

    //-- By Anjo, for translate "Drafts", "Sent" and "Trush"
    $line = rename_subbox($line, "Drafts", "草稿箱");
    $line = rename_subbox($line, "Sent",   "发件箱");
    $line = rename_subbox($line, "Trash",  "回收站");

 引用自 http://www.ilikeblog.comtb.asp?id=930
原创粉丝点击