Example #1
0
        /// <summary>
        /// Sets the <see cref="P:System.Web.UI.Page.Culture"/> and <see cref="P:System.Web.UI.Page.UICulture"/> for the current thread of the page.
        /// </summary>
        protected override void InitializeCulture()
        {
            var culture = LanguageUtility.GetCurrentUILanguage();

            UILanguageId = culture;

            if (String.IsNullOrEmpty(culture))
            {
                culture = "Auto";
            }

            Page.UICulture = culture;
            Page.Culture   = culture;
            if (culture != "Auto")
            {
                var ci = new System.Globalization.CultureInfo(culture);
                System.Threading.Thread.CurrentThread.CurrentCulture   = ci;
                System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
            }

            base.InitializeCulture();
        }