コード例 #1
0
        public ViewResult View(CultureInfo language,
                               object model)
        {
            language.SetCurrentCulture();

            return View(model);
        }
コード例 #2
0
ファイル: DateController.cs プロジェクト: KarlDirck/cavity
        public ActionResult HtmlRepresentation(CultureInfo language, 
                                               DateTime date)
        {
            language.SetCurrentCulture();

            return View(date);
        }
コード例 #3
0
ファイル: EchoController.cs プロジェクト: KarlDirck/cavity
        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());
        }
コード例 #5
0
        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;
            }
        }