• 实现本地化多语言


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;

    /// <summary>
    /// Summary description for PageBase
    /// </summary>
    public class PageBase: System.Web.UI.Page
    {
     public PageBase()
     {
      //
      // TODO: Add constructor logic here
      //
     }

        #region 实现本地化多语言
        protected override void InitializeCulture()
        {
            base.InitializeCulture();

            string languagePreference = (string)Session["LanguagePreference"];
            if (string.IsNullOrEmpty(languagePreference) || (languagePreference.ToLower() == "auto"))
            {
                languagePreference = "zh-CN";
            }
            this.UICulture = languagePreference;
            this.Culture = languagePreference;

            //System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CreateSpecificCulture(languagePreference);
            //System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(languagePreference);

            System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo(languagePreference);
            System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
            System.Threading.Thread.CurrentThread.CurrentCulture = culture;

        }
        #endregion

    }

  • 相关阅读:
    结对编程作业
    4组-Alpha冲刺-2/6
    4组-Alpha冲刺-1/6
    结对编程作业
    4组 团队展示
    python多进程遇到的问题和解决
    GNS3第一次ping通
    前缀表达式计算(栈的使用)
    欧拉筛法(线性筛)素数
    拓扑排序
  • 原文地址:https://www.cnblogs.com/hxwzwiy/p/2412242.html
Copyright © 2020-2023  润新知