zoukankan      html  css  js  c++  java
  • .NET多语言版本系统功能实现

    .aspx
    <asp:Button ID="btnEnglish" CssClass="btn" runat="server" BackColor="White" BorderStyle="None"
                           Text="English" Width="60px" onclick="btnEnglish_Click" TabIndex="5" />
    <asp:Button ID="btnChinese" CssClass="btn" runat="server" BackColor="White" BorderStyle="None"
                             Text="简体中文" Width="60px" onclick="btnChinese_Click" TabIndex="6" />
     
    .cs
       private void Localize()//从语言文件中获取数据
        {
            Page.Title = this.GetString("T0190");// "物料管控系统身份验证";
            lblUserCode.Text = this.GetString("T0164") ;
        }

        protected void btnEnglish_Click(object sender, EventArgs e)
        {
            Response.Cookies["LANGUAGE"].Expires = DateTime.Now.AddMonths(3);
            Response.Cookies["LANGUAGE"].Value = "en-US";
            CurrentSession.Language = "en-US";
            Response.Redirect("login.aspx?msg=" + msgStr + "&sourceUrl=" + sourceUrl);
        }

        protected void btnChinese_Click(object sender, EventArgs e)
        {
            Response.Cookies["LANGUAGE"].Expires = DateTime.Now.AddMonths(3);
            Response.Cookies["LANGUAGE"].Value = "zh-TW";
            CurrentSession.Language = "zh-TW";
            Response.Redirect("login.aspx?msg=" + msgStr + "&sourceUrl=" + sourceUrl);
        }
     
    .cs  类
    public string GetString(string strNo) {
      //多語言支持
      //ResourceManager rm = new ResourceManager("TravelRequest.Common.Resource", Assembly.GetExecutingAssembly());  //For VS2003
      //return rm.GetString(strNo);
      //return Resources.MultiLang.ResourceManager.GetString(strNo);    //For VS2005
      return (String)GetGlobalResourceObject("MultiLang", strNo);
     }
  • 相关阅读:
    安装oracle客户端后,怎样设置电脑的环境变量?
    KETTLE、spoon使用
    软件环境常识 --dev sit uat
    使用 CAS 在 Tomcat 中实现单点登录 http://www.ibm.com/developerworks/cn/opensource/os-cn-cas/
    oracle数据库的完整性约束规则详解
    Oracle创建表语句(Create table)语法详解及示例
    Oracle TO_DATE 日期格式
    L/SQL Developer 和 instantclient客户端安装配置
    mysql里的序列应用详解
    .net core 使用 textSharp生成pdf
  • 原文地址:https://www.cnblogs.com/lovewife/p/1396573.html
Copyright © 2011-2022 走看看