Пример #1
0
        public object Index()
        {
            var user = new UserInfo
                                   {
                                       Name = "Frankie",
                                       Culture = Application.GetSessionCulture(ControllerContext)
                                   };

            try
            {
                Thread.CurrentThread.CurrentCulture =
                    CultureInfo.CreateSpecificCulture(user.Culture);
            }
            catch
            {
                Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");
            }
            Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;

            ViewData["user"] = user;
            return View();
        }
Пример #2
0
        public object Index()
        {
            var user = new UserInfo
                                   {
                                       Name = "Frankie",
                                       Culture = Convert.ToString(Session["culture"])
                                   };

            try
            {
                Thread.CurrentThread.CurrentCulture =
                    CultureInfo.CreateSpecificCulture(user.Culture);
            }
            catch
            {
                Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");
            }
            Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;

            ViewData["user"] = user;
            return View();
        }