Ejemplo n.º 1
0
        public ViewResult View(CultureInfo language,
                               object model)
        {
            language.SetCurrentCulture();

            return View(model);
        }
Ejemplo n.º 2
0
        public ActionResult HtmlRepresentation(CultureInfo language, 
                                               DateTime date)
        {
            language.SetCurrentCulture();

            return View(date);
        }
Ejemplo n.º 3
0
        public ActionResult HtmlRepresentation(CultureInfo language, 
                                               string key)
        {
            language.SetCurrentCulture();

            ViewBag.Key = key;

            return View(HttpContext.Cache[key]);
        }
Ejemplo n.º 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;
            }
        }