当前位置: 代码迷 >> ASP.NET >> 有用过 .net 的本地化 的大哥们来看看.该如何处理
  详细解决方案

有用过 .net 的本地化 的大哥们来看看.该如何处理

热度:392   发布时间:2013-02-25 00:00:00.0
有用过 .net 的本地化 的大哥们来看看.
ASP.net做多语言网站.关于本地资源的图片处理.   我在网上看到这个源码.

页面中的调用方法:

<ASP:Image   ID= "Image1 "   runat= "server "   ImageUrl= "~/   MyLocalImage.ashx "   />

MyLocalImage.ashx   的处理程序的写法:

public   class   MyLocalImage   :   IHttpHandler  
{
              public   void   ProcessRequest   (HttpContext   context)  
              {
                        context.Response.ContentType   =   "image/png ";
                        string   LanaguageReference   =   ((ProfileCommon)context.Profile).LanguagePreference;
                        if   (!string.IsNullOrEmpty(LanaguageReference))
                        {
                                        Thread.CurrentThread.CurrentUICulture   =   new   CultureInfo(LanaguageReference);
                        }
                        Bitmap   bm   =   Resources.Litware.LitwareSlogan;
                        MemoryStream   image   =   new   MemoryStream();
                        bm.Save(image,ImageFormat.Png);
                        context.Response.BinaryWrite(image.GetBuffer());
                  }
}
--------------------------------------------------------------------------
文字本地化好处理.本地化图像哪里调用路径了??谢谢.我看不出来.有人做过嘛?

------解决方案--------------------------------------------------------
GetLocalResourceObject
------解决方案--------------------------------------------------------
Thread.CurrentThread.CurrentUICulture = new CultureInfo(LanaguageReference);
------解决方案--------------------------------------------------------
Bitmap bm = GetLocalResourceObject( "image1 ") as Bitmap;

没测,自己试试吧
------解决方案--------------------------------------------------------
顶你的PP!
------解决方案--------------------------------------------------------
我顶楼上的PP!
------解决方案--------------------------------------------------------
乱顶一下
  相关解决方案