demo20230512/Filter/ApiMultilanguageAttribute.cs

33 lines
1.1 KiB
C#
Raw Normal View History

2023-05-12 10:20:28 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Http.Filters;
using Resources.Helper;
namespace Weee.Filter
{
[Obsolete("This logic is moved into Global.asax.cs's Application_BeginRequest")]
public class ApiMultilanguageAttribute : ActionFilterAttribute
{
/*
public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext actionContext)
{
string cultureName = null;
// Attempt to read the culture cookie from Request
HttpCookie cultureCookie = HttpContext.Current.Request.Cookies["_culture"];
if (cultureCookie != null)
cultureName = cultureCookie.Value;
else
cultureName = CultureHelper.GetImplementedCulture(cultureName); // This is safe
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(cultureName);
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
base.OnActionExecuting(actionContext);
}
*/
}
}