FreeTextBox中的ImageGallery汉化无错版

<%@ Page Language="C#" ValidateRequest="false" Trace="false" %>
<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
<%@ Import Namespace="System.IO" %>
<script runat="server">
protected void Page_Load(Object Src, EventArgs E) {

// *** remove this return statement to use the following code ***
return;

string currentFolder = ImageGallery1.CurrentImagesFolder;

// modify the directories allowed
if (currentFolder == "~/images") {

// these are the default directories FTB:ImageGallery will find
string[] defaultDirectories = System.IO.Directory.GetDirectories(Server.MapPath(currentFolder),"*");

// user defined custom directories
string[] customDirectories = new string[] {"folder1","folder2"};

// the gallery will use these images in this instance
ImageGallery1.CurrentDirectories = customDirectories;
}


// modify the images allowed
if (currentFolder == "~/images") {

System.IO.DirectoryInfo directoryInfo = new System.IO.DirectoryInfo(Server.MapPath(currentFolder));

// these are the default images FTB:ImageGallery will find
System.IO.FileInfo[] defaultImages = directoryInfo.GetFiles("*");

// user defined custom images (here, we're just allowing the first two)
System.IO.FileInfo[] customImages = new System.IO.FileInfo[2] {defaultImages[0], defaultImages[1]};

// the gallery will use these images in this instance
ImageGallery1.CurrentImages = customImages;
}

}


protected override void Render(HtmlTextWriter writer)
{
writer.Write(this.ChineseGallery());
}
private string ChineseGallery()
{
StringWriter writer = new StringWriter(); //提供一个可以写的文本区域
HtmlTextWriter buffer = new HtmlTextWriter(writer); //让htmlWriter操作这个区域,我们就可以获得这个区域里的内容
base.Render(buffer); //先让页面画一遍,让我们得到初始的页面html代码
string html = writer.ToString(); //找到这段代码,我们来处理它,把英文变成汉字
//
html=html.Replace("There are no images:","现在还没有图片");
html=html.Replace("Upload File","上传图片");
html=html.Replace("Status</div>","状态</div>");
html=html.Replace("Selected Image","选中的图片");
html=html.Replace("Create Folder","创建目录");
html=html.Replace("Delete Image","删除该图片");
html=html.Replace("\"Upload\"","'上传'");
html=html.Replace("<legend>Preview","<legend>预览图片");
html=html.Replace("<legend>Dimensions","<legend>设置显示尺寸");
html=html.Replace("Original Size","原图大小");
html=html.Replace("Custom Size","设置为");
html=html.Replace("Lock image ratio","锁定尺寸比例");
html=html.Replace("Percentage","百分比");
html=html.Replace("Image Gallery","我的像册");
html=html.Replace("<legend>Properties","<legend>图片属性");
html=html.Replace("Align","横向排列");
html=html.Replace("Border","边框");
html=html.Replace("VSpace","左边距");
html=html.Replace("HSpace","上边距");
html=html.Replace("Alt","转换文字");
html=html.Replace("Title","图片标题");
html=html.Replace("value=\"Insert\"","value='插入到编辑器中'");
//
return html;
}
</script>
<html xmlns=" http://www.w3.org/1999/xhtml" >
<head>
<title>Image Gallery</title>
</head>
<body>
<form id="Form1" runat="server" enctype="multipart/form-data">
<FTB:ImageGallery id="ImageGallery1"
JavaScriptLocation="InternalResource"
UtilityImagesLocation="InternalResource"
SupportFolder="../images/"
AllowImageDelete="true" AllowImageUpload="true" AllowDirectoryCreate="false" AllowDirectoryDelete="false" runat="Server" />
</form>
</body>
</html>

转载于:https://www.cnblogs.com/mgod/archive/2007/04/21/722265.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值