예제 #1
0
        public ViewResult View(CultureInfo language,
                               object model)
        {
            language.SetCurrentCulture();

            return View(model);
        }
예제 #2
0
        public ActionResult HtmlRepresentation(CultureInfo language, 
                                               DateTime date)
        {
            language.SetCurrentCulture();

            return View(date);
        }
예제 #3
0
        public ActionResult HtmlRepresentation(CultureInfo language, 
                                               string key)
        {
            language.SetCurrentCulture();

            ViewBag.Key = key;

            return View(HttpContext.Cache[key]);
        }
예제 #4
0
        public ActionResult ContentNegotiation(CultureInfo language)
        {
            if (null == language)
            {
                throw new ArgumentNullException("language");
            }

            if (CultureInfo.InvariantCulture == language)
            {
                throw new ArgumentOutOfRangeException("language");
            }

            language.SetCurrentCulture();

            Accept accept = Request.Headers["Accept"];

            return accept.Negotiate(Request, GetType());
        }
        public void op_SetCurrentCulture_CultureInfo()
        {
            var culture = Thread.CurrentThread.CurrentUICulture;

            try
            {
                var expected = new CultureInfo("fr");

                expected.SetCurrentCulture();

                var actual = Thread.CurrentThread.CurrentUICulture;

                Assert.Equal(expected, actual);
            }
            finally
            {
                Thread.CurrentThread.CurrentUICulture = culture;
            }
        }