Liny_@NotePad

沉迷ACG中

汉化FreeTextBox v3.2

YOYO posted @ 2010年4月20日 22:00 in 【C#】 with tags 汉化 FreeTextBox asp.net , 2555 阅读

分成几个部分(工具栏控件、弹出页面、图像库)来,囧无比。

  • 工具栏控件的汉化:在FreeTextBox的Languages目录下,修改zh-cn.xml,然后在用FreeTextBox的地方设置Language属性为zh-cn。
     
  • 免费版控件弹出页面-Insert Table、Insert Link之类的:修改FTB-FreeTextBox.js,把里面相关英文字符改成中文,保存编码为UTF-8,注意不要把name、id、command之类的改错了。之后在引用FreeTextBox的地方改JavaScriptLocation属性为ExternalFile即可。…
     
  • 专业版控件弹出页面:FTB-Pro.js(因为不是专业版于是就没有汉化)
     
  • 图像库:修改FTB-ImageGallery.js即可。弹出页面的标题在ftb.imagegallery.aspx。其他的内容找不到,因此就在这个aspx文件的body里面加上onLoad="Init()“,使页面完全加载后调用Init方法来替换原来的文本,内容如下:
    //  汉化
    function Init() {
        //  提示信息
        var str = document.getElementById('img_feedback_message').value;
        
        if (str == "Image uploaded")
        {
            str = "图片上传成功";
        }
        else if (str == "Your permissions do not allow you do create directories")
        {
            str = "系统禁止创建新目录";
        }
        else if (str == "Your permissions do not allow you do create directories")
        {
            str = "系统禁止创建新目录";
        }
        else if (str == "Your permissions do not allow you do delete images")
        {
            str = "系统禁止删除图片";
        }
        
        document.getElementById('img_feedback_message').value = str;
    
        //  Gallery Top Start----------------------------------------------
        document.getElementById('GalleryTop').innerHTML = "<h3>图像库</h3>";    
        //  Gallery Top End----------------------------------------------
    
        //  Gallery SideBar Start----------------------------------------------
        document.getElementById('img_alt').style.width = "120px";
        document.getElementById('img_title').style.width = "120px";
        
        var str = document.getElementById('GallerySideBar').innerHTML;
        str = str.replace("Preview", "预览");
        
        str = str.replace("Dimensions", "位置");
        str = str.replace("Original Size", "原始大小");
        str = str.replace("Custom Size", "自定义大小");
        str = str.replace("Lock image ratio", "锁定比例");
        str = str.replace("Percentage", "百分比");
        
        str = str.replace("Properties", "属性");
        str = str.replace("Align</TD>", "排列</TD>");
        str = str.replace("NotSet", "默认");
        str = str.replace("Top", "顶端");
        str = str.replace("Bottom", "底部");
        str = str.replace("Left", "左对齐");
        str = str.replace("Right", "右对齐");
        str = str.replace("Center", "居中");
        str = str.replace("AbsMiddle", "绝对居中");
        
        str = str.replace("Border", "边框");
        str = str.replace("VSpace", "垂直间隔");
        str = str.replace("HSpace", "水平间隔");
        str = str.replace("Alt", "文本");
        str = str.replace("Title", "提示");
        
        str = str.replace("value=Insert", "value=插入图片");
        
        
        document.getElementById('GallerySideBar').innerHTML = str;    
        //  Gallery SideBar End----------------------------------------------
       
        //  Gallery Bottom Start----------------------------------------------
        document.getElementById('img_feedback_title').innerText = "状态";
    
        document.getElementById('command_DeleteImageButton').value = "删除图像";
        document.getElementById('command_UploadButton').value = "上传";
        document.getElementById('command_NewFolderButton').value = "创建文件夹";
       
        var row = document.getElementById('GalleryBottom');
        str = row.firstChild.innerHTML;
        
        str = str.replace("Upload File", "上传图片");
        str = str.replace("Create Folder", "创建文件夹");
        
        row.firstChild.innerHTML = str;
        //  Gallery Bottom End----------------------------------------------
    }

好累 Orz 才知道原来innerHTML对TR只读的。。一会笔记下。


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter