该如何写资源文件?是写全局的资源文件?还是对每个页面都生成两个资源文件?
在完成上述工作后,该如何做响应事件的方法?
请各位高手指教...谢谢.

解决方案 »

  1.   

    http://blog.csdn.net/snowdust/archive/2007/06/14/1651944.aspx
      

  2.   

    //Global.asaxusing System;
    using System.Collections;
    using System.ComponentModel;
    using System.Web;
    using System.Web.SessionState;using System.Threading;
    using System.Globalization;namespace LanguageSwitch 
    {
    /// <summary>
    /// Global 的摘要说明。
    /// </summary>
    public class Global : System.Web.HttpApplication
    {
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.IContainer components = null; public Global()
    {
    InitializeComponent();
    }

    protected void Application_Start(Object sender, EventArgs e)
    {
    Hashtable CultHashTable = new Hashtable();
    CultHashTable.Add("en-US","en-US");
    CultHashTable.Add("ko-KR","ko-KR");
    CultHashTable.Add("zh-CN","zh-CN");
    CultHashTable.Add("zh-TW","zh-TW");
    Application["CultHashTable"] = CultHashTable;
    }
     
    protected void Session_Start(Object sender, EventArgs e)
    { } protected void Application_BeginRequest(Object sender, EventArgs e)
    {
    try
    {
    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);

    }
    catch
    {
    Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-CN");
    }
    if (((Hashtable)Application["CultHashTable"]).Contains(Thread.CurrentThread.CurrentCulture.Name.ToString()))
    {
    Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
    }
    else
    {
    Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("zh-CN");
    }
    } protected void Application_EndRequest(Object sender, EventArgs e)
    {
    } protected void Application_AuthenticateRequest(Object sender, EventArgs e)
    { } protected void Application_Error(Object sender, EventArgs e)
    { } protected void Session_End(Object sender, EventArgs e)
    { } protected void Application_End(Object sender, EventArgs e)
    { }

    #region Web 窗体设计器生成的代码
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {    
    this.components = new System.ComponentModel.Container();
    }
    #endregion
    }
    }
      

  3.   

    思路:
    写好Global.asax,如上.
    你想支持几种语言就写几个资源文件.最好放到不同文件夹下.
    写个类,遍历所有页面上的控件,并对控件选择不同语言.
    每页的初始化事件里调用该类,并把当前页做为参数传递.